Messages in this thread | ![/](/images/icornerl.gif) | | From | Linus Torvalds <> | Date | Wed, 17 Apr 2019 09:26:23 -0700 | Subject | Re: [PATCH] asm/io: Correct output operand specification of the MMIO write* routines |
| |
On Wed, Apr 17, 2019 at 1:50 AM Borislav Petkov <bp@alien8.de> wrote: > > I'm looking at > > c1f64a58003f ("x86: MMIO and gcc re-ordering issue") > > and trying to figure out was there any particular reason the address to > the MMIO write routines had to be an input operand?
It doesn't have to be an input operand, but as long as it's a "asm volatile" it simply doesn't matter, and it won't be re-ordered or optimized wrt other mmio accesses (that are also "asm volatile").
The memory clobber we have is to make sure that it's not re-ordered with non-mmio accesses to other addresses (and thats' true for reads _or_ writes, so both mmio read and mmio write have the memory clobber).
So changing the input "m" to an output "+m" simply shouldn't matter. There's no upside. You can't remove the memory clobber anyway, and you can't remove the "asm volatile".
The "__" versions lack the memory clobber and aren't ordered wrt normal memory (but are ordered wrt other mmio due to the "asm volaile").
So I see no upside to changing it.
Linus
| ![\](/images/icornerr.gif) |