KVM: nVMX: Use cached exit reason
PATCH 1/1 KVM: nVMX: Use cached exit reason
From: Jan Kiszka <[email protected]>
No need to re-read what vmx_vcpu_run already picked up for us.
Signed-off-by Jan Kiszka <[email protected]>
--- arch/x86/kvm/vmx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +2 -2
@@ -6082,10 +6082,10 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,*/ static bool nested_vmx_exit_handled (struct kvm_vcpu *vcpu) { -u32 exit_reason =vmcs_read32 (VM_EXIT_REASON );u32 intr_info =vmcs_read32 (VM_EXIT_INTR_INFO );struct vcpu_vmx *vmx =to_vmx (vcpu);struct vmcs12 *vmcs12 =get_vmcs12 (vcpu); +u32 exit_reason = vmx->exit_reason;if (vmx->nested.nested_run_pending)return 0 ;
@@ -7364,7 +7364,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)/* update exit information fields: */ - vmcs12->vm_exit_reason =vmcs_read32 (VM_EXIT_REASON ); + vmcs12->vm_exit_reason =to_vmx (vcpu)->exit_reason; vmcs12->exit_qualification =vmcs_readl (EXIT_QUALIFICATION ); vmcs12->vm_exit_intr_info =vmcs_read32 (VM_EXIT_INTR_INFO );
Signature · 1 line
1.7.3.4
Gleb Natapov
AppliedQuoted 5 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
No need to re-read what
vmx_vcpu_runalready picked up for us.Signed-off-by Jan Kiszka <[email protected]>
Applied, thanks.
Quoted 21 lines
--- arch/x86/kvm/vmx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/vmx.c +1
-1@@ -6082,10 +6082,10 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,*/ static bool nested_vmx_exit_handled (struct kvm_vcpu *vcpu) { -u32 exit_reason =vmcs_read32 (VM_EXIT_REASON );u32 intr_info =vmcs_read32 (VM_EXIT_INTR_INFO );struct vcpu_vmx *vmx =to_vmx (vcpu);struct vmcs12 *vmcs12 =get_vmcs12 (vcpu); +u32 exit_reason = vmx->exit_reason;if (vmx->nested.nested_run_pending)return 0 ;
arch/x86/kvm/vmx.c static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) · line 7367
Quoted 5 lines
arch/x86/kvm/vmx.c +1
-1@@ -7364,7 +7364,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)/* update exit information fields: */ - vmcs12->vm_exit_reason =vmcs_read32 (VM_EXIT_REASON ); + vmcs12->vm_exit_reason =to_vmx (vcpu)->exit_reason;
Well, this can be called after migration, so vcpu->exit_reason will be incorrect, but we all know how well migration works today with nested guests.
Quoted 5 lines
arch/x86/kvm/vmx.c +0
-0vmcs12->exit_qualification =vmcs_readl (EXIT_QUALIFICATION ); vmcs12->vm_exit_intr_info =vmcs_read32 (VM_EXIT_INTR_INFO );Signature · 1 line
1.7.3.4
--
Gleb.