public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod
@ 2026-03-12 11:47 Jiri Olsa
  2026-03-12 12:24 ` bot+bpf-ci
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Olsa @ 2026-03-12 11:47 UTC (permalink / raw)
  To: Steven Rostedt, Alexei Starovoitov
  Cc: bpf, linux-kernel, linux-trace-kernel, Daniel Borkmann,
	Andrii Nakryiko, Menglong Dong, Song Liu

The modify logic registers temporary ftrace_ops object (tmp_ops) to trigger
the slow path for all direct callers to be able to safely modify attached
addresses.

At the moment we use ops->func_hash for tmp_ops filter, which represents all
the systems attachments. It's faster to use just the passed hash filter, which
contains only the modified sites is always a subset of the ops->func_hash.

Fixes: e93672f770d7 ("ftrace: Add update_ftrace_direct_mod function")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 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 8df69e702706..71dcbfeac86c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6608,7 +6608,7 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
 
 	/* Enable the tmp_ops to have the same functions as the direct ops */
 	ftrace_ops_init(&tmp_ops);
-	tmp_ops.func_hash = ops->func_hash;
+	tmp_ops.func_hash->filter_hash = hash;
 
 	err = register_ftrace_function_nolock(&tmp_ops);
 	if (err)
-- 
2.53.0


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

* Re: [PATCH bpf-next] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod
  2026-03-12 11:47 [PATCH bpf-next] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod Jiri Olsa
@ 2026-03-12 12:24 ` bot+bpf-ci
  2026-03-12 12:38   ` Jiri Olsa
  0 siblings, 1 reply; 3+ messages in thread
From: bot+bpf-ci @ 2026-03-12 12:24 UTC (permalink / raw)
  To: jolsa, rostedt, ast
  Cc: bpf, linux-kernel, linux-trace-kernel, daniel, andrii,
	menglong8.dong, song, ast, andrii, daniel, martin.lau, eddyz87,
	yonghong.song, clm, ihor.solodrai

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 8df69e702706..71dcbfeac86c 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6608,7 +6608,7 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
>
>  	/* Enable the tmp_ops to have the same functions as the direct ops */
>  	ftrace_ops_init(&tmp_ops);
> -	tmp_ops.func_hash = ops->func_hash;
> +	tmp_ops.func_hash->filter_hash = hash;

The comment above says "Enable the tmp_ops to have the same functions
as the direct ops", but after this change tmp_ops only gets the
modified subset via the hash argument, not all of the direct ops
functions.  Should the comment be updated to reflect this?

Also, the commit message has a minor grammar issue:

> which contains only the modified sites is always a subset of the
> ops->func_hash.

Reads like it is missing an "and" between "sites" and "is".


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/23000924618

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

* Re: [PATCH bpf-next] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod
  2026-03-12 12:24 ` bot+bpf-ci
@ 2026-03-12 12:38   ` Jiri Olsa
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2026-03-12 12:38 UTC (permalink / raw)
  To: bot+bpf-ci
  Cc: rostedt, ast, bpf, linux-kernel, linux-trace-kernel, daniel,
	andrii, menglong8.dong, song, martin.lau, eddyz87, yonghong.song,
	clm, ihor.solodrai

On Thu, Mar 12, 2026 at 12:24:24PM +0000, bot+bpf-ci@kernel.org wrote:
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 8df69e702706..71dcbfeac86c 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -6608,7 +6608,7 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
> >
> >  	/* Enable the tmp_ops to have the same functions as the direct ops */
> >  	ftrace_ops_init(&tmp_ops);
> > -	tmp_ops.func_hash = ops->func_hash;
> > +	tmp_ops.func_hash->filter_hash = hash;
> 
> The comment above says "Enable the tmp_ops to have the same functions
> as the direct ops", but after this change tmp_ops only gets the
> modified subset via the hash argument, not all of the direct ops
> functions.  Should the comment be updated to reflect this?
> 
> Also, the commit message has a minor grammar issue:
> 
> > which contains only the modified sites is always a subset of the
> > ops->func_hash.
> 
> Reads like it is missing an "and" between "sites" and "is".

yep, sent v2 

jirka

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

end of thread, other threads:[~2026-03-12 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 11:47 [PATCH bpf-next] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod Jiri Olsa
2026-03-12 12:24 ` bot+bpf-ci
2026-03-12 12:38   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox