Re: [PATCH v4 6/7] watchdog: pretimeout_panic: Use nmi_panic() when invoked from NMI context
From: Guenter Roeck
Date: Sun Nov 15 2026 - 17:52:35 EST
On Wed, Nov 11, 2026 at 07:16:28PM -0800, Mayank Rungta wrote:
> When a watchdog pretimeout interrupt is registered as an NMI (or
> pseudo-NMI), pretimeout_panic() executes in NMI context. Calling plain
> panic() from NMI context is unsafe if the current CPU was already inside
> vpanic() with regular interrupts disabled (where the watchdog is no
> longer fed): vpanic() assumes panic_cpu == raw_smp_processor_id() only
> occurs when entered via nmi_panic(), so it falls through into a
> recursive panic on the same CPU, corrupting the static panic buffer,
> panic notifiers, and crash dump state.
>
> Invoke nmi_panic() when in_nmi() is true so that an NMI interrupting a
> CPU that is already panicking safely returns, or stops via
> nmi_panic_self_stop() if another CPU is panicking.
>
> Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>
Similar to the previous patch, this patch is independent of the rest
of the series. Applied to watchdog-next.
Thanks,
Guenter