From: Ian Campbell Date: Fri, 8 Oct 2010 15:59:12 +0000 (+0100) Subject: xen: ensure that all event channels start off bound to VCPU 0 X-Git-Tag: firefly_0821_release~7613^2~3616^3~5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b0097adeec27e30223c989561ab0f7aa60d1fe93;p=firefly-linux-kernel-4.4.55.git xen: ensure that all event channels start off bound to VCPU 0 All event channels startbound to VCPU 0 so ensure that cpu_evtchn_mask is initialised to reflect this. Otherwise there is a race after registering an event channel but before the affinity is explicitly set where the event channel can be delivered. If this happens then the event channel remains pending in the L1 (evtchn_pending) array but is cleared in L2 (evtchn_pending_sel), this means the event channel cannot be reraised until another event channel happens to trigger the same L2 entry on that VCPU. sizeof(cpu_evtchn_mask(0))==sizeof(unsigned long*) which is not correct, and causes only the first 32 or 64 event channels (depending on architecture) to be initially bound to VCPU0. Use sizeof(struct cpu_evtchn_s) instead. Signed-off-by: Ian Campbell Cc: Jeremy Fitzhardinge Cc: stable@kernel.org --- diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 8beb2bc60f7d..b4e73011a80e 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -261,7 +261,7 @@ static void init_evtchn_cpu_bindings(void) } #endif - memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); + memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s)); } static inline void clear_evtchn(int port)