mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] watchdog: fix watchdog restart handler when autoping is enabled
Date: Mon, 27 May 2024 11:50:57 +0200	[thread overview]
Message-ID: <20240527095057.3418435-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240527095057.3418435-1-s.hauer@pengutronix.de>

When the watchdog autoping feature is enabled it will ping the watchdog
every 0.5s. This becomes a problem when the fallback restart handler is
called to reset the CPU. It will then set the watchdog to trigger in one
second and waits for CPU reset using mdelay(). During the mdelay() the
autoping poller will continue to feed the watchdog, so we never actually
reset the CPU.

Use mdelay_non_interruptible() instead so that no poller can run in the
background.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/watchdog/wd_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index f39a8f4522..42cbd7b72c 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -178,7 +178,8 @@ static void __noreturn watchdog_restart_handle(struct restart_handler *this)
 		ret = watchdog_set_timeout(wd, 1);
 
 	BUG_ON(ret);
-	mdelay(2000);
+
+	mdelay_non_interruptible(2000);
 
 	pr_emerg("Watchdog failed to reset the machine\n");
 	hang();
-- 
2.39.2




  reply	other threads:[~2024-05-27  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27  9:50 [PATCH 1/2] watchdog: dw_wdt: do not register restart handler Sascha Hauer
2024-05-27  9:50 ` Sascha Hauer [this message]
2024-05-28  8:58 ` Sascha Hauer

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=20240527095057.3418435-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox