]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
XX: GSI assertion locking hack
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 24 Jan 2023 09:18:15 +0000 (10:18 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 24 Jan 2023 09:24:19 +0000 (10:24 +0100)
We see lockups with xen-disk and GSI evtchn delivery. The events stop being
delivered to the guest. Empirically, this makes that stop happening. It
shouldn't; I have no idea why.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
target/i386/kvm/xen-emu.c

index 9950bbecd1e43082aa816013d3917c45b2fe0f9e..6f3ab059ac11174324b8608f71d2e63407d2f8cb 100644 (file)
@@ -395,13 +395,16 @@ void kvm_xen_maybe_deassert_callback(CPUState *cs)
         return;
     }
 
+    qemu_mutex_lock_iothread();
     /* If the evtchn_upcall_pending flag is cleared, turn the GSI off. */
-    if (!vi->evtchn_upcall_pending) {
-        qemu_mutex_lock_iothread();
-        X86_CPU(cs)->env.xen_callback_asserted = false;
-        xen_evtchn_set_callback_level(0);
-        qemu_mutex_unlock_iothread();
+    if (X86_CPU(cs)->env.xen_callback_asserted &&
+        !vi->evtchn_upcall_pending) {
+        if (!vi->evtchn_upcall_pending) {
+            X86_CPU(cs)->env.xen_callback_asserted = false;
+            xen_evtchn_set_callback_level(0);
+        }
     }
+    qemu_mutex_unlock_iothread();
 }
 
 void kvm_xen_set_callback_asserted(void)