* [PATCH master] common: misc: do not run pollers inside panic()
@ 2024-06-20 12:58 Ahmad Fatoum
2024-07-01 12:11 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-06-20 12:58 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-01 12:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 12:58 [PATCH master] common: misc: do not run pollers inside panic() Ahmad Fatoum
2024-07-01 12:11 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox