diff options
author | Avi Kivity <avi@redhat.com> | 2011-03-07 17:37:37 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-11 07:56:56 -0400 |
commit | c5ca8e572c4d8cb8dec1cf5b3fc9c7066f6b2c29 (patch) | |
tree | 5e5fd00c9d3464e984b8821293b409a0954978a6 /arch/x86/kvm/vmx.c | |
parent | 00eba012d53e63f620455f7013917e4bf59424f2 (diff) | |
download | lwn-c5ca8e572c4d8cb8dec1cf5b3fc9c7066f6b2c29.tar.gz lwn-c5ca8e572c4d8cb8dec1cf5b3fc9c7066f6b2c29.zip |
KVM: VMX: Don't VMREAD VM_EXIT_INTR_INFO unconditionally
Only read it if we're going to use it later.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 51aa827e3bbb..f95f48b26006 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3902,6 +3902,7 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI)) return; + vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); exit_intr_info = vmx->exit_intr_info; /* Handle machine checks before interrupts are enabled */ @@ -3919,7 +3920,7 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) { - u32 exit_intr_info = vmx->exit_intr_info; + u32 exit_intr_info; bool unblock_nmi; u8 vector; bool idtv_info_valid; @@ -3929,6 +3930,11 @@ static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) if (cpu_has_virtual_nmis()) { if (vmx->nmi_known_unmasked) return; + /* + * Can't use vmx->exit_intr_info since we're not sure what + * the exit reason is. + */ + exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); unblock_nmi = (exit_intr_info & INTR_INFO_UNBLOCK_NMI) != 0; vector = exit_intr_info & INTR_INFO_VECTOR_MASK; /* @@ -4176,7 +4182,6 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) vmx->launched = 1; vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); - vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); vmx_complete_atomic_exit(vmx); vmx_recover_nmi_blocking(vmx); |