* [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct
@ 2025-11-10 12:18 Menglong Dong
2025-11-10 22:41 ` Jiri Olsa
2025-11-10 23:20 ` Masami Hiramatsu
0 siblings, 2 replies; 3+ messages in thread
From: Menglong Dong @ 2025-11-10 12:18 UTC (permalink / raw)
To: rostedt, jolsa
Cc: mhiramat, mark.rutland, mathieu.desnoyers, jiang.biao,
linux-kernel, linux-trace-kernel, bpf
The FTRACE_OPS_FL_INITIALIZED flag is cleared in register_ftrace_direct,
which can make it initialized by ftrace_ops_init() even if it is already
initialized. It seems that there is no big deal here, but let's still fix
it.
Fixes: f64dd4627ec6 ("ftrace: Add multi direct register/unregister interface")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
kernel/trace/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 42bd2ba68a82..efb5ce32298f 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6043,7 +6043,7 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)
new_hash = NULL;
ops->func = call_direct_funcs;
- ops->flags = MULTI_FLAGS;
+ ops->flags |= MULTI_FLAGS;
ops->trampoline = FTRACE_REGS_ADDR;
ops->direct_call = addr;
--
2.51.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct
2025-11-10 12:18 [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct Menglong Dong
@ 2025-11-10 22:41 ` Jiri Olsa
2025-11-10 23:20 ` Masami Hiramatsu
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2025-11-10 22:41 UTC (permalink / raw)
To: Menglong Dong
Cc: rostedt, jolsa, mhiramat, mark.rutland, mathieu.desnoyers,
jiang.biao, linux-kernel, linux-trace-kernel, bpf
On Mon, Nov 10, 2025 at 08:18:08PM +0800, Menglong Dong wrote:
> The FTRACE_OPS_FL_INITIALIZED flag is cleared in register_ftrace_direct,
> which can make it initialized by ftrace_ops_init() even if it is already
> initialized. It seems that there is no big deal here, but let's still fix
> it.
good catch
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
>
> Fixes: f64dd4627ec6 ("ftrace: Add multi direct register/unregister interface")
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
> kernel/trace/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 42bd2ba68a82..efb5ce32298f 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6043,7 +6043,7 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)
> new_hash = NULL;
>
> ops->func = call_direct_funcs;
> - ops->flags = MULTI_FLAGS;
> + ops->flags |= MULTI_FLAGS;
> ops->trampoline = FTRACE_REGS_ADDR;
> ops->direct_call = addr;
>
> --
> 2.51.2
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct
2025-11-10 12:18 [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct Menglong Dong
2025-11-10 22:41 ` Jiri Olsa
@ 2025-11-10 23:20 ` Masami Hiramatsu
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2025-11-10 23:20 UTC (permalink / raw)
To: Menglong Dong
Cc: rostedt, jolsa, mhiramat, mark.rutland, mathieu.desnoyers,
jiang.biao, linux-kernel, linux-trace-kernel, bpf
On Mon, 10 Nov 2025 20:18:08 +0800
Menglong Dong <menglong8.dong@gmail.com> wrote:
> The FTRACE_OPS_FL_INITIALIZED flag is cleared in register_ftrace_direct,
> which can make it initialized by ftrace_ops_init() even if it is already
> initialized. It seems that there is no big deal here, but let's still fix
> it.
>
> Fixes: f64dd4627ec6 ("ftrace: Add multi direct register/unregister interface")
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks,
> ---
> kernel/trace/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 42bd2ba68a82..efb5ce32298f 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6043,7 +6043,7 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)
> new_hash = NULL;
>
> ops->func = call_direct_funcs;
> - ops->flags = MULTI_FLAGS;
> + ops->flags |= MULTI_FLAGS;
> ops->trampoline = FTRACE_REGS_ADDR;
> ops->direct_call = addr;
>
> --
> 2.51.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-10 23:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 12:18 [PATCH] ftrace: avoid redundant initialization in register_ftrace_direct Menglong Dong
2025-11-10 22:41 ` Jiri Olsa
2025-11-10 23:20 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).