Skip to content

firmware: arm_sdei: Fix NMI backtrace lockups on idle CPUs

Kiryl Shutsemau (Meta) linux-arm-kernel lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2firmware: arm_sdei: Do not signal event 0 to a masked PEdrivers/firmware/arm_sdei.c drivers/firmware/arm_sdei_nmi.c include/linux/arm_sdei.h+131 -122 replies
2/2firmware: arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI maskedarch/arm64/include/asm/nmi.h arch/arm64/kernel/smp.c drivers/firmware/arm_sdei_nmi.c+26 -41 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchJinjie RuanYin Fengwei
SeriesT-b
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] firmware: arm_sdei: Fix NMI backtrace lockups on idle CPUs

The SDEI NMI backtrace signals event 0 to every other CPU, including the ones in a power-down idle state, where the kernel has SDEI masked. TF-A acknowledges the SGI behind event 0 on a masked PE and never ends it, and the PE takes no Non-secure interrupt again. Jinjie hit it on a 384-CPU HIP12, where one sysrq-l locked up the machine.

Patch 1 keeps event 0 away from masked PEs. Patch 2 sends the regular backtrace IPI to the CPUs that SDEI refused, which wakes them.

TF-A v2.13 and later refuse to signal a masked PE, but a PE that masks right after the check still takes the SGI. The TF-A fix is under review:

https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55414

Tested under QEMU TCG with TF-A built without that check, 4 CPUs. One CPU masks and unmasks SDEI in a loop, through cpu_pm, the mask calls and CPU hotplug, while another signals it; sysrq-l afterwards. Signalling with plain SMCs, as the kernel does now, wedges the target. With the series every run passed, lockdep included, and a panic in the middle of it completes.

Jinjie ran an earlier version on HIP12 with the power-down state
enabled: sysrq-l got 384/384 answers every run. The handshake has changed since; Jinjie, could you give this one a run as well?

Kiryl Shutsemau (Meta) (2):
firmware: arm_sdei: Do not signal event 0 to a masked PE
firmware: arm_sdei_nmi: Send the backtrace IPI to CPUs with SDEI
masked

 arch/arm64/include/asm/nmi.h    |   7 ++
 arch/arm64/kernel/smp.c         |   2 +-
 drivers/firmware/arm_sdei.c     | 130 ++++++++++++++++++++++++++++++--
 drivers/firmware/arm_sdei_nmi.c |  30 ++++++--
 include/linux/arm_sdei.h        |   4 +-
 5 files changed, 157 insertions(+), 16 deletions(-)

base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f

Signature · 1 line
2.54.0