From: ChenMiao <chenmiao.ku@gmail.com>
To: Linux RISCV <linux-riscv@vger.kernel.org>
Cc: chenmiao <chenmiao.ku@gmail.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] riscv: ftrace: Fix the logic issue in DYNAMIC_FTRACE selection
Date: Thu, 3 Jul 2025 08:45:02 +0000 [thread overview]
Message-ID: <20250703084502.394406-1-chenmiao.ku@gmail.com> (raw)
From: chenmiao <chenmiao.ku@gmail.com>
When I was reading the source code of ftrace, I learned that
ftrace has two types: static and dynamic. Initially, I planned
to prioritize reading the static source code, so I disabled
the enable dynamic option in RISCV.
[*] Kernel Function Tracer
[ ] Kernel Function Graph Tracer
[ ] enable/disable function tracing dynamically (NEW)
However, when I tried to compile it, the build failed.
./include/linux/ftrace.h:190:16: error: implicit declaration of
function ‘arch_ftrace_get_regs’; did you mean ‘arch_ftrace_regs’?
[-Wimplicit-function-declaration]
190 | return arch_ftrace_get_regs(fregs);
| ^~~~~~~~~~~~~~~~~~~~
| arch_ftrace_regs
After comparing it with the ARM64 architecture, I found that
ARM64 automatically enables DYNAMIC_FTRACE by default once
FUNCTION_TRACER is turned on, and this cannot be set to "no".
Therefore, I believe the optional DYNAMIC_FTRACE setting in
RISC-V has a logic flaw—if FUNCTION_TRACER is enabled,
DYNAMIC_FTRACE should also be enabled, and vice versa. Moreover,
it's clear that RISC-V lacks the necessary support to successfully
compile the kernel when DYNAMIC_FTRACE is disabled.
[*] Kernel Function Tracer
[ ] Kernel Function Graph Tracer
-*- enable/disable function tracing dynamically
Signed-off-by: chenmiao <chenmiao.ku@gmail.com>
---
arch/riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 36061f473..f7fc8b460 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -97,6 +97,7 @@ config RISCV
select CLONE_BACKWARDS
select COMMON_CLK
select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
+ select DYNAMIC_FTRACE if FUNCTION_TRACER
select EDAC_SUPPORT
select FRAME_POINTER if PERF_EVENTS || (FUNCTION_TRACER && !DYNAMIC_FTRACE)
select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
--
2.45.2
next reply other threads:[~2025-07-03 8:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 8:45 ChenMiao [this message]
2025-07-03 13:00 ` [PATCH] riscv: ftrace: Fix the logic issue in DYNAMIC_FTRACE selection Alexandre Ghiti
2025-07-03 15:40 ` Steven Rostedt
2025-07-03 16:06 ` Alexandre Ghiti
[not found] ` <CAKxVwgeDcqo83ZV+xBcHwNuMk6yeU+yp7RYo22OARAVOBgrsJQ@mail.gmail.com>
2025-07-04 12:28 ` Alexandre Ghiti
2025-07-04 12:41 ` Steven Rostedt
2025-07-04 15:42 ` Miao Chen
-- strict thread matches above, loose matches on Subject: below --
2025-07-03 8:48 ChenMiao
2025-07-04 2:22 ` kernel test robot
2025-07-06 2:12 ` kernel test robot
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=20250703084502.394406-1-chenmiao.ku@gmail.com \
--to=chenmiao.ku@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-riscv@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox