]> Gentwo Git Trees - linux/.git/commit
ftrace: Introduce FTRACE_OPS_FL_JMP
authorMenglong Dong <menglong8.dong@gmail.com>
Tue, 18 Nov 2025 12:36:29 +0000 (20:36 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 24 Nov 2025 17:46:24 +0000 (09:46 -0800)
commit25e4e3565d45f567f78089f38822fa64abee5230
tree7da2d2ce9e9ad91b86dfa5e4d6df263163a9495d
parentfad804002ef3cae8ca0509849d0d9539be069095
ftrace: Introduce FTRACE_OPS_FL_JMP

For now, the "nop" will be replaced with a "call" instruction when a
function is hooked by the ftrace. However, sometimes the "call" can break
the RSB and introduce extra overhead. Therefore, introduce the flag
FTRACE_OPS_FL_JMP, which indicate that the ftrace_ops should be called
with a "jmp" instead of "call". For now, it is only used by the direct
call case.

When a direct ftrace_ops is marked with FTRACE_OPS_FL_JMP, the last bit of
the ops->direct_call will be set to 1. Therefore, we can tell if we should
use "jmp" for the callback in ftrace_call_replace().

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20251118123639.688444-2-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/ftrace.h
kernel/trace/Kconfig
kernel/trace/ftrace.c