KVM: SVM: do not generate "external interrupt exit" if other exit is pending
authorGleb Natapov <gleb@redhat.com>
Mon, 20 Sep 2010 08:15:32 +0000 (10:15 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:52:56 +0000 (10:52 +0200)
Nested SVM checks for external interrupt after injecting nested exception.
In case there is external interrupt pending the code generates "external
interrupt exit" and overwrites previous exit info. If previously injected
exception already generated exit it will be lost.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/svm.c

index 1a85fc507cf7413260a76fb2dd88a15c00cc38dd..c929d007696dbb56cb8d1be7699c143cf87c7707 100644 (file)
@@ -1707,6 +1707,14 @@ static inline bool nested_svm_intr(struct vcpu_svm *svm)
        if (!(svm->vcpu.arch.hflags & HF_HIF_MASK))
                return false;
 
+       /*
+        * if vmexit was already requested (by intercepted exception
+        * for instance) do not overwrite it with "external interrupt"
+        * vmexit.
+        */
+       if (svm->nested.exit_required)
+               return false;
+
        svm->vmcb->control.exit_code   = SVM_EXIT_INTR;
        svm->vmcb->control.exit_info_1 = 0;
        svm->vmcb->control.exit_info_2 = 0;