[PATCH] lib: sbi_timer: Restart events from the restart list
Anup Patel
anup at brainfault.org
Fri Oct 23 01:28:03 PDT 2026
On Mon, Aug 31, 2026 at 6:36 PM Pengpeng Hou <pengpeng at iscas.ac.cn> wrote:
>
> 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 <pengpeng at iscas.ac.cn>
LGTM.
Reviewed-by: Anup Patel <anup at brainfault.org>
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
> ---
> 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 8abb5e7b..ba60a4e5 100644
> --- a/lib/sbi/sbi_timer.c
> +++ b/lib/sbi/sbi_timer.c
> @@ -324,7 +324,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);
> }
> --
> 2.50.1 (Apple Git-155)
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list