xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] xen/events: don't migrate disabled IRQs
       [not found] <1463779324-12225-1-git-send-email-kamatam@amazon.com>
@ 2016-05-20 21:32 ` Boris Ostrovsky
       [not found] ` <573F825C.5000401@oracle.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2016-05-20 21:32 UTC (permalink / raw)
  To: Munehisa Kamata, david.vrabel
  Cc: xen-devel, Matt Wilson, linux-kernel, stable

On 05/20/2016 05:22 PM, Munehisa Kamata wrote:
> 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
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xen/events: don't migrate disabled IRQs
       [not found] ` <573F825C.5000401@oracle.com>
@ 2016-05-20 22:13   ` Munehisa Kamata
  0 siblings, 0 replies; 3+ messages in thread
From: Munehisa Kamata @ 2016-05-20 22:13 UTC (permalink / raw)
  To: Boris Ostrovsky, david.vrabel
  Cc: xen-devel, Matt Wilson, linux-kernel, stable

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

Regards,
Munehisa

On 5/20/2016 2:32 PM, Boris Ostrovsky wrote:
> On 05/20/2016 05:22 PM, Munehisa Kamata wrote:
>> 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
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] xen/events: don't migrate disabled IRQs
@ 2016-05-20 21:22 Munehisa Kamata
  0 siblings, 0 replies; 3+ messages in thread
From: Munehisa Kamata @ 2016-05-20 21:22 UTC (permalink / raw)
  To: boris.ostrovsky, david.vrabel
  Cc: xen-devel, Munehisa Kamata, Matt Wilson, linux-kernel, stable

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")
Reported-and-tested-by: Guilherme Wuensch Manika <gmanika@amazon.de>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: Matt Wilson <msw@amazon.com>
Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
---
 drivers/xen/events/events_base.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index cb7138c..be8410f 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -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);
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-20 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1463779324-12225-1-git-send-email-kamatam@amazon.com>
2016-05-20 21:32 ` [PATCH] xen/events: don't migrate disabled IRQs Boris Ostrovsky
     [not found] ` <573F825C.5000401@oracle.com>
2016-05-20 22:13   ` Munehisa Kamata
2016-05-20 21:22 Munehisa Kamata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).