mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] common: misc: do not run pollers inside panic()
Date: Thu, 20 Jun 2024 14:58:29 +0200	[thread overview]
Message-ID: <20240620125829.550300-1-a.fatoum@pengutronix.de> (raw)

When panic() is not configured to hang, it will wait 100 ms for messages
to go out before trying to poweroff or reset the machine.

The wait is implemented using udelay(), which runs pollers if the delay
duration exceeds 100 us. This is a bad idea as it needlessly exposes
barebox to hang indefinitely if the driver that's being polled had
something to do with why we ended up in the panic in the first place.

Switch to a non_interruptible variant to busy loop without invoking
pollers.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/misc.c b/common/misc.c
index 530f85f6e321..7bc92c0f9518 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -296,7 +296,7 @@ static void __noreturn do_panic(bool stacktrace, const char *fmt, va_list ap)
 	if (IS_ENABLED(CONFIG_PANIC_HANG))
 		hang();
 
-	udelay(100000);	/* allow messages to go out */
+	mdelay_non_interruptible(100);	/* allow messages to go out */
 
 	if (IS_ENABLED(CONFIG_PANIC_POWEROFF))
 		poweroff_machine();
-- 
2.39.2




             reply	other threads:[~2024-06-20 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 12:58 Ahmad Fatoum [this message]
2024-07-01 12:11 ` 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=20240620125829.550300-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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