Cc: Stefan Richter <stefanr@...>, <paulmck@...>, Peter Zijlstra <peterz@...>, <linux-kernel@...>, Linus Torvalds <torvalds@...>, David Howells <dhowells@...>
It is not the same as volatile type. What it does is tell the compiler
to clobber all registers or temporaries. This something pretty well
defined and hard to get wrong compared to volatile type.
Linux barriers aren't going to force a load to be emitted, if it can be
optimized away. If it optimized away a store, then I'd like to see a
test case.
The point is not whether it is possible to work with volatile types, but
that we tend not to use them in Linux to deal with concurrency.
Also, barriers seem to work fine for everybody else, so I think it is
likely you either aren't using them correctly, or have other bugs in the
code.
You should disable preempt before getting the processor id. Can't see any
other possible bugs, but you should be able to see from the disassembly
pretty easily.
--