]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod
authorJiri Olsa <jolsa@kernel.org>
Thu, 12 Mar 2026 12:37:38 +0000 (13:37 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 21 Mar 2026 20:51:04 +0000 (16:51 -0400)
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 and is always a subset of the ops->func_hash.

Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Menglong Dong <menglong8.dong@gmail.com>
Cc: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/20260312123738.129926-1-jolsa@kernel.org
Fixes: e93672f770d7 ("ftrace: Add update_ftrace_direct_mod function")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 8df69e7027066cc8190034a6146c4efa69ea48db..4133109126098451fc2c5e2ab13bdfcd8ccd44b2 100644 (file)
@@ -6606,9 +6606,9 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
        if (!orig_hash)
                goto unlock;
 
-       /* Enable the tmp_ops to have the same functions as the direct ops */
+       /* Enable the tmp_ops to have the same functions as the hash object. */
        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)