Re: [GIT PULL] KVM fixes for Linux 7.2-rc6

From: Paolo Bonzini

Date: Wed Jul 29 2026 - 18:23:00 EST


On Thu, Jul 30, 2026 at 12:02 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Wed, 29 Jul 2026 at 14:45, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
> >
> > - Add memory clobber to asm for VMX instructions; without one, the compiler
> > could reorder them in troublesome ways because "asm volatile" and "asm goto"
> > only protect against removal of the asm.
>
> This is simply not true.
>
> "asm volatile" is not just a "don't remove". It is an ordering
> constraint too. It cannot move wrt other asm volatiles.
> So asm volatile is very much a "you can't re-order this asm or move it
> around significantly". [...]
>
> But at the same time it does *not* necessarily protect against the
> compiler re-ordering *other* things - like regular non-volatile memory
> reads and writes.

Then I was mistaken that reordering of asms could still happen without
a memory clobber. I agree that the commit message overstates what the
compiler can decide to do.

Thanks for the explanation,

Paolo