From: Sergiy Kibrik' via OSv Development <osv-dev@googlegroups.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

osv: xen_intr: do not use unmask_evtchn() in IRQ handler

unmask_evtchn() has side effect of setting evtchn_upcall_pending and
triggering interrupt from Xen if unmasked port is pending.
This works fine when unmasking new port, but in case of calling it from
IRQ handler can lead to race and lost interrupt.

do_irq() already handles pending interrupts, there's no need to check pending ports and mess with interrupt handler logic, simply set mask bitfield and continue.

This fixes lost interrupt on aarch64 platform.

Signed-off-by: Sergiy Kibrik <sergiy.kib...@globallogic.com>
Message-Id: <1487597529-28580-8-git-send-email-sergiy.kib...@globallogic.com>

---
diff --git a/core/xen_intr.cc b/core/xen_intr.cc
--- a/core/xen_intr.cc
+++ b/core/xen_intr.cc
@@ -96,7 +96,7 @@ void xen_irq::do_irq()
                 void *arg = xen_allocated_irqs[port].arg;
xen_shared_info.evtchn_pending[l1i].fetch_and(~(1ULL << l2i));
                 xen_allocated_irqs[port].handler(arg);
-                unmask_evtchn(port);
+                xen_shared_info.evtchn_mask[l1i].fetch_and(~(1ULL << l2i));
             }
         }
         trace_xen_irq_exec_ret();

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to