Thread (48 messages) 48 messages, 9 authors, 2007-08-23

Re: [PATCH 1/23] document preferred use of volatile with atomic_t

From: Segher Boessenkool <hidden>
Date: 2007-08-16 21:37:30
Also in: lkml

But barriers force a flush of *everything* in scope,
Nonsense, whatever "flush" is supposed to mean here.
If you really, *really* distrust the compiler that much, you shouldn't 
be using barrier, since that uses volatile under the hood too.  You 
should just go ahead and implement the atomic operations in assembler, 
like Segher Boessenkool did for powerpc in response to my previous 
patchset.
Puh-lease.  I DO NOT DISTRUST THE COMPILER, I just don't assume
it will do whatever I would like it to do without telling it.
It's a machine you know, and it is very well documented.

(And most barriers don't (need to) use volatile).

Implementing the atomic ops in asm loses exactly *no* semantics,
and it doesn't add restrictions either; it does allow you however
to access an atomic_t with normal loads/stores independently, if
you so choose.  The only valid issue brought up so far is Russell
King's comment that GCC cannot schedule the machine instructions
in and around an asm() perfectly, it doesn't look inside the asm()
after all; but the situation isn't quite as sever as he suggests
(GCC _does_ know you are performing loads/stores, etc.); more about
that later, when I've finished researching the current state of
that stuff.


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help