qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] target-i386 : fix a race condition result to lost I


From: Peng Hao
Subject: [Qemu-devel] [PATCH] target-i386 : fix a race condition result to lost INIT
Date: Mon, 31 Jul 2017 04:01:38 +0800

when SMP VM start, AP may lost INIT because of receiving INIT between
kvm_vcpu_ioctl_x86_get/set_vcpu_events.

   vcpu 0                             vcpu 1
                               kvm_vcpu_ioctl_x86_get_vcpu_events
                                       events->smi.latched_init=0
 send INIT to vcpu1
   set vcpu1's pending_events
                               kvm_vcpu_ioctl_x86_set_vcpu_events
                                    events->smi.latched_init == 0
                                      clear INIT in pending_events
considering migration, just at level >= KVM_PUT_RESET_STATE,
add KVM_VCPUEVENT_VALID_SMM in events.flags.I think it is better to
modify in qemu.

Signed-off-by: Peng Hao <address@hidden>
---
 target/i386/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index a6613e1..be146cb 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2438,7 +2438,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
         /* Stop SMI delivery on old machine types to avoid a reboot
          * on an inward migration of an old VM.
          */
-        if (!cpu->kvm_no_smi_migration) {
+        if (!cpu->kvm_no_smi_migration && (level >= KVM_PUT_RESET_STATE)) {
             events.flags |= KVM_VCPUEVENT_VALID_SMM;
         }
     }
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]