[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f7e12c6d-892e-4ca3-9ef0-fbb524d04a48@ghiti.fr>
Date: Thu, 3 Jul 2025 15:00:02 +0200
From: Alexandre Ghiti <alex@...ti.fr>
To: ChenMiao <chenmiao.ku@...il.com>,
Linux RISCV <linux-riscv@...r.kernel.org>
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
"rostedt@...dmis.org" <rostedt@...dmis.org>
Subject: Re: [PATCH] riscv: ftrace: Fix the logic issue in DYNAMIC_FTRACE
selection
Hi ChenMiao,
On 7/3/25 10:45, ChenMiao wrote:
> From: chenmiao <chenmiao.ku@...il.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.
We could support static ftrace, but I don't think we should, so I agree
with this patch. In fact I had just prepared a patch for this here
https://github.com/linux-riscv/linux/pull/556/commits/0481092a5bec3818658981c11f629e06e66382b3
which is a bit more complete since I have removed some dead code.
Let's see what other people think about supporting static ftrace, I have
added Steven in cc if he has an opinion.
Thanks,
Alex
>
> [*] Kernel Function Tracer
> [ ] Kernel Function Graph Tracer
> -*- enable/disable function tracing dynamically
>
> Signed-off-by: chenmiao <chenmiao.ku@...il.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
Powered by blists - more mailing lists