[PATCH master] common: misc: do not run pollers inside panic()

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jun 20 05:58:29 PDT 2024


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 at 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




More information about the barebox mailing list