Skip to content

Commit ff058a8

Browse files
npigginmpe
authored andcommitted
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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d0afd44 commit ff058a8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/powerpc/kernel/irq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ notrace void arch_local_irq_restore(unsigned long mask)
229229
return;
230230
}
231231

232+
if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
233+
WARN_ON_ONCE(in_nmi() || in_hardirq());
234+
232235
/*
233236
* After the stb, interrupts are unmasked and there are no interrupts
234237
* pending replay. The restart sequence makes this atomic with
@@ -321,6 +324,9 @@ notrace void arch_local_irq_restore(unsigned long mask)
321324
if (mask)
322325
return;
323326

327+
if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
328+
WARN_ON_ONCE(in_nmi() || in_hardirq());
329+
324330
/*
325331
* From this point onward, we can take interrupts, preempt,
326332
* etc... unless we got hard-disabled. We check if an event

0 commit comments

Comments
 (0)