All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: arch_timer: prevent recursive function tracing
@ 2026-09-29  2:03 Lee Yongjun
  2026-10-13 20:19 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Lee Yongjun @ 2026-09-29  2:03 UTC (permalink / raw)
  To: u-boot; +Cc: trini, ilias.apalodimas, Lee Yongjun

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 <jun85566@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm: arch_timer: prevent recursive function tracing
  2026-09-29  2:03 [PATCH] arm: arch_timer: prevent recursive function tracing Lee Yongjun
@ 2026-10-13 20:19 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2026-10-13 20:19 UTC (permalink / raw)
  To: u-boot, Lee Yongjun; +Cc: ilias.apalodimas

On Tue, 29 Sep 2026 11:03:33 +0900, Lee Yongjun wrote:

> 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:
> 
> [...]

Applied to u-boot/main, thanks!

[1/1] arm: arch_timer: prevent recursive function tracing
      commit: 7b1b8fc581a9d4907968cdbf8fb6296f616d56f0
-- 
Tom



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-13 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29  2:03 [PATCH] arm: arch_timer: prevent recursive function tracing Lee Yongjun
2026-10-13 20:19 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.