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

From: Segher Boessenkool <[email-masked]>
Date: Thu, 17 May 2018 14:23:31 -0500

Hi!

On Thu, May 17, 2018 at 01:06:10PM +1000, Benjamin Herrenschmidt wrote:
> 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.

(And the memory clobber does not prevent the compiler from moving the
asm around, or duplicating it, etc., and neither does the volatile).

Segher