* [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down
@ 2026-11-19 16:53 Arun Iyengar via B4 Relay
2026-11-19 17:10 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-19 16:53 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck
Cc: linux-watchdog, linux-kernel, Primoz Fiser, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
A watchdog left running through a reboot should reset a system whose
reboot hangs. But a daemon still pinging after reboot(2), such as
systemd after "systemctl reboot -ff", keeps a hang in device_shutdown()
from ever being reset.
Ignore userspace keepalives once system_state is past SYSTEM_RUNNING,
as da9062_wdt and da9063_wdt do since commit 2f61b3a74699 ("watchdog:
da9062: da9063: prevent pings ahead of machine reset").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
RFC: this changes every driver. A reboot or power-off whose
device_shutdown() outlasts the timeout now ends in a watchdog reset.
Tested on an Orange Pi Zero2 (H616, sunxi_wdt) on 7.3.5 with a test
module that oopses holding a device lock: "systemctl reboot -ff" was
reset after 14 s in 6 of 6 runs. Without the patch there was no reset
within 90 s (one run, older 7.3 build). Other drivers and kexec are
not tested.
Developed with Claude (Anthropic) as a coding assistant, which wrote
the code and the commit message. I reviewed and tested it.
---
drivers/watchdog/watchdog_dev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index aad3f1f1b4ce..0f149da49a69 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -201,6 +201,9 @@ static int watchdog_ping(struct watchdog_device *wdd)
if (!watchdog_hw_running(wdd))
return 0;
+ if (system_state > SYSTEM_RUNNING)
+ return 0;
+
set_bit(_WDOG_KEEPALIVE, &wd_data->status);
wd_data->last_keepalive = ktime_get();
---
base-commit: 865c2d0f1dd3f0937865dd11819eeb59298a814c
change-id: 20261119-watchdog-reboot-keepalive-fd50f4b828f2
Best regards,
--
Arun Iyengar <aiyengar1990@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down
2026-11-19 16:53 [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down Arun Iyengar via B4 Relay
@ 2026-11-19 17:10 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-11-19 17:10 UTC (permalink / raw)
To: aiyengar1990, Wim Van Sebroeck; +Cc: linux-watchdog, linux-kernel, Primoz Fiser
On 11/19/26 08:53, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> A watchdog left running through a reboot should reset a system whose
> reboot hangs. But a daemon still pinging after reboot(2), such as
> systemd after "systemctl reboot -ff", keeps a hang in device_shutdown()
> from ever being reset.
>
If systemd is still running and able to send watchdog pings, the system
is not really hanging.
> Ignore userspace keepalives once system_state is past SYSTEM_RUNNING,
> as da9062_wdt and da9063_wdt do since commit 2f61b3a74699 ("watchdog:
> da9062: da9063: prevent pings ahead of machine reset").
>
Those drivers have a very specific reason to stop pings during poweroff,
because not doing so could result in failed restart / poweroff sequences
(as the commit message explains).
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> RFC: this changes every driver. A reboot or power-off whose
> device_shutdown() outlasts the timeout now ends in a watchdog reset.
>
Which would be unacceptable.
I don't know what problem you are actually trying to solve, but in
its current form this is a NACK.
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-19 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 16:53 [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down Arun Iyengar via B4 Relay
2026-11-19 17:10 ` Guenter Roeck
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®