Re: [PATCH 1/3] KVM: VMX: Macrofy GPR swapping in __vmx_vcpu_run()

From: Paolo Bonzini

Date: Fri May 15 2026 - 13:56:24 EST


On Thu, May 14, 2026 at 9:30 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Wed, May 13, 2026, Paolo Bonzini wrote:
> > From: "Chang S. Bae" <chang.seok.bae@xxxxxxxxx>
> >
> > Convert the repeated register save/restore sequences into macros to
> > simplify the VM entry code.
>
> This is not simpler. Maybe it ends up being less verbose, but I don't see how
> anyone can claim this is simpler.

Right - it is not simpler but it is (a lot) more compact and
especially less error prone.

BTW, this part:

> > +#ifdef CONFIG_X86_64
> > + .ifc \r32,%r8d
> > + \opd = 8
> > + .endif
> > + .ifc \r32,%r9d
> > + \opd = 9
> > + .endif
> > + .ifc \r32,%r10d
> > + \opd = 10
> > + .endif
> > + .ifc \r32,%r11d
> > + \opd = 11
> > + .endif
> > + .ifc \r32,%r12d
> > + \opd = 12
> > + .endif
> > + .ifc \r32,%r13d
> > + \opd = 13
> > + .endif
> > + .ifc \r32,%r14d
> > + \opd = 14
> > + .endif
> > + .ifc \r32,%r15d
> > + \opd = 15
> > + .endif
> > +#endif

is dead and can be removed.

Paolo