Hi Heinrich, On Mon, 29 Dec 2025 at 05:27, Heinrich Schuchardt <[email protected]> wrote: > > 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.
Yes I agree with that, so long as we include 'get the current timestamp' as part of the tracing framework. > > 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. Adding a trace record requires a timestamp. Are you saying that you want to trace (for example) timer_get_us() in the normal case, but want tracing to be automatically disabled for that function only when it is called from the entry/exit functions? To me that seems more reasonable, although I worry it will paper over problems that people should look at, like having a trace-safe timer. Regards, Simon

