Skip to contentSkip to conversation

xen/events: don't migrate disabled IRQs

PATCH In review Munehisa Kamata 2 participants 5 messages May 20, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/events: don't migrate disabled IRQs

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") introduced a crash below. This can be triggered after being resumed from suspend
(e.g. live migration) if there are disabled IRQs with
IRQD_SETAFFINITY_PENDING set.

kernel BUG at kernel/irq/migration.c:31!
...

CPU: 0 PID: 9 Comm: migration/0 Tainted: G            E   4.4.8 #1
Hardware name: Xen HVM domU, BIOS 4.2.amazon 04/04/2016
task: ffff880206200000 ti: ffff880206208000 task.ti: ffff880206208000
RIP: 0010:[<ffffffff810c13e9>]  [<ffffffff810c13e9>] irq_move_masked_irq+0xd9/0xf0
RSP: 0018:ffff88020620bc88  EFLAGS: 00010046
...
Call Trace:
 [<ffffffff81355877>] eoi_pirq+0xa7/0xd0
 [<ffffffff81355a07>] __startup_pirq+0xd7/0x140
 [<ffffffff81356f77>] xen_irq_resume+0x2c7/0x330
 [<ffffffff81354a66>] xen_suspend+0x86/0x140
 [<ffffffff810f9a83>] multi_cpu_stop+0xb3/0xe0
 [<ffffffff810f99d0>] ? cpu_stop_queue_work+0x80/0x80
 [<ffffffff810f9caa>] cpu_stopper_thread+0x7a/0x110
 [<ffffffff81092292>] ? finish_task_switch+0x72/0x1d0
 [<ffffffff810b2c51>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
 [<ffffffff8108d44f>] smpboot_thread_fn+0x10f/0x170
 [<ffffffff8108d340>] ? sort_range+0x30/0x30
 [<ffffffff8108a039>] kthread+0xc9/0xe0
 [<ffffffff81089f70>] ? kthread_park+0x60/0x60
 [<ffffffff814d700f>] ret_from_fork+0x3f/0x70
 [<ffffffff81089f70>] ? kthread_park+0x60/0x60

The pending state may last until being suspended, because some IRQs may show no activities after their affinity settings have been changed.

This change don't let ACK and EOI handlers of xen-pirq and xen-dyn chips try to migrate disabled IRQs to avoid the BUG in that situation.

Fixes ff1e22e7a638 ("xen/events: Mask a moving irq")

To: Boris Ostrovsky <[email protected]>
To: David Vrabel <[email protected]>

---
 drivers/xen/events/events_base.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/xen/events/events_base.c +4 -2
index cb7138c..be8410f 100644
@@ -487,7 +487,8 @@ static void eoi_pirq(struct irq_data *data)
 	if (!VALID_EVTCHN(evtchn))
 		return;
 
-	if (unlikely(irqd_is_setaffinity_pending(data))) {
+	if (unlikely(irqd_is_setaffinity_pending(data) &&
+		!irqd_irq_disabled(data))) {
 		int masked = test_and_set_mask(evtchn);
 
 		clear_evtchn(evtchn);
@@ -1370,7 +1371,8 @@ static void ack_dynirq(struct irq_data *data)
 	if (!VALID_EVTCHN(evtchn))
 		return;
 
-	if (unlikely(irqd_is_setaffinity_pending(data))) {
+	if (unlikely(irqd_is_setaffinity_pending(data) &&
+		!irqd_irq_disabled(data))) {
 		int masked = test_and_set_mask(evtchn);
 
 		clear_evtchn(evtchn);
Signature · 1 line
2.7.4
#4 lore raw
In reply to Munehisa Kamata
Quoted 4 lines · Munehisa Kamata

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") introduced a crash below. This can be triggered after being resumed from suspend
(e.g. live migration) if there are disabled IRQs with
IRQD_SETAFFINITY_PENDING set.

A patch just like this has been submitted recently
(http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00956.html)
and should go in soon.

Thanks.
-boris

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
In reply to Boris Ostrovsky

I somehow overlooked the patch. It looks just the same as our change. Thank you for pointing out.

Regards,
Munehisa

Quoted 15 lines · Boris Ostrovsky
Quoted 4 lines · Munehisa Kamata

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") introduced a crash below. This can be triggered after being resumed from suspend
(e.g. live migration) if there are disabled IRQs with
IRQD_SETAFFINITY_PENDING set.

A patch just like this has been submitted recently
(http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00956.html)
and should go in soon.

Thanks.
-boris

#3 lore raw
In reply to Boris Ostrovsky

I somehow overlooked the patch. It looks just the same as our change. Thank you for pointing out.

Regards,
Munehisa

Quoted 6 lines · Boris Ostrovsky
Quoted 4 lines · Munehisa Kamata

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") introduced a crash below. This can be triggered after being resumed from suspend
(e.g. live migration) if there are disabled IRQs with
IRQD_SETAFFINITY_PENDING set.

Quoted 9 lines

A patch just like this has been submitted recently
(http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00956.html)
and should go in soon.

Thanks.
-boris

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel