[PATCH 13/17] arm64/entry: Don't call preempt_schedule_irq() with NMIs masked
From: Jinjie Ruan
Date: Fri Jul 03 2026 - 06:09:02 EST
From: Mark Brown <broonie@xxxxxxxxxx>
As we do for pseudo NMIs don't call preempt_schedule_irq()
when architechted NMIs are masked. If they are masked then we are
calling from a preempting context so skip preemption.
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
---
arch/arm64/include/asm/entry-common.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/include/asm/entry-common.h b/arch/arm64/include/asm/entry-common.h
index 3d8b38ce7afb..4efcc7cfdd9b 100644
--- a/arch/arm64/include/asm/entry-common.h
+++ b/arch/arm64/include/asm/entry-common.h
@@ -29,6 +29,15 @@ static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
static inline bool arch_irqentry_exit_need_resched(void)
{
+ /*
+ * Architected NMIs are unmasked prior to handling regular
+ * IRQs and masked while handling FIQs. If ALLINT is set then
+ * we are in a NMI or other preempting context so skip
+ * preemption.
+ */
+ if (system_uses_nmi() && (read_sysreg_s(SYS_ALLINT) & ALLINT_ALLINT))
+ return false;
+
/*
* DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC
* priority masking is used the GIC irqchip driver will clear DAIF.IF
--
2.34.1