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: b7fa8a246c ("lib: sbi_timer: Add support for timer events")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260831130641.54100-1-pengpeng@iscas.ac.cn
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Pengpeng Hou authored and Anup Patel committed 2026-10-23 13:55:43 +05:30
1 parent 9bc841226d
commit 5930665a17
1 file changed
+1 -1
+1 -1
View File
@@ -326,7 +326,7 @@ void sbi_timer_process(void)
} }
while (!sbi_list_empty(&restart_list)) { 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_list_del(&ev->head);
__sbi_timer_event_start(tstate, ev, ev->time_stamp); __sbi_timer_event_start(tstate, ev, ev->time_stamp);
} }