aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-03-07 10:24:54 -0500
committerAvi Kivity <avi@redhat.com>2011-05-11 07:56:56 -0400
commit00eba012d53e63f620455f7013917e4bf59424f2 (patch)
tree4fe4d5bb95dda8c4cf503cfd90c525c6147e3497 /arch
parentf9902069c41254ad116e089e64ea21d3a000cc41 (diff)
KVM: VMX: Refactor vmx_complete_atomic_exit()
Move the exit reason checks to the front of the function, for early exit in the common case. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/vmx.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 89130ba3b698..51aa827e3bbb 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3896,17 +3896,20 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
3896 3896
3897static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx) 3897static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
3898{ 3898{
3899 u32 exit_intr_info = vmx->exit_intr_info; 3899 u32 exit_intr_info;
3900
3901 if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY
3902 || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI))
3903 return;
3904
3905 exit_intr_info = vmx->exit_intr_info;
3900 3906
3901 /* Handle machine checks before interrupts are enabled */ 3907 /* Handle machine checks before interrupts are enabled */
3902 if ((vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY) 3908 if (is_machine_check(exit_intr_info))
3903 || (vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI
3904 && is_machine_check(exit_intr_info)))
3905 kvm_machine_check(); 3909 kvm_machine_check();
3906 3910
3907 /* We need to handle NMIs before interrupts are enabled */ 3911 /* We need to handle NMIs before interrupts are enabled */
3908 if (vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI && 3912 if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
3909 (exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
3910 (exit_intr_info & INTR_INFO_VALID_MASK)) { 3913 (exit_intr_info & INTR_INFO_VALID_MASK)) {
3911 kvm_before_handle_nmi(&vmx->vcpu); 3914 kvm_before_handle_nmi(&vmx->vcpu);
3912 asm("int $2"); 3915 asm("int $2");