diff options
Diffstat (limited to 'drivers/xen/events.c')
-rw-r--r-- | drivers/xen/events.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index a58ac435a9a4..5e8be462aed5 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -348,7 +348,7 @@ static void init_evtchn_cpu_bindings(void) | |||
348 | 348 | ||
349 | for_each_possible_cpu(i) | 349 | for_each_possible_cpu(i) |
350 | memset(per_cpu(cpu_evtchn_mask, i), | 350 | memset(per_cpu(cpu_evtchn_mask, i), |
351 | (i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i))); | 351 | (i == 0) ? ~0 : 0, NR_EVENT_CHANNELS/8); |
352 | } | 352 | } |
353 | 353 | ||
354 | static inline void clear_evtchn(int port) | 354 | static inline void clear_evtchn(int port) |
@@ -1493,8 +1493,10 @@ void rebind_evtchn_irq(int evtchn, int irq) | |||
1493 | /* Rebind an evtchn so that it gets delivered to a specific cpu */ | 1493 | /* Rebind an evtchn so that it gets delivered to a specific cpu */ |
1494 | static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | 1494 | static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) |
1495 | { | 1495 | { |
1496 | struct shared_info *s = HYPERVISOR_shared_info; | ||
1496 | struct evtchn_bind_vcpu bind_vcpu; | 1497 | struct evtchn_bind_vcpu bind_vcpu; |
1497 | int evtchn = evtchn_from_irq(irq); | 1498 | int evtchn = evtchn_from_irq(irq); |
1499 | int masked; | ||
1498 | 1500 | ||
1499 | if (!VALID_EVTCHN(evtchn)) | 1501 | if (!VALID_EVTCHN(evtchn)) |
1500 | return -1; | 1502 | return -1; |
@@ -1511,6 +1513,12 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | |||
1511 | bind_vcpu.vcpu = tcpu; | 1513 | bind_vcpu.vcpu = tcpu; |
1512 | 1514 | ||
1513 | /* | 1515 | /* |
1516 | * Mask the event while changing the VCPU binding to prevent | ||
1517 | * it being delivered on an unexpected VCPU. | ||
1518 | */ | ||
1519 | masked = sync_test_and_set_bit(evtchn, BM(s->evtchn_mask)); | ||
1520 | |||
1521 | /* | ||
1514 | * If this fails, it usually just indicates that we're dealing with a | 1522 | * If this fails, it usually just indicates that we're dealing with a |
1515 | * virq or IPI channel, which don't actually need to be rebound. Ignore | 1523 | * virq or IPI channel, which don't actually need to be rebound. Ignore |
1516 | * it, but don't do the xenlinux-level rebind in that case. | 1524 | * it, but don't do the xenlinux-level rebind in that case. |
@@ -1518,6 +1526,9 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | |||
1518 | if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) | 1526 | if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0) |
1519 | bind_evtchn_to_cpu(evtchn, tcpu); | 1527 | bind_evtchn_to_cpu(evtchn, tcpu); |
1520 | 1528 | ||
1529 | if (!masked) | ||
1530 | unmask_evtchn(evtchn); | ||
1531 | |||
1521 | return 0; | 1532 | return 0; |
1522 | } | 1533 | } |
1523 | 1534 | ||