[RFC 2/8] trace: initr_trace must succeed initr_dm
Simon Glass
sjg at chromium.org
Sat Dec 27 14:45:06 CET 2025
Hi Heinrich,
On Sat, 20 Dec 2025 at 18:59, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> qemu-riscv64_smode_defconfig with function tracing enables ends in an
> endless loop in notify_dynamic. When iterating over state->spy_head,
> list_for_each_entry_safe() does not discover the end of the list.
>
> The reason is that the address of state->spy_head has been relocated but
> state->spy_head.next and state>spy_head.prev still point to the unrelocated
> address. Therefore list_for_entry_safe() does not discover the end of the
> list.
>
> We cannot start tracing before initr_reloc().
There is a step missing here...why is initr_reloc() sending an event?
Also it isn't clear what this has to do with tracing.
>
> When placing INITCALL(initr_trace) directly after INITCALL(initr_reloc) the
> timer driver panics with
>
> Could not initialize timer (err -11).
>
> Tracing uses the timer driver to add timestamps. The driver model needs
> to be initialized to use the timer driver.
>
> INITCALL(initr_trace) needs to be placed after INITCALL(initr_dm) in
> initcall_run_r() to let the timer driver work properly.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> common/board_r.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index 76f9fc090fb..2b8f5a423a6 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -604,7 +604,6 @@ static void initcall_run_r(void)
> * Please do not add logic to this function (variables, if (), etc.).
> * For simplicity it should remain an ordered list of function calls.
> */
> - INITCALL(initr_trace);
> INITCALL(initr_reloc);
> INITCALL(event_init);
> /* TODO: could x86/PPC have this also perhaps? */
> @@ -635,6 +634,7 @@ static void initcall_run_r(void)
> #if CONFIG_IS_ENABLED(DM)
> INITCALL(initr_dm);
> #endif
> + INITCALL(initr_trace);
No, this is far too late.
> #if CONFIG_IS_ENABLED(ADDR_MAP)
> INITCALL(init_addr_map);
> #endif
> --
> 2.51.0
>
Regards,
Simon
More information about the U-Boot
mailing list