From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: seanjc@google.com, chang.seok.bae@intel.com
Subject: Re: [PATCH 7/7] KVM: VMX: replace vmx_spec_ctrl_restore_host with RESTORE_HOST_SPEC_CTRL_BODY
Date: Wed, 8 Apr 2026 23:48:18 +0200 [thread overview]
Message-ID: <3a97a7d0-2bd7-4908-8028-2b6c83b9be3b@redhat.com> (raw)
In-Reply-To: <20260408182213.522713-8-pbonzini@redhat.com>
On 4/8/26 20:22, Paolo Bonzini wrote:
> Reuse the same assembly as SVM, just with alternatives instead
> of cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS).
>
> Due to the dearth of registers in 32-bit x86, save/restore %eax
> across the restoring sequence, keeping it simple; the main alternative
> would be to leave vmx and flags on the stack, avoiding the need to read
> flags from %ebx. It's not really measurable difference.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/vmenter.h | 4 ++--
> arch/x86/kvm/vmx/vmenter.S | 25 +++++++++++++++----------
> arch/x86/kvm/vmx/vmx.c | 25 -------------------------
> arch/x86/kvm/vmx/vmx.h | 1 -
> 4 files changed, 17 insertions(+), 38 deletions(-)
>
> diff --git a/arch/x86/kvm/vmenter.h b/arch/x86/kvm/vmenter.h
> index e746e1328d3f..d822dafc75f7 100644
> --- a/arch/x86/kvm/vmenter.h
> +++ b/arch/x86/kvm/vmenter.h
> @@ -55,7 +55,7 @@
> #ifdef CONFIG_X86_64
> mov PER_CPU_VAR(x86_spec_ctrl_current), %rdx
> cmp \guest_spec_ctrl, %rdx
> - je \label
> + ALTERNATIVE "", __stringify(je \label), X86_FEATURE_KERNEL_IBRS
Actually the other way round:
ALTERNATIVE __stringify(je \label), "", X86_FEATURE_KERNEL_IBRS
> movl %edx, %eax
> shr $32, %rdx
> #else
> @@ -66,7 +66,7 @@
> mov 4 + \guest_spec_ctrl, %edi
> xor %edx, %edi
> or %edi, %esi
> - je \label
> + ALTERNATIVE "", __stringify(je \label), X86_FEATURE_KERNEL_IBRS
Same here.
Paolo
next prev parent reply other threads:[~2026-04-08 21:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 18:22 [PATCH 0/7] KVM: VMX/SVM: use the same SPEC_CTRL assembly code Paolo Bonzini
2026-04-08 18:22 ` [PATCH 1/7] KVM: VMX: remove regs argument of __vmx_vcpu_run Paolo Bonzini
2026-04-08 18:22 ` [PATCH 2/7] KVM: VMX: more cleanups to __vmx_vcpu_run Paolo Bonzini
2026-04-09 9:38 ` Binbin Wu
2026-04-08 18:22 ` [PATCH 3/7] KVM: SVM: prepare for making SPEC_CTRL switch common with VMX Paolo Bonzini
2026-04-08 18:22 ` [PATCH 4/7] KVM: SVM: adopt the same VMX_RUN_* flags as VMX Paolo Bonzini
2026-04-08 18:22 ` [PATCH 5/7] KVM: SVM: extract RESTORE_*_SPEC_CTRL_BODY out of svm/vmenter.S Paolo Bonzini
2026-04-08 18:22 ` [PATCH 6/7] KVM: VMX: switch to RESTORE_GUEST_SPEC_CTRL_BODY Paolo Bonzini
2026-04-08 18:22 ` [PATCH 7/7] KVM: VMX: replace vmx_spec_ctrl_restore_host with RESTORE_HOST_SPEC_CTRL_BODY Paolo Bonzini
2026-04-08 21:48 ` Paolo Bonzini [this message]
2026-04-10 0:16 ` Chang S. Bae
2026-04-09 17:36 ` Uros Bizjak
2026-04-10 0:16 ` Chang S. Bae
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=3a97a7d0-2bd7-4908-8028-2b6c83b9be3b@redhat.com \
--to=pbonzini@redhat.com \
--cc=chang.seok.bae@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.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
all inboxes | Powered by JetHome®