From f321e204a081f9c4dcc732e71283a401751a241b Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Fri, 27 Feb 2015 13:48:46 +0000 Subject: [PATCH] Fix event channel unmasking for two-level ABI The two-level ABI requires that an event is masked for the unmask hypercall to raise the event, so the test-and-clear operation in the guest basically means that pending events get stuck. The simple fix is to re-mask pending events before making the hypercall. This is unnecessary when the FIFO ABI is used, but it's safe. Hence this patch unconditionally re-masks pending events, regardless of ABI, before making the unmask hypercall. Signed-off-by: Paul Durrant --- src/xenbus/evtchn.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c index 63af079..3bb8d18 100644 --- a/src/xenbus/evtchn.c +++ b/src/xenbus/evtchn.c @@ -710,8 +710,16 @@ EvtchnUnmask( if (XENBUS_EVTCHN_ABI(PortUnmask, &Context->EvtchnAbi, - LocalPort)) + LocalPort)) { + // + // The event was pending so we must re-mask and use + // a hypercall to do the unmask and raise the event + // + XENBUS_EVTCHN_ABI(PortMask, + &Context->EvtchnAbi, + LocalPort); (VOID) EventChannelUnmask(LocalPort); + } done: if (!InUpcall) -- 2.39.5