Skip to contentSkip to conversation

powerpc/64: Don't recurse irq replay

RFC PATCH New Nicholas Piggin 1 participant 1 message Oct 6, 2022 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

RFC PATCH 1/1 powerpc/64: Don't recurse irq replay

Use irq_enter/irq_exit around irq replay to prevent softirqs running while interrupts are being replayed. Instead they run at the irq_exit() call where reentrancy is less problematic. A new PACA_IRQ_REPLAYING is added to prevent interrupt handlers hard-enabling EE while being replayed.
---
I finally might have worked out a way to do this without surgery to other parts of the kernel - use a nested irq_enter around replay, which seems to do the right thing. Almost seems a bit too easy. I think we probably want to do this even though it adds a bit of complexity itself and yet more soft-masking churn. But it is debatable. I will post again with more discussion some tie later probably for next merge window.

Thanks,
Nick

 arch/powerpc/include/asm/hw_irq.h |   6 +-
 arch/powerpc/kernel/irq_64.c      | 101 +++++++++++++++++++-----------
 2 files changed, 70 insertions(+), 37 deletions(-)
arch/powerpc/include/asm/hw_irq.h +4 -2
index 265d0eb7ed79..5ffe5c63dc82 100644
@@ -36,15 +36,17 @@
 #define PACA_IRQ_DEC		0x08 /* Or FIT */
 #define PACA_IRQ_HMI		0x10
 #define PACA_IRQ_PMI		0x20
+#define PACA_IRQ_REPLAYING	0x40
 
 /*
  * Some soft-masked interrupts must be hard masked until they are replayed
  * (e.g., because the soft-masked handler does not clear the exception).
+ * Interrupt replay itself must remain hard masked too.
  */
 #ifdef CONFIG_PPC_BOOK3S
-#define PACA_IRQ_MUST_HARD_MASK	(PACA_IRQ_EE|PACA_IRQ_PMI)
+#define PACA_IRQ_MUST_HARD_MASK	(PACA_IRQ_EE|PACA_IRQ_PMI|PACA_IRQ_REPLAYING)
 #else
-#define PACA_IRQ_MUST_HARD_MASK	(PACA_IRQ_EE)
+#define PACA_IRQ_MUST_HARD_MASK	(PACA_IRQ_EE|PACA_IRQ_REPLAYING)
 #endif
 
 #endif /* CONFIG_PPC64 */
arch/powerpc/kernel/irq_64.c +66 -35

182 lines not on this page · raw message

Signature · 1 line
2.37.2