Function tracing uses timer_get_us() to obtain timestamps for trace
records. On ARMv7 systems using the architectural timer, the
timer_get_us() call path reaches get_ticks() and get_tbclk().

When built with FTRACE=1, both functions are instrumented with
__cyg_profile_func_enter() and __cyg_profile_func_exit(). This causes
the tracing code to be re-entered while obtaining a timestamp and
results in:

    trace: recursion detected, disabling

Mark get_ticks() and get_tbclk() as notrace so they are excluded from
function instrumentation.

Before this change, tracing is disabled by recursion. After this
change, tracing remains enabled and function calls are recorded
normally.

Tested on QEMU ARM virt with:

    qemu-system-arm -machine virt -nographic -bios u-boot.bin

Signed-off-by: Lee Yongjun <[email protected]>
---
 arch/arm/cpu/armv7/arch_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/arch_timer.c b/arch/arm/cpu/armv7/arch_timer.c
index 36c557d4a8f..579b6feb1b8 100644
--- a/arch/arm/cpu/armv7/arch_timer.c
+++ b/arch/arm/cpu/armv7/arch_timer.c
@@ -37,7 +37,7 @@ int timer_init(void)
        return 0;
 }
 
-unsigned long long get_ticks(void)
+unsigned long long notrace get_ticks(void)
 {
        ulong nowl, nowu;
 
@@ -57,7 +57,7 @@ ulong timer_get_boot_us(void)
        return lldiv(get_ticks(), gd->arch.timer_rate_hz / 1000000);
 }
 
-ulong get_tbclk(void)
+ulong notrace get_tbclk(void)
 {
        return gd->arch.timer_rate_hz;
 }
-- 
2.43.0

Reply via email to