Re: [PATCH v2 4/5] watchdog: pretimeout: Protect governor access with RCU for NMI safety
From: Doug Anderson
Date: Mon Aug 31 2026 - 19:02:16 EST
Hi,
On Fri, Aug 28, 2026 at 6:00 PM Mayank Rungta <mrungta@xxxxxxxxxx> wrote:
>
> When watchdog pretimeout interrupts are configured as NMIs (or
> pseudo-NMIs), pretimeout handlers execute in NMI context. Accessing
> the watchdog governor via spinlocks in watchdog_notify_pretimeout() is
> unsafe in NMI context and can cause deadlocks if an NMI arrives while a
> spinlock is held.
>
> Protect governor assignment and dereference with RCU instead of
> spinlocks, allowing lockless, NMI-safe governor notifications while
> preserving safe runtime governor switching.
>
> Assisted-by: Antigravity:gemini
> Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>
> ---
> drivers/watchdog/watchdog_pretimeout.c | 45 +++++++++++++++++++---------------
> include/linux/watchdog.h | 2 +-
> 2 files changed, 26 insertions(+), 21 deletions(-)
Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>