[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <784250b50ba166650cbbb4de29b5559b@kernel.crashing.org>
Date: Sat, 18 Aug 2007 00:09:45 +0200
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christoph Lameter <clameter@....com>,
Paul Mackerras <paulus@...ba.org>, heiko.carstens@...ibm.com,
horms@...ge.net.au, Stefan Richter <stefanr@...6.in-berlin.de>,
Satyam Sharma <satyam@...radead.org>,
Ilpo J?rvinen <ilpo.jarvinen@...sinki.fi>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
David Miller <davem@...emloft.net>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>, ak@...e.de,
Netdev <netdev@...r.kernel.org>, cfriesen@...tel.com,
rpjday@...dspring.com, jesper.juhl@...il.com,
linux-arch@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>, zlynx@....org,
schwidefsky@...ibm.com, Chris Snook <csnook@...hat.com>,
Herbert Xu <herbert@...dor.apana.org.au>, wensong@...ux-vs.org,
wjiang@...ilience.com
Subject: Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
> Of course, since *normal* accesses aren't necessarily limited wrt
> re-ordering, the question then becomes one of "with regard to *what*
> does
> it limit re-ordering?".
>
> A C compiler that re-orders two different volatile accesses that have a
> sequence point in between them is pretty clearly a buggy compiler. So
> at a
> minimum, it limits re-ordering wrt other volatiles (assuming sequence
> points exists). It also means that the compiler cannot move it
> speculatively across conditionals, but other than that it's starting to
> get fuzzy.
This is actually really well-defined in C, not fuzzy at all.
"Volatile accesses" are a side effect, and no side effects can
be reordered with respect to sequence points. The side effects
that matter in the kernel environment are: 1) accessing a volatile
object; 2) modifying an object; 3) volatile asm(); 4) calling a
function that does any of these.
We certainly should avoid volatile whenever possible, but "because
it's fuzzy wrt reordering" is not a reason -- all alternatives have
exactly the same issues.
Segher
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists