From: Balbir Singh <bsingharora@gmail.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, rlippert@google.com, anton@samba.org
Subject: Re: [PATCH] powerpc/powernv: Make opal_event_shutdown() callable from IRQ context
Date: Fri, 29 Sep 2017 15:24:59 +1000 [thread overview]
Message-ID: <20170929152459.78d35002@gmail.com> (raw)
In-Reply-To: <1506657482-25196-1-git-send-email-mpe@ellerman.id.au>
On Fri, 29 Sep 2017 13:58:02 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:
> In opal_event_shutdown() we free all the IRQs hanging off the
> opal_event_irqchip. However it's not safe to do so if we're called
> from IRQ context, because free_irq() wants to synchronise versus IRQ
> context. This can lead to warnings and a stuck system.
>
> For example from sysrq-b:
>
> Trying to free IRQ 17 from IRQ context!
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 0 at kernel/irq/manage.c:1461 __free_irq+0x398/0x8d0
> ...
> NIP __free_irq+0x398/0x8d0
> LR __free_irq+0x394/0x8d0
> Call Trace:
> __free_irq+0x394/0x8d0 (unreliable)
> free_irq+0xa4/0x140
> opal_event_shutdown+0x128/0x180
> opal_shutdown+0x1c/0xb0
> pnv_shutdown+0x20/0x40
> machine_restart+0x38/0x90
> emergency_restart+0x28/0x40
> sysrq_handle_reboot+0x24/0x40
> __handle_sysrq+0x198/0x590
> hvc_poll+0x48c/0x8c0
> hvc_handle_interrupt+0x1c/0x50
> __handle_irq_event_percpu+0xe8/0x6e0
> handle_irq_event_percpu+0x34/0xe0
> handle_irq_event+0xc4/0x210
> handle_level_irq+0x250/0x770
> generic_handle_irq+0x5c/0xa0
> opal_handle_events+0x11c/0x240
> opal_interrupt+0x38/0x50
> __handle_irq_event_percpu+0xe8/0x6e0
> handle_irq_event_percpu+0x34/0xe0
> handle_irq_event+0xc4/0x210
> handle_fasteoi_irq+0x174/0xa10
> generic_handle_irq+0x5c/0xa0
> __do_irq+0xbc/0x4e0
> call_do_irq+0x14/0x24
> do_IRQ+0x18c/0x540
> hardware_interrupt_common+0x158/0x180
>
> We can avoid that by using disable_irq_nosync() rather than
> free_irq(). Although it doesn't fully free the IRQ, it should be
> sufficient when we're shutting down, particularly in an emergency.
>
> Add an in_interrupt() check and use free_irq() when we're shutting
> down normally. It's probably OK to use disable_irq_nosync() in that
> case too, but for now it's safer to leave that behaviour as-is.
>
> Fixes: 9f0fd0499d30 ("powerpc/powernv: Add a virtual irqchip for opal events")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
Acked-by: Balbir Singh <bsingharora@gmail.com>
next prev parent reply other threads:[~2017-09-29 5:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 3:58 [PATCH] powerpc/powernv: Make opal_event_shutdown() callable from IRQ context Michael Ellerman
2017-09-29 5:24 ` Balbir Singh [this message]
2017-10-08 8:43 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170929152459.78d35002@gmail.com \
--to=bsingharora@gmail.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=rlippert@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).