kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Uros Bizjak <ubizjak@gmail.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: SVM/VMX: Use %rax instead of %__ASM_AX within CONFIG_X86_64
Date: Wed, 12 May 2021 15:27:29 +0000	[thread overview]
Message-ID: <YJvz4crhU7Gbn0p0@google.com> (raw)
In-Reply-To: <074223fd-6f82-9ed6-8664-f324f5027da5@redhat.com>

On Wed, May 12, 2021, Paolo Bonzini wrote:
> On 12/05/21 13:21, Uros Bizjak wrote:
> > There is no need to use %__ASM_AX within CONFIG_X86_64. The macro
> > will always expand to %rax.
> > diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S
> > index 3a6461694fc2..9273709e4800 100644
> > --- a/arch/x86/kvm/vmx/vmenter.S
> > +++ b/arch/x86/kvm/vmx/vmenter.S
> > @@ -142,14 +142,14 @@ SYM_FUNC_START(__vmx_vcpu_run)
> >   	mov VCPU_RSI(%_ASM_AX), %_ASM_SI
> >   	mov VCPU_RDI(%_ASM_AX), %_ASM_DI
> >   #ifdef CONFIG_X86_64
> > -	mov VCPU_R8 (%_ASM_AX),  %r8
> > -	mov VCPU_R9 (%_ASM_AX),  %r9
> > -	mov VCPU_R10(%_ASM_AX), %r10
> > -	mov VCPU_R11(%_ASM_AX), %r11
> > -	mov VCPU_R12(%_ASM_AX), %r12
> > -	mov VCPU_R13(%_ASM_AX), %r13
> > -	mov VCPU_R14(%_ASM_AX), %r14
> > -	mov VCPU_R15(%_ASM_AX), %r15
> > +	mov VCPU_R8 (%rax),  %r8
> > +	mov VCPU_R9 (%rax),  %r9
> > +	mov VCPU_R10(%rax), %r10
> > +	mov VCPU_R11(%rax), %r11
> > +	mov VCPU_R12(%rax), %r12
> > +	mov VCPU_R13(%rax), %r13
> > +	mov VCPU_R14(%rax), %r14
> > +	mov VCPU_R15(%rax), %r15
> >   #endif
> >   	/* Load guest RAX.  This kills the @regs pointer! */
> >   	mov VCPU_RAX(%_ASM_AX), %_ASM_AX
> > @@ -175,14 +175,14 @@ SYM_FUNC_START(__vmx_vcpu_run)
> >   	mov %_ASM_SI, VCPU_RSI(%_ASM_AX)
> >   	mov %_ASM_DI, VCPU_RDI(%_ASM_AX)
> >   #ifdef CONFIG_X86_64
> > -	mov %r8,  VCPU_R8 (%_ASM_AX)
> > -	mov %r9,  VCPU_R9 (%_ASM_AX)
> > -	mov %r10, VCPU_R10(%_ASM_AX)
> > -	mov %r11, VCPU_R11(%_ASM_AX)
> > -	mov %r12, VCPU_R12(%_ASM_AX)
> > -	mov %r13, VCPU_R13(%_ASM_AX)
> > -	mov %r14, VCPU_R14(%_ASM_AX)
> > -	mov %r15, VCPU_R15(%_ASM_AX)
> > +	mov %r8,  VCPU_R8 (%rax)
> > +	mov %r9,  VCPU_R9 (%rax)
> > +	mov %r10, VCPU_R10(%rax)
> > +	mov %r11, VCPU_R11(%rax)
> > +	mov %r12, VCPU_R12(%rax)
> > +	mov %r13, VCPU_R13(%rax)
> > +	mov %r14, VCPU_R14(%rax)
> > +	mov %r15, VCPU_R15(%rax)
> >   #endif
> >   	/* Clear RAX to indicate VM-Exit (as opposed to VM-Fail). */
> > 
> 
> It looks a bit weird either way (either the address is different within the
> #ifdef, or the address is different from the destinatino), so I lean more
> towards avoiding churn.

Even though it's unnecessary, I prefer %_ASM_AX since it provides a consistent
flow across the 64-bit-only boundary.

      reply	other threads:[~2021-05-12 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 11:21 [PATCH] KVM: SVM/VMX: Use %rax instead of %__ASM_AX within CONFIG_X86_64 Uros Bizjak
2021-05-12 11:58 ` Paolo Bonzini
2021-05-12 15:27   ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJvz4crhU7Gbn0p0@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).