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

authored by Nicholas Piggin and committed by Michael Ellerman ff058a8a d0afd44c

+6
+6
arch/powerpc/kernel/irq.c
··· 229 229 return; 230 230 } 231 231 232 + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) 233 + WARN_ON_ONCE(in_nmi() || in_hardirq()); 234 + 232 235 /* 233 236 * After the stb, interrupts are unmasked and there are no interrupts 234 237 * pending replay. The restart sequence makes this atomic with ··· 323 320 irq_soft_mask_set(mask); 324 321 if (mask) 325 322 return; 323 + 324 + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) 325 + WARN_ON_ONCE(in_nmi() || in_hardirq()); 326 326 327 327 /* 328 328 * From this point onward, we can take interrupts, preempt,