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