When in kernel device model is introduced, the guest interrupt status 
may get changed when after it injected an IRQ and thus guest see a 
messed interrupt state. This patch tries to disable irq at that window 
to avoid the confusion.


     Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>



diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index ef9e32b..0cf6ea7 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1977,9 +1977,6 @@ static int vmx_vcpu_run(struct kvm_vcpu *vcpu,
struct kvm_run *kvm_run)
        int r;
 
 preempted:
-       if (!vcpu->mmio_read_completed)
-               do_interrupt_requests(vcpu, kvm_run);
-
        if (vcpu->guest_debug.enabled)
                kvm_guest_debug_pre(vcpu);
 
@@ -1996,9 +1993,16 @@ again:
         */
        vmcs_writel(HOST_CR0, read_cr0());
 
+       /*
+        * Disable interrupt to avoid future in kernel 
+        * APIC interrupt state confuse.
+        */
+       asm ( "pushf; cli \n\t");
+       if (!vcpu->mmio_read_completed)
+               do_interrupt_requests(vcpu, kvm_run);
+
        asm (
                /* Store host registers */
-               "pushf \n\t"
 #ifdef CONFIG_X86_64
                "push %%rax; push %%rbx; push %%rdx;"
                "push %%rsi; push %%rdi; push %%rbp;"

Attachment: cli.patch
Description: cli.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to