* [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
* Re: [PATCH master] common: misc: do not run pollers inside panic()
2024-06-20 12:58 [PATCH master] common: misc: do not run pollers inside panic() Ahmad Fatoum
@ 2024-07-01 12:11 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-07-01 12:11 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Thu, 20 Jun 2024 14:58:29 +0200, Ahmad Fatoum wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] common: misc: do not run pollers inside panic()
https://git.pengutronix.de/cgit/barebox/commit/?id=b026cd03f940 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ 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