powerpc/64: Don't recurse irq replay
authorNicholas Piggin <npiggin@gmail.com>
Sat, 21 Jan 2023 10:26:18 +0000 (20:26 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 30 Jan 2023 07:21:41 +0000 (18:21 +1100)
commit5746ca131e2496ccd5bb4d7a0244d6c38070cbf5
tree699dfb821e1fea36ec6e71076755a9b81ba0c779
parentbab537805a10bdbf55b31324ba4a9599e0651e5e
powerpc/64: Don't recurse irq replay

Interrupt handlers called by soft-pending irq replay code can run
softirqs, softirq replay enables and disables local irqs, which allows
interrupts to come in including soft-masked interrupts, and it can
cause pending irqs to be replayed again. That makes the soft irq replay
state machine and possible races more complicated and fragile than it
needs to be.

Use irq_enter/irq_exit around irq replay to prevent softirqs running
while interrupts are being replayed. Softirqs will now be run at the
irq_exit() call after all the irq replaying is done. This prevents irqs
being replayed while irqs are being replayed, and should hopefully make
things simpler and easier to think about and debug.

A new PACA_IRQ_REPLAYING is added to prevent asynchronous interrupt
handlers hard-enabling EE while pending irqs are being replayed, because
that causes new pending irqs to arrive which is also a complexity. This
means pending irqs won't be profiled quite so well because perf irqs
can't be taken.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230121102618.2824429-1-npiggin@gmail.com
arch/powerpc/include/asm/hw_irq.h
arch/powerpc/kernel/irq_64.c