mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@novell.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Rik van Riel <riel@redhat.com>,
	"Martin J. Bligh" <mbligh@aracnet.com>,
	Andrew Morton <akpm@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: ptep_establish/establish_pte needs set_pte_atomic and all set_pte must be written in asm
Date: Mon, 27 Sep 2004 18:41:54 +0200	[thread overview]
Message-ID: <20040927164154.GM28865@dualathlon.random> (raw)
In-Reply-To: <20040926203640.GR2499@dualathlon.random>

On Sun, Sep 26, 2004 at 10:36:40PM +0200, Andrea Arcangeli wrote:
> On Mon, Sep 27, 2004 at 06:30:25AM +1000, Paul Mackerras wrote:
> > FWIW, we also rely on several other things that are not guaranteed by
> > the C standard, for instance that integer arithmetic is 2's
> > complement, that bytes are individually addressable, and that pointers
> > are represented by an address that is no bigger than a long.
> 
> I wouldn't compare these with atomic writes on non volatile variables. I
> mean, sizeof(char *) being different than sizeof(long) is something I'm
> very confortable will not break anytime. If you want to add up to the
> list, even the gcc inline assembly itself isn't part of the language...
> (infact that was the major trouble for icc to add it AFIK)

Just to make an example of why you definitely cannot compare the
assumption of sizeof(char *) == sizeof(long), and complement 2
aritmetic, is that gcc is allowed to implement something like this:

	*64bit_ptr = 32bit_integer_var << 32;

as two instructions: xorl and a movl, that is likely to be faster than a
shiftleft + movq. Or maybe it's not faster on the x86-64 and gcc may
prefer to use shiftleft + movq, but you get the idea of what I'm talking
about, maybe for other archs the performance point is different etc...
(by instinct I believe it'd be faster even on x86, especially on the
nocona based on p4 core)

with the ptes on x86 the shiftleft of 12 probably avoid screwups but
that's just because we're lucky and I don't want to think what else gcc
could optimize by evaluating constants...

  parent reply	other threads:[~2004-09-27 16:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-25 15:54 Andrea Arcangeli
2004-09-25 23:33 ` Benjamin Herrenschmidt
2004-09-26  0:20   ` Andrea Arcangeli
2004-09-26  0:31     ` Rik van Riel
2004-09-26  0:46       ` Andrea Arcangeli
2004-09-26  0:59         ` Benjamin Herrenschmidt
2004-09-26  1:36           ` Andrea Arcangeli
2004-09-26  5:31             ` Benjamin Herrenschmidt
2004-09-26 20:30           ` Paul Mackerras
     [not found]             ` <20040926203640.GR2499@dualathlon.random>
2004-09-27 16:41               ` Andrea Arcangeli [this message]
2004-09-28  9:12         ` Pavel Machek
2004-09-26  0:44     ` Benjamin Herrenschmidt
2004-09-26  1:32       ` Andrea Arcangeli
2004-09-26  5:29         ` Benjamin Herrenschmidt
2004-09-26 15:39           ` Andrea Arcangeli
2004-09-26 14:41       ` Martin J. Bligh
2004-09-26 15:41         ` Andrea Arcangeli
2004-09-25 23:44 ` Rik van Riel
2004-09-26  0:31   ` Andrea Arcangeli
2004-09-26  0:37     ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040927164154.GM28865@dualathlon.random \
    --to=andrea@novell.com \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=paulus@samba.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®