Skip to content

Commit

Permalink
xen/events: initialize local per-cpu mask for all possible events
Browse files Browse the repository at this point in the history
The sizeof() argument in init_evtchn_cpu_bindings() is incorrect
resulting in only the first 64 (or 32 in 32-bit guests) ports having
their bindings being initialized to VCPU 0.

In most cases this does not cause a problem as request_irq() will set
the irq affinity which will set the correct local per-cpu mask.
However, if the request_irq() is called on a VCPU other than 0, there
is a window between the unmasking of the event and the affinity being
set were an event may be lost because it is not locally unmasked on
any VCPU. If request_irq() is called on VCPU 0 then local irqs are
disabled during the window and the race does not occur.

Fix this by initializing all NR_EVENT_CHANNEL bits in the local
per-cpu masks.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: stable@vger.kernel.org
  • Loading branch information
David Vrabel authored and Konrad Rzeszutek Wilk committed Aug 20, 2013
1 parent 3bc38cb commit 84ca7a8
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 @@ -348,7 +348,7 @@ static void init_evtchn_cpu_bindings(void)

for_each_possible_cpu(i)
memset(per_cpu(cpu_evtchn_mask, i),
(i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i)));
(i == 0) ? ~0 : 0, NR_EVENT_CHANNELS/8);
}

static inline void clear_evtchn(int port)
Expand Down

0 comments on commit 84ca7a8

Please sign in to comment.