diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2021-10-05 00:56:40 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-10-07 19:54:55 +1100 |
commit | ff058a8ada5df0d84e5537cfaf89d06d71501580 (patch) | |
tree | 62421c0d3d106968f2bebe26ecf7490cb1362bbe /arch | |
parent | d0afd44c05f8f4e4c91487c02d43c87a31552462 (diff) | |
download | linux-stable-ff058a8ada5df0d84e5537cfaf89d06d71501580.tar.gz linux-stable-ff058a8ada5df0d84e5537cfaf89d06d71501580.tar.bz2 linux-stable-ff058a8ada5df0d84e5537cfaf89d06d71501580.zip |
powerpc/64: warn if local irqs are enabled in NMI or hardirq context
This can help catch bugs such as the one fixed by the previous change
to prevent _exception() from enabling irqs.
ppc32 could have a similar warning but it has no good config option to
debug this stuff (the test may be overkill to add for production
kernels).
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211004145642.1331214-4-npiggin@gmail.com
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 551b653228c4..c4f1d6b7d992 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -229,6 +229,9 @@ notrace void arch_local_irq_restore(unsigned long mask) return; } + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) + WARN_ON_ONCE(in_nmi() || in_hardirq()); + /* * After the stb, interrupts are unmasked and there are no interrupts * pending replay. The restart sequence makes this atomic with @@ -321,6 +324,9 @@ notrace void arch_local_irq_restore(unsigned long mask) if (mask) return; + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) + WARN_ON_ONCE(in_nmi() || in_hardirq()); + /* * From this point onward, we can take interrupts, preempt, * etc... unless we got hard-disabled. We check if an event |