mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] poller: activate POLLER_WARN_OVERTIME only on third strike
@ 2025-11-12 15:10 Ahmad Fatoum
  2025-11-14 13:00 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-11-12 15:10 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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 d923d4c4b628..c6a7f2feabd3 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1104,7 +1104,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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-14 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-12 15:10 [PATCH] poller: activate POLLER_WARN_OVERTIME only on third strike Ahmad Fatoum
2025-11-14 13:00 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox