[Skiboot] [PATCH 4/9] core/timers: Fix running-timer delay

Nicholas Piggin npiggin at gmail.com
Mon Mar 31 23:46:30 AEDT 2025


When timer run code encounters an alreay-running timer, it has to
stop processing and run them later. In the case of poll timers the
SBE timer is scheduled for a minimum-delay, and for delay timers
nothing is done.

This looks backwards: poll timers do not get called from the
SBE interrupt so that delay is pointless, whereas it is helpful
for delay timers to ensure they're processed again soon.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/timer.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/core/timer.c b/core/timer.c
index b8a024947..21e7f5a83 100644
--- a/core/timer.c
+++ b/core/timer.c
@@ -201,14 +201,12 @@ static void __check_poll_timers(uint64_t now)
 		if (!t || t->gen == timer_poll_gen)
 			break;
 
-		/* Top of list still running, we have to delay handling it,
-		 * let's reprogram the SLW with a small delay. We chose
-		 * arbitrarily 1us.
+
+		/* Top of list still running, we have to delay handling
+		 * it. Just skip until the next poll.
 		 */
-		if (t->running) {
-			update_timer_expiry(now + usecs_to_tb(1));
+		if (t->running)
 			break;
-		}
 
 		/* Allright, first remove it and mark it running */
 		__remove_timer(t);
@@ -242,13 +240,14 @@ static void __check_timers(uint64_t now)
 			break;
 		}
 
-		/* Top of list still running, we have to delay handling
-		 * it. For now just skip until the next poll, when we have
-		 * SLW interrupts, we'll probably want to trip another one
-		 * ASAP
+		/* Top of list still running, we have to delay handling it,
+		 * let's reprogram the SLW/SBE with a small delay. We chose
+		 * arbitrarily 1us.
 		 */
-		if (t->running)
+		if (t->running) {
+			update_timer_expiry(now + usecs_to_tb(1));
 			break;
+		}
 
 		/* Allright, first remove it and mark it running */
 		__remove_timer(t);
-- 
2.47.1



More information about the Skiboot mailing list