[PATCH v4 0/7] watchdog: qcom: Support NMI pretimeout warnings
From: Mayank Rungta
Date: Wed Nov 11 2026 - 22:22:45 EST
On ARM64 Qualcomm SoCs, when a system freezes completely due to hard
locked CPUs with standard interrupts disabled, a standard watchdog
pretimeout warning interrupt (bark) fails to fire. To diagnose total
system lockups, we need to transition the Qualcomm hardware watchdog
pretimeout bark interrupt into an NMI (or pseudo-NMI).
Enabling NMI pretimeout handlers within a loadable driver module requires
addressing NMI teardown synchronization, allowing global interrupts in
request_nmi(), exporting NMI registration APIs, and ensuring watchdog
pretimeout governor dispatch is NMI-safe.
This 7-patch series achieves NMI pretimeout enablement for qcom-wdt:
1) Synchronizes in-flight NMI handlers during disable and teardown via
an atomic counter on struct irq_desc and unlazy hardware masking.
2) Allows global interrupts in request_nmi() and updates /proc/interrupts
to display per-CPU counts for all NMIs.
3) Implements synchronous disable_nmi().
4) Exports request_nmi(), free_nmi(), enable_nmi(), and disable_nmi()
to the qcom-wdt module using EXPORT_SYMBOL_FOR_MODULES().
5) Replaces spinlocks in watchdog_notify_pretimeout() with RCU to
guarantee safe governor execution from NMI context.
6) Updates the panic pretimeout governor (pretimeout_panic) to call
nmi_panic() when invoked from NMI context.
7) Updates qcom-wdt to request its pretimeout bark interrupt as an
NMI (or pseudo-NMI) with fallback to standard IRQ.
Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>
---
Changes in v4:
- Replaced hardware-only NMI synchronization with a lockless software counter
(desc->nmi_active) and unlazy hardware masking via __synchronize_nmi()
(Patches 1 & 3) (Thomas Gleixner, Marc Zyngier, Douglas Anderson).
- Allowed global interrupts in request_nmi() by dropping the mandatory
IRQF_PERCPU check and updating /proc/interrupts for NMIs (Patches 2 & 7)
(Thomas Gleixner, Marc Zyngier).
- Switched NMI symbol exports to EXPORT_SYMBOL_FOR_MODULES(..., "qcom-wdt")
(Patch 4) (Thomas Gleixner).
- Added Patch 6 to invoke nmi_panic() from pretimeout_panic() when in_nmi()
is true.
- Link to v3: https://lore.kernel.org/r/20260902-qcom-wdt-nmi-series-v3-0-f3999362a9ea@xxxxxxxxxx
- Link to v2: https://lore.kernel.org/r/20260828-qcom-wdt-nmi-series-v2-0-363979fe6b6b@xxxxxxxxxx
- Link to v1: https://lore.kernel.org/r/20260730-qcom-wdt-nmi-series-v1-0-3aa86d162914@xxxxxxxxxx
Testing & Verification:
- Tested on ARM64 Qualcomm Snapdragon SoC (Google CoachZ) with GICv3
pseudo-NMI enabled: verified NMI pretimeout bark delivery, /proc/interrupts
accounting, runtime sysfs governor switching (noop/panic), nmi_panic()
execution, and driver unbind/rebind teardown.
Mayank Rungta (7):
genirq: Synchronize in-flight handlers during NMI teardown
genirq: Allow global interrupts in request_nmi()
genirq: Implement synchronous disable_nmi()
genirq: Export NMI APIs for qcom-wdt
watchdog: pretimeout: Protect governor access with RCU for NMI safety
watchdog: pretimeout_panic: Use nmi_panic() when invoked from NMI
context
watchdog: qcom: Register pretimeout interrupt as NMI
drivers/watchdog/pretimeout_panic.c | 8 +-
drivers/watchdog/qcom-wdt.c | 30 ++++-
drivers/watchdog/watchdog_pretimeout.c | 45 ++++----
include/linux/interrupt.h | 1 +
include/linux/irqdesc.h | 4 +
include/linux/watchdog.h | 2 +-
kernel/irq/chip.c | 35 ++++--
kernel/irq/manage.c | 148 +++++++++++++++++++++----
kernel/irq/proc.c | 6 +-
kernel/irq/settings.h | 5 +
10 files changed, 225 insertions(+), 59 deletions(-)
base-commit: 2a500a04d6f969318c05f46aedb6e73fc1963a00
--
2.56.0.611.g1030f0b940-goog