[SRU][bionic][PATCH 4/5] powerpc/powernv: Fix opal_event_shutdown() called with interrupts disabled
Kamal Mostafa
kamal at canonical.com
Wed Sep 5 16:07:51 UTC 2018
On Wed, Sep 5, 2018 at 9:00 AM Colin Ian King <colin.king at canonical.com>
wrote:
> On 05/09/18 16:48, Kamal Mostafa wrote:
> > From: Nicholas Piggin <npiggin at gmail.com>
> >
> > BugLink: http://bugs.launchpad.net/bugs/1790636
> >
> > A kernel crash in process context that calls emergency_restart from
> > panic will end up calling opal_event_shutdown with interrupts disabled
> > but not in interrupt. This causes a sleeping function to be called
> > which gives the following warning with sysrq+c:
> >
> > Rebooting in 10 seconds..
> > BUG: sleeping function called from invalid context at
> kernel/locking/mutex.c:238
> > in_atomic(): 0, irqs_disabled(): 1, pid: 7669, name: bash
> > CPU: 20 PID: 7669 Comm: bash Tainted: G D W 4.17.0-rc5+
> #3
> > Call Trace:
> > dump_stack+0xb0/0xf4 (unreliable)
> > ___might_sleep+0x174/0x1a0
> > mutex_lock+0x38/0xb0
> > __free_irq+0x68/0x460
> > free_irq+0x70/0xc0
> > opal_event_shutdown+0xb4/0xf0
> > opal_shutdown+0x24/0xa0
> > pnv_shutdown+0x28/0x40
> > machine_shutdown+0x44/0x60
> > machine_restart+0x28/0x80
> > emergency_restart+0x30/0x50
> > panic+0x2a0/0x328
> > oops_end+0x1ec/0x1f0
> > bad_page_fault+0xe8/0x154
> > handle_page_fault+0x34/0x38
> > --- interrupt: 300 at sysrq_handle_crash+0x44/0x60
> > LR = __handle_sysrq+0xfc/0x260
> > flag_spec.62335+0x12b844/0x1e8db4 (unreliable)
> > __handle_sysrq+0xfc/0x260
> > write_sysrq_trigger+0xa8/0xb0
> > proc_reg_write+0xac/0x110
> > __vfs_write+0x6c/0x240
> > vfs_write+0xd0/0x240
> > ksys_write+0x6c/0x110
> >
> > Fixes: 9f0fd0499d30 ("powerpc/powernv: Add a virtual irqchip for opal
> events")
> > Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> > Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> > Signed-off-by: Kamal Mostafa <kamal at canonical.com>
> > (cherry picked from commit 8bf84f005346fd0ecfa595c2d497b19a6e291b4e)
> > Signed-off-by: Kamal Mostafa <kamal at canonical.com>
>
>
> I can't find 8bf84f005346fd0ecfa595c2d497b19a6e291b4e in linux or
> linux-next. Where does it come from?
>
>
Ooops, that needs to be corrected, to:
(cherry picked from commit c0beffc4f4c658fde86d52c837e784326e9cc875)
-Kamal
> > ---
> > arch/powerpc/platforms/powernv/opal-irqchip.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/opal-irqchip.c
> b/arch/powerpc/platforms/powernv/opal-irqchip.c
> > index 9d1b8c0..05ffe05 100644
> > --- a/arch/powerpc/platforms/powernv/opal-irqchip.c
> > +++ b/arch/powerpc/platforms/powernv/opal-irqchip.c
> > @@ -177,7 +177,7 @@ void opal_event_shutdown(void)
> > if (!opal_irqs[i])
> > continue;
> >
> > - if (in_interrupt())
> > + if (in_interrupt() || irqs_disabled())
> > disable_irq_nosync(opal_irqs[i]);
> > else
> > free_irq(opal_irqs[i], NULL);
> >
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20180905/d163e03c/attachment.html>
More information about the kernel-team
mailing list