Skip to content

Commit

Permalink
xen: ensure that all event channels start off bound to VCPU 0
Browse files Browse the repository at this point in the history
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 <ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: stable@kernel.org
  • Loading branch information
Ian Campbell authored and Jeremy Fitzhardinge committed Oct 22, 2010
1 parent 403a85f commit b0097ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b0097ad

Please sign in to comment.