]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: x86: Move kvm_{before,after}_interrupt() calls to vendor code
authorSean Christopherson <sean.j.christopherson@intel.com>
Sat, 20 Apr 2019 05:50:58 +0000 (22:50 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 18 Jun 2019 09:46:03 +0000 (11:46 +0200)
VMX can conditionally call kvm_{before,after}_interrupt() since KVM
always uses "ack interrupt on exit" and therefore explicitly handles
interrupts as opposed to blindly enabling irqs.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

index 302cb409d452fe542b9411fb786360626a88d118..acc09e9fc173a220e45875d40d7f24906c909de0 100644 (file)
@@ -6174,6 +6174,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
 
 static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
 {
+       kvm_before_interrupt(vcpu);
        local_irq_enable();
        /*
         * We must have an instruction with interrupts enabled, so
@@ -6181,6 +6182,7 @@ static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
         */
        asm("nop");
        local_irq_disable();
+       kvm_after_interrupt(vcpu);
 }
 
 static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
index c90abf33b50989fb99021e7b9e1af7f48a385ebb..963c8c409223a95924f245c950835c9a92cf5545 100644 (file)
@@ -6145,6 +6145,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
        desc = (gate_desc *)host_idt_base + vector;
        entry = gate_offset(desc);
 
+       kvm_before_interrupt(vcpu);
+
        asm volatile(
 #ifdef CONFIG_X86_64
                "mov %%" _ASM_SP ", %[sp]\n\t"
@@ -6165,6 +6167,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
                [ss]"i"(__KERNEL_DS),
                [cs]"i"(__KERNEL_CS)
        );
+
+       kvm_after_interrupt(vcpu);
 }
 STACK_FRAME_NON_STANDARD(vmx_handle_external_intr);
 
index dcba699e2d464329fcf369559f44b50228c67f68..9ff3a670d2b34359e5f0780d1171ff17069ed246 100644 (file)
@@ -7999,9 +7999,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
        vcpu->mode = OUTSIDE_GUEST_MODE;
        smp_wmb();
 
-       kvm_before_interrupt(vcpu);
        kvm_x86_ops->handle_external_intr(vcpu);
-       kvm_after_interrupt(vcpu);
 
        ++vcpu->stat.exits;