All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Menzel" <pmenzel@molgen.mpg.de>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: intel_oc_wdt: Stop the watchdog during system sleep
Date: Thu, 19 Nov 2026 21:16:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-224085@kernel.org> (raw)
In-Reply-To: <20261119210358.610521-1-pmenzel@molgen.mpg.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] watchdog: intel_oc_wdt: timeout not restored in
  intel_oc_wdt_resume_noirq()
--

commit 4da4626fae8bd66b23127eb234a7132f8de0ce8a
Author: Paul Menzel <pmenzel@molgen.mpg.de>

watchdog: intel_oc_wdt: Stop the watchdog during system sleep

This commit adds noirq suspend and resume callbacks to stop the Intel OC
watchdog during system sleep and restart it on resume.

> diff --git a/drivers/watchdog/intel_oc_wdt.c b/drivers/watchdog/intel_oc_wdt.c
> index a78fe1e5f410b..6e32536fae4b9 100644
> --- a/drivers/watchdog/intel_oc_wdt.c
> +++ b/drivers/watchdog/intel_oc_wdt.c
[ ... ]
> @@ -212,6 +214,45 @@ static int intel_oc_wdt_probe(struct platform_device *pdev)
>  	return devm_watchdog_register_device(dev, wdd);
>  }
>  
> +/*
> + * Neither user space nor the watchdog core can ping the watchdog while the
> + * system sleeps, and in suspend-to-idle the counter keeps running, so stop the
> + * watchdog late in suspend and restart it early in resume. Check the hardware
> + * enable bit, as the watchdog may also have been started by the firmware.
> + */
> +static int intel_oc_wdt_suspend_noirq(struct device *dev)
> +{
> +	struct intel_oc_wdt *oc_wdt = dev_get_drvdata(dev);
> +
> +	oc_wdt->suspended = false;
> +
> +	if (oc_wdt->locked ||
> +	    !(inl(INTEL_OC_WDT_CTRL_REG(oc_wdt)) & INTEL_OC_WDT_EN))
> +		return 0;
> +
> +	intel_oc_wdt_stop(&oc_wdt->wdd);
> +	oc_wdt->suspended = true;
> +
> +	return 0;
> +}
> +
> +static int intel_oc_wdt_resume_noirq(struct device *dev)
> +{
> +	struct intel_oc_wdt *oc_wdt = dev_get_drvdata(dev);
> +
> +	if (!oc_wdt->suspended)
> +		return 0;
> +
> +	intel_oc_wdt_start(&oc_wdt->wdd);
> +	intel_oc_wdt_ping(&oc_wdt->wdd);
> +	oc_wdt->suspended = false;
> +
> +	return 0;
> +}

[Severity: Medium]
Should intel_oc_wdt_resume_noirq() also restore INTEL_OC_WDT_TOV via
intel_oc_wdt_set_timeout(&oc_wdt->wdd, oc_wdt->wdd.timeout)?

Across hibernation (or S3 if platform firmware resets the control
register), the hardware register loses any runtime timeout set via
WDIOC_SETTIMEOUT and reverts to the boot or probe default
(INTEL_OC_WDT_DEF_TOV, 60 seconds).  Because intel_oc_wdt_start() only
sets INTEL_OC_WDT_EN and intel_oc_wdt_ping() reloads from the current
INTEL_OC_WDT_TOV field, a userspace daemon configured with a longer
timeout and a matching ping interval can hit an unexpected watchdog reset
after resume.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119210358.610521-1-pmenzel@molgen.mpg.de?part=1

      reply	other threads:[~2026-11-19 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:03 [PATCH] watchdog: intel_oc_wdt: Stop the watchdog during system sleep Paul Menzel
2026-11-19 21:16 ` sashiko-bot [this message]

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-224085@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    --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.