mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mayank Rungta <mrungta@google.com>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	 Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>
Cc: Marc Zyngier <maz@kernel.org>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	 linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-msm@vger.kernel.org,
	"Kirill A . Shutemov" <kas@kernel.org>,
	 Douglas Anderson <dianders@chromium.org>,
	Mayank Rungta <mrungta@google.com>
Subject: [PATCH v4 0/7] watchdog: qcom: Support NMI pretimeout warnings
Date: Wed, 11 Nov 2026 19:16:22 -0800	[thread overview]
Message-ID: <20261112031629.396819-1-mrungta@google.com> (raw)

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@google.com>
---
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@google.com
- Link to v2: https://lore.kernel.org/r/20260828-qcom-wdt-nmi-series-v2-0-363979fe6b6b@google.com
- Link to v1: https://lore.kernel.org/r/20260730-qcom-wdt-nmi-series-v1-0-3aa86d162914@google.com

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


             reply	other threads:[~2026-11-12  3:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  3:16 Mayank Rungta [this message]
2026-11-12  3:16 ` [PATCH v4 1/7] genirq: Synchronize in-flight handlers during NMI teardown Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 2/7] genirq: Allow global interrupts in request_nmi() Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 3/7] genirq: Implement synchronous disable_nmi() Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 4/7] genirq: Export NMI APIs for qcom-wdt Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 5/7] watchdog: pretimeout: Protect governor access with RCU for NMI safety Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 6/7] watchdog: pretimeout_panic: Use nmi_panic() when invoked from NMI context Mayank Rungta
2026-11-12  3:16 ` [PATCH v4 7/7] watchdog: qcom: Register pretimeout interrupt as NMI Mayank Rungta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112031629.396819-1-mrungta@google.com \
    --to=mrungta@google.com \
    --cc=dianders@chromium.org \
    --cc=kas@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=maz@kernel.org \
    --cc=radu@rendec.net \
    --cc=tglx@kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®