All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Yongjun <jun85566@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: trini@konsulko.com, ilias.apalodimas@linaro.org,
	Lee Yongjun <jun85566@gmail.com>
Subject: [PATCH] arm: arch_timer: prevent recursive function tracing
Date: Tue, 29 Sep 2026 11:03:33 +0900	[thread overview]
Message-ID: <20260929020333.123572-1-jun85566@gmail.com> (raw)

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


             reply	other threads:[~2026-09-29 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  2:03 Lee Yongjun [this message]
2026-10-13 20:19 ` [PATCH] arm: arch_timer: prevent recursive function tracing Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929020333.123572-1-jun85566@gmail.com \
    --to=jun85566@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.