[PATCH v2025.09.y 20/49] poller: activate POLLER_WARN_OVERTIME only on third strike

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Dec 19 01:20:56 PST 2025


This warning was meant to address the case that a poller repeatedly
takes too long that interactive usage is impacted.

I frequently see this warning during initial USB gadget set up and that
is not really useful to show every user and developers can use the
poller command, so let's wait until we are on our third (2nd when
counting from 0) overtime to print the one time warning.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Link: https://lore.barebox.org/20251112151058.540654-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
(cherry picked from commit 3c54bb21e0f04805e7b6fb16e6d977900ebfceb0)
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/Kconfig  | 2 +-
 common/poller.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index eb2fb1da1e09..3a2044585a3d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1099,7 +1099,7 @@ config POLLER_WARN_OVERTIME
 	help
 	  Pollers are meant to poll and quickly execute actions.
 	  exceeding the maximum runtime of POLLER_MAX_RUNTIME_MS
-	  will trigger a one-time warning.
+	  three times will trigger a one-time warning.
 
 config BTHREAD
 	bool "barebox co-operative (green) thread infrastructure"
diff --git a/common/poller.c b/common/poller.c
index 5dc2be97211d..ca0d68d6cb27 100644
--- a/common/poller.c
+++ b/common/poller.c
@@ -135,8 +135,8 @@ void poller_call(void)
 		duration_ms = ktime_ms_delta(ktime_get(), start);
 		if (duration_ms > POLLER_MAX_RUNTIME_MS) {
 			if (IS_ENABLED(CONFIG_POLLER_WARN_OVERTIME) &&
-			    !poller->overtime)
-				pr_warn("'%s' took unexpectedly long: %llums\n",
+			    poller->overtime == 2)
+				pr_warn("'%s' takes unexpectedly long: %llums\n",
 					poller->name, duration_ms);
 
 			if (poller->overtime < U16_MAX)
-- 
2.47.3




More information about the barebox mailing list