Thread (5 messages) 5 messages, 3 authors, 2019-01-31

Re: [PATCH] powerpc: Ensure gcc doesn't move around cache flushing in __patch_instruction

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2018-05-17 22:30:55

On Thu, 2018-05-17 at 14:23 -0500, Segher Boessenkool wrote:
Hi!

On Thu, May 17, 2018 at 01:06:10PM +1000, Benjamin Herrenschmidt wrote:
quoted
The current asm statement in __patch_instruction() for the cache flushes
doesn't have a "volatile" statement and no memory clobber. That means
gcc can potentially move it around (or move the store done by put_user
past the flush).
volatile is completely superfluous here, except maybe as documentation:
any asm without outputs is always volatile.
I wasn't aware of that. I was drilled early on to always stick volatile
in my asm statements if they have any form of side effect :-)
(And the memory clobber does not prevent the compiler from moving the
asm around, or duplicating it, etc., and neither does the volatile).
It prevents load/stores from moving around doesn't it ? I wanted to
make sure the store of the instruction doesn't move in/pass the asm. If
you say that's not needed then ignore the patch.

Cheers,
Ben.
 
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