On 12/27/25 14:45, Simon Glass wrote:
Hi Heinrich,

On Sat, 20 Dec 2025 at 18:59, Heinrich Schuchardt
<[email protected]> wrote:

__cyg_profile_func_enter() adds timer information to function traces.

Commit 852d4dbd70ba ("trace: Detect an infinite loop") introduced a logic
letting any recursive call to __cyg_profile_func_enter() deactivate
tracing.

This implies that a lot of the DM core and timer drivers functions need to
be marked as `notrace`. This in not desirable as those functions are part
of what we want to trace when not invoked by __cyg_profile_func_enter().

A better approach than switching of tracing is to immediately leave
__cyg_profile_func_enter() when reentered.

Reported-by: Patrick Rudolph <[email protected]>
Signed-off-by: Heinrich Schuchardt <[email protected]>
---
  lib/trace.c | 59 ++++++++++++++++++++++++-----------------------------
  1 file changed, 27 insertions(+), 32 deletions(-)


Please see here:

https://docs.u-boot.org/en/latest/develop/trace.html#board-requirements

This really just papers over the problem you are having. You cannot
use driver model to obtain the timer as tracing starts before that.

So please instead do the small extra work of defining timer_get_us()
for your board.

Hello Simon,

Thank you for reviewing the series.

Making timer_get_us() driver model independent could alleviate the issues that I tried to address with patch 2/8 (trace: initr_trace must succeed initr_dm). Yet, the current patch is about handling recursive calls.

I think we should use notrace only on the minimum set of functions that are used by tracing only. All functions that may also be used from outside of the tracing framework should be instrumented.

This patch addresses how to avoid recursion when instrumented functions are called by the instrumentation entry and exit functions. This should be handled gracefully instead marking it as a total failure and disabling the tracing framework.

Best regards

Heinrich

Reply via email to