Thread (9 messages) flat view 9 messages, 3 authors, 2019-08-06

Re: [PATCH v2 3/3] powerpc/spinlocks: Fix oops in shared-processor spinlocks

From: Segher Boessenkool <hidden>
Date: 2019-08-06 15:59:23

On Tue, Aug 06, 2019 at 10:14:27PM +1000, Michael Ellerman wrote:
Christopher M Riedl [off-list ref] writes:
quoted
Yep, and that's no good. Hmm, executing the barrier() in the non-shared-processor
case probably hurts performance here?
It's only a "compiler barrier", so it shouldn't generate any code.

But it does have the effect of telling the compiler it can't optimise
across that barrier, which can be important.
This is

#define barrier() __asm__ __volatile__("": : :"memory")

It doesn't tell the compiler "not to optimise" across the barrier.  It
tells the compiler that all memory accesses before the barrier should
stay before it, and all accesses after the barrier should stay after it,
because it says the "barrier" can access and/or change any memory.

This does not tell the hardware not to move those accesses around.  It
also doesn't say anything about things that are not in memory.  Not
everything you think is in memory, is.  What is and isn't in memory can
change during compilation.


[ This message brought to you by the "Stamp Out Optimisation Barrier"
  campaign. ]


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