Re: [PATCH v2 2/5] watchdog: Update saved interrupts during check

From: Petr Mladek

Date: Mon Mar 23 2026 - 13:31:19 EST


On Thu 2026-03-12 16:22:03, Mayank Rungta via B4 Relay wrote:
> From: Mayank Rungta <mrungta@xxxxxxxxxx>
>
> Currently, arch_touch_nmi_watchdog() causes an early return that
> skips updating hrtimer_interrupts_saved. This leads to stale
> comparisons and delayed lockup detection.
>
> I found this issue because in our system the serial console is fairly
> chatty. For example, the 8250 console driver frequently calls
> touch_nmi_watchdog() via console_write(). If a CPU locks up after a
> timer interrupt but before next watchdog check, we see the following
> sequence:
>
> * watchdog_hardlockup_check() saves counter (e.g., 1000)
> * Timer runs and updates the counter (1001)
> * touch_nmi_watchdog() is called
> * CPU locks up
> * 10s pass: check() notices touch, returns early, skips update
> * 10s pass: check() saves counter (1001)
> * 10s pass: check() finally detects lockup
>
> This delays detection to 30 seconds. With this fix, we detect the
> lockup in 20 seconds.
>
> Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Mayank Rungta <mrungta@xxxxxxxxxx>

I agree with Doug's analyze and it looks good to me:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr