repository: /home/avi/kvm/linux-2.6
branch: master
commit e735785caa9c0a9134e1246bc8d5c5f73c2a3e65
Author: Laurent Vivier <[EMAIL PROTECTED]>
Date:   Thu Oct 18 15:19:01 2007 +0200

    KVM: Move kvm_guest_exit() after local_irq_enable()
    
    We need to make sure that the timer interrupt happens before we clear
    PF_VCPU, so the accounting code actually sees guest mode.
    
    http://lkml.org/lkml/2007/10/15/114
    
    Signed-off-by: Laurent Vivier <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index c84bbea..81b7a17 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2220,12 +2220,21 @@ again:
 
        kvm_x86_ops->run(vcpu, kvm_run);
 
-       kvm_guest_exit();
        vcpu->guest_mode = 0;
        local_irq_enable();
 
        ++vcpu->stat.exits;
 
+       /*
+        * We must have an instruction between local_irq_enable() and
+        * kvm_guest_exit(), so the timer interrupt isn't delayed by
+        * the interrupt shadow.  The stat.exits increment will do nicely.
+        * But we need to prevent reordering, hence this barrier():
+        */
+       barrier();
+
+       kvm_guest_exit();
+
        preempt_enable();
 
        /*

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to