[PATCH v2 00/39] arm64: Add support for FEAT_NMI
Kiryl Shutsemau (Meta)
kas at kernel.org
Thu Nov 19 08:07:19 PST 2026
On Thu, Nov 19, 2026 at 02:50:50PM +0000, Vladimir Murzin wrote:
> Any chance you can attach debugger or collect traces so we know what those
> CPUs are doing?
I think they are idle with SDEI masked when the broadcast lands, and
the firmware leaves them unable to take interrupts.
A CPU entering a power-down idle state masks SDEI from the cpu_pm
notifier. If event 0 lands on it while it is masked, TF-A's
handle_masked_trigger() returns for event 0 without EOI:
CPU A CPU B (power-down idle)
cpu_pm_enter()
sdei_mask_local_cpu()
sdei_nmi_raise_backtrace()
SDEI_EVENT_SIGNAL(0, CPU B)
EL3: sdei_intr_handler()
acknowledge the SGI
handle_masked_trigger()
// event 0: return, no EOI
cpu_pm_exit()
sdei_unmask_local_cpu()
The SGI stays active, so CPU B runs at the SDEI priority from then on:
no Non-secure interrupts and no more event 0. Other CPUs then hang in
csd_lock_wait() on their next synchronous cross-call to it.
I reproduced it on QEMU with TF-A v2.15 minus the check described below.
After event 0 lands on a masked CPU, ICC_RPR_EL1 there reads 0 and stays
0 after SDEI_PE_UNMASK, and RCU reports "1-...!: ... idle=c078/0/0x0 ...
(false positive?)" as in Jinjie's rc3 log. With an EOI added on that
path, the same test passes.
That path has been in TF-A since the SDEI dispatcher was added and is
still in master. TF-A v2.13 made SDEI_EVENT_SIGNAL refuse a masked
target, which leaves only a race with a target that masks after the
check.
A fix is under review:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414
Jinjie, what is your firmware based on?
Two checks would confirm it:
- does dmesg show "SDEI_EVENT_SIGNAL to CPU N failed" after the
sysrq-l? None means the firmware accepted the signals to masked
CPUs;
- does the broadcast work with cpuidle.off=1? Without power-down idle
nothing masks SDEI, so all CPUs should answer.
Ways out I see:
- Firmware: end the interrupt on that path, or keep event 0 pending
until unmask as 55414 does. That is the real fix, but deployed
firmware will not have it for a while.
- Kernel: never signal a CPU that has SDEI masked. The signalling CPU
and the cpu_pm notifier can handshake: the sender marks the target
and IPIs it instead if it is already masked, and the notifier
refuses the power-down state while a signal is in flight. SDEI keeps
serving every running CPU, and the race goes away whatever the
firmware does. It needs a hook in arm_sdei.c.
- Kernel: send the IPI first and SDEI only to the CPUs that do not
answer, as smp_send_stop() does. Simple, but then SDEI runs only
when a CPU is really stuck, and a problem like this one stays hidden
until the day it is needed.
- Kernel: use the NMI IPI when there is one, as you suggested. That
takes SDEI out of the picture where FEAT_NMI or pseudo-NMI is in use,
but not on machines without them, which are the ones SDEI is for.
- A switch to turn SDEI NMI off, like Jinjie's patch, as an escape
hatch whichever way this goes.
Any comments?
--
Kiryl Shutsemau / Kirill A. Shutemov
More information about the linux-arm-kernel
mailing list