From 5930665a17388b52003b1a3579c1c773d831be22 Mon Sep 17 00:00:00 2001 From: Pengpeng Hou Date: Mon, 31 Aug 2026 21:06:41 +0800 Subject: [PATCH] lib: sbi_timer: Restart events from the restart list Timer callbacks can request that an expired event be restarted. Such events are moved to a local restart_list, but the restart loop tests that list while reading its first entry from tstate->event_list. If the main event list is empty, the loop treats its list head as a timer event. Otherwise it repeatedly removes and reinserts the wrong event while restart_list remains nonempty, so timer processing cannot complete. No in-tree callback currently requests a restart, but the timer-event callback interface exposes this path to OpenSBI library and platform users. Read the event from restart_list, matching the loop condition and the list that owns the entry. Fixes: b7fa8a246cba ("lib: sbi_timer: Add support for timer events") Signed-off-by: Pengpeng Hou Reviewed-by: Anup Patel Link: https://lore.kernel.org/r/20260831130641.54100-1-pengpeng@iscas.ac.cn Signed-off-by: Anup Patel --- lib/sbi/sbi_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c index 78aaa32e..84030310 100644 --- a/lib/sbi/sbi_timer.c +++ b/lib/sbi/sbi_timer.c @@ -326,7 +326,7 @@ void sbi_timer_process(void) } while (!sbi_list_empty(&restart_list)) { - ev = sbi_list_first_entry(&tstate->event_list, struct sbi_timer_event, head); + ev = sbi_list_first_entry(&restart_list, struct sbi_timer_event, head); sbi_list_del(&ev->head); __sbi_timer_event_start(tstate, ev, ev->time_stamp); }