All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrew Gaylard" <ag@ffroot.co.za>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: sunplus: fix sp_wdt_restart spin loop and timeout
Date: Thu, 20 Aug 2026 13:06:26 +0000	[thread overview]
Message-ID: <20260820130626.DD7101F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820125304.1583383-1-ag@ffroot.co.za>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The infinite loop in the restart handler permanently deadlocks the restart notifier chain upon failure, preventing fallback reboot mechanisms, and introduces unreachable dead code.
--

--- Patch [1]: [PATCH] watchdog: sunplus: fix sp_wdt_restart spin loop and timeout ---
commit a82fb222c63d9d961d7ca0c200d75e43dd479310
Author: Andrew Gaylard <ag@ffroot.co.za>
watchdog: sunplus: fix sp_wdt_restart spin loop and timeout

This commit increases the watchdog restart timeout to ~1.5s and introduces a
spin loop in sp_wdt_restart() to prevent other CPUs from petting the watchdog
before the system resets.

> diff --git a/drivers/watchdog/sunplus_wdt.c b/drivers/watchdog/sunplus_wdt.c
> --- a/drivers/watchdog/sunplus_wdt.c
> +++ b/drivers/watchdog/sunplus_wdt.c
> @@ -56,10 +56,16 @@ static int sp_wdt_restart(struct watchdog_device *wdev,

[ ... ]

>  	writel(WDT_LOCK, base + WDT_CTRL);
>  	writel(WDT_RESUME, base + WDT_CTRL);
>  
> +	/* Spin until the watchdog resets us. This prevents any other CPU
> +	 * from petting the watchdog.
> +	 */
> +	while (1)
> +		cpu_relax();
> +

[Severity: High]
If the watchdog hardware fails to reset the system, does this infinite loop
permanently deadlock the atomic notifier chain and prevent machine_restart()
from falling back to other registered restart mechanisms like PSCI?

Since machine_restart() explicitly disables local interrupts and halts all
secondary CPUs via smp_send_stop() before executing restart handlers, is the
concern about concurrent petting from other CPUs applicable here?

Also, does this infinite loop leave the subsequent return statement as
unreachable dead code?

>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820125304.1583383-1-ag@ffroot.co.za?part=1

  reply	other threads:[~2026-08-20 13:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 12:53 [PATCH] watchdog: sunplus: fix sp_wdt_restart spin loop and timeout Andrew Gaylard
2026-08-20 13:06 ` sashiko-bot [this message]
2026-08-20 13:42 ` Guenter Roeck
2026-08-20 15:12   ` Andrew Gaylard
2026-08-20 16:05     ` Guenter Roeck

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=20260820130626.DD7101F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ag@ffroot.co.za \
    --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.