From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down
Date: Thu, 19 Nov 2026 17:07:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-223620@kernel.org> (raw)
In-Reply-To: <20261119-watchdog-reboot-keepalive-v1-1-c5902d959796@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] watchdog: core: partial execution of WDIOC_SETTIMEOUT during
shutdown
--
commit aaa4c1cf2a5820b51fb679779e0af90fdf817cba
Author: Arun Iyengar <aiyengar1990@gmail.com>
watchdog: core: Ignore userspace keepalives once the system goes down
This commit makes watchdog_ping() return early without pinging the
watchdog once system_state is past SYSTEM_RUNNING.
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index aad3f1f1b4ce8..0f149da49a694 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;
[Severity: Medium]
Should watchdog_set_timeout() also check system_state > SYSTEM_RUNNING?
In watchdog_ioctl(), WDIOC_SETTIMEOUT runs watchdog_set_timeout() and
then calls watchdog_ping() to apply the new timeout:
drivers/watchdog/watchdog_dev.c:watchdog_ioctl() {
...
case WDIOC_SETTIMEOUT:
...
err = watchdog_set_timeout(wdd, val);
if (err < 0)
break;
/* If the watchdog is active then we send a keepalive ping
* to make sure that the watchdog keep's running (and if
* possible that it takes the new timeout) */
err = watchdog_ping(wdd);
...
}
When system_state > SYSTEM_RUNNING, watchdog_set_timeout() still runs
while watchdog_ping() becomes a no-op. For drivers whose ops->set_timeout
reloads the hardware timer directly (such as sunxi_wdt_set_timeout()) or
that use the keepalive worker updated by watchdog_update_worker(), a
daemon issuing WDIOC_SETTIMEOUT can still reset or extend the countdown
during shutdown. For drivers that rely on the subsequent ping to program
wdd->timeout into hardware and restart pretimeout_timer, wdd->timeout,
wdd->pretimeout, and wd_data->timer are updated out of sync with the
running hardware timer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-watchdog-reboot-keepalive-v1-1-c5902d959796@gmail.com?part=1
next prev parent reply other threads:[~2026-11-19 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:53 [PATCH RFC] watchdog: core: Ignore userspace keepalives once the system goes down Arun Iyengar
2026-11-19 16:53 ` Arun Iyengar via B4 Relay
2026-11-19 17:07 ` sashiko-bot [this message]
2026-11-19 17:10 ` Guenter Roeck
2026-11-20 7:00 ` Arun Iyengar
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=sashiko-outbox-223620@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.