Skip to contentSkip to conversation

KVM/VMX: Use TEST %REG,%REG instead of CMP $0,%REG in vmenter.S

PATCH Applied Uros Bizjak 2 participants 2 messages Oct 29, 2020 – Dec 11, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM/VMX: Use TEST %REG,%REG instead of CMP $0,%REG in vmenter.S

Saves one byte in __vmx_vcpu_run for the same functionality.

Cc Paolo Bonzini <[email protected]>
Cc Sean Christopherson <[email protected]>
---
 arch/x86/kvm/vmx/vmenter.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmenter.S +1 -1
index 90ad7a6246e3..e85aa5faa22d 100644
@@ -132,7 +132,7 @@ SYM_FUNC_START(__vmx_vcpu_run)
 	mov (%_ASM_SP), %_ASM_AX
 
 	/* Check if vmlaunch or vmresume is needed */
-	cmpb $0, %bl
+	testb %bl, %bl
 
 	/* Load guest registers.  Don't clobber flags. */
 	mov VCPU_RCX(%_ASM_AX), %_ASM_CX
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 15 lines · Uros Bizjak

Saves one byte in __vmx_vcpu_run for the same functionality.

Cc Paolo Bonzini <[email protected]>
Cc Sean Christopherson <[email protected]>
---
  arch/x86/kvm/vmx/vmenter.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmenter.S +0 -0
index 90ad7a6246e3..e85aa5faa22d 100644

arch/x86/kvm/vmx/vmenter.S SYM_FUNC_START(__vmx_vcpu_run) · line 138

Quoted 8 lines
arch/x86/kvm/vmx/vmenter.S +1 -1
@@ -132,7 +132,7 @@ SYM_FUNC_START(__vmx_vcpu_run)
  	mov (%_ASM_SP), %_ASM_AX
 
  	/* Check if vmlaunch or vmresume is needed */
-	cmpb $0, %bl
+	testb %bl, %bl
 
  	/* Load guest registers.  Don't clobber flags. */
  	mov VCPU_RCX(%_ASM_AX), %_ASM_CX

Queued, thanks. This was mistakenly marked as read, so I thought I had already applied it.

Paolo