mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run()
@ 2022-11-19  0:37 Sean Christopherson
  2022-11-19  3:17 ` Jim Mattson
  2023-01-19 21:03 ` Sean Christopherson
  0 siblings, 2 replies; 3+ messages in thread
From: Sean Christopherson @ 2022-11-19  0:37 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Alexey Dobriyan

Access @flags using 32-bit operands when saving and testing @flags for
VMX_RUN_VMRESUME, as using 8-bit operands is unnecessarily fragile due
to relying on VMX_RUN_VMRESUME being in bits 0-7.  The behavior of
treating @flags a single byte is a holdover from when the param was
"bool launched", i.e. is not deliberate.

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/vmx/vmenter.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S
index 0b5db4de4d09..5bd39f63497d 100644
--- a/arch/x86/kvm/vmx/vmenter.S
+++ b/arch/x86/kvm/vmx/vmenter.S
@@ -69,8 +69,8 @@ SYM_FUNC_START(__vmx_vcpu_run)
 	 */
 	push %_ASM_ARG2
 
-	/* Copy @flags to BL, _ASM_ARG3 is volatile. */
-	mov %_ASM_ARG3B, %bl
+	/* Copy @flags to EBX, _ASM_ARG3 is volatile. */
+	mov %_ASM_ARG3L, %ebx
 
 	lea (%_ASM_SP), %_ASM_ARG2
 	call vmx_update_host_rsp
@@ -106,7 +106,7 @@ SYM_FUNC_START(__vmx_vcpu_run)
 	mov (%_ASM_SP), %_ASM_AX
 
 	/* Check if vmlaunch or vmresume is needed */
-	testb $VMX_RUN_VMRESUME, %bl
+	test $VMX_RUN_VMRESUME, %ebx
 
 	/* Load guest registers.  Don't clobber flags. */
 	mov VCPU_RCX(%_ASM_AX), %_ASM_CX
@@ -128,7 +128,7 @@ SYM_FUNC_START(__vmx_vcpu_run)
 	/* Load guest RAX.  This kills the @regs pointer! */
 	mov VCPU_RAX(%_ASM_AX), %_ASM_AX
 
-	/* Check EFLAGS.ZF from 'testb' above */
+	/* Check EFLAGS.ZF from 'test VMX_RUN_VMRESUME' above */
 	jz .Lvmlaunch
 
 	/*

base-commit: d663b8a285986072428a6a145e5994bc275df994
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run()
  2022-11-19  0:37 [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run() Sean Christopherson
@ 2022-11-19  3:17 ` Jim Mattson
  2023-01-19 21:03 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Mattson @ 2022-11-19  3:17 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: Paolo Bonzini, kvm, linux-kernel, Alexey Dobriyan

On Fri, Nov 18, 2022 at 5:33 PM Sean Christopherson <seanjc@google.com> wrote:
>
> Access @flags using 32-bit operands when saving and testing @flags for
> VMX_RUN_VMRESUME, as using 8-bit operands is unnecessarily fragile due
> to relying on VMX_RUN_VMRESUME being in bits 0-7.  The behavior of
> treating @flags a single byte is a holdover from when the param was
> "bool launched", i.e. is not deliberate.
>
> Cc: Alexey Dobriyan <adobriyan@gmail.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run()
  2022-11-19  0:37 [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run() Sean Christopherson
  2022-11-19  3:17 ` Jim Mattson
@ 2023-01-19 21:03 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2023-01-19 21:03 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Alexey Dobriyan

On Sat, 19 Nov 2022 00:37:47 +0000, Sean Christopherson wrote:
> Access @flags using 32-bit operands when saving and testing @flags for
> VMX_RUN_VMRESUME, as using 8-bit operands is unnecessarily fragile due
> to relying on VMX_RUN_VMRESUME being in bits 0-7.  The behavior of
> treating @flags a single byte is a holdover from when the param was
> "bool launched", i.e. is not deliberate.
> 
> 
> [...]

Applied to kvm-x86 vmx, thanks!

[1/1] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run()
      https://github.com/kvm-x86/linux/commit/55de8353fc67

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-19 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19  0:37 [PATCH] KVM: VMX: Access @flags as a 32-bit value in __vmx_vcpu_run() Sean Christopherson
2022-11-19  3:17 ` Jim Mattson
2023-01-19 21:03 ` Sean Christopherson

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®