ftrace: Updates for 6.15
Linus,
ftrace changes for v6.15:
- Record function parameters for function and function graph tracers
An option has been added to function tracer (func-args) and the function graph tracer (funcgraph-args) that when set, the tracers will record the registers that hold the arguments into each function event. On reading of the trace, it will use BTF to print those arguments. Most archs support up to 6 arguments (depending on the complexity of the arguments) and those are printed. If a function has more arguments then what was recorded, the output will end with " ... )".
Example of function graph tracer:
6) | dummy_xmit [dummy](skb = 0x8887c100, dev = 0x872ca000) {
6) | consume_skb(skb = 0x8887c100) {
6) | skb_release_head_state(skb = 0x8887c100) {
6) 0.178 us | sock_wfree(skb = 0x8887c100)
6) 0.627 us | }
- The rest of the changes are minor clean ups and fixes
Please pull the latest ftrace-v6.15 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
ftrace-v6.15
Tag SHA1: d96c183fee82a7cb9e3875c6e65fae637768d592 Head SHA1: 391dda1bd7c56de62b96126214f040fe8965561b
Haiyue Wang (1):
fgraph: Correct typo in ftrace_return_to_handler comment
Jiapeng Chong (1):
function_graph: Remove the unused variable func
Sasha Levin (1):
tracing: Use hashtable.h for event_hash
Steven Rostedt (2):
ftrace: Have ftrace_free_filter() WARN and exit if ops is active
ftrace: Have funcgraph-args take affect during tracing
Sven Schnelle (3):
ftrace: Add print_function_args()
ftrace: Add support for function argument to graph tracer
ftrace: Add arguments to function tracer
Tengda Wu (1):
tracing: Fix use-after-free in print_graph_function_flags during tracer switching
----
include/linux/ftrace_regs.h | 5 + kernel/trace/Kconfig | 12 +++ kernel/trace/fgraph.c | 2 +- kernel/trace/ftrace.c | 2 + kernel/trace/trace.c | 14 ++- kernel/trace/trace.h | 5 +- kernel/trace/trace_entries.h | 12 ++- kernel/trace/trace_functions.c | 46 ++++++++- kernel/trace/trace_functions_graph.c | 176 ++++++++++++++++++++++++++++------- kernel/trace/trace_irqsoff.c | 14 ++- kernel/trace/trace_output.c | 122 +++++++++++++++++++++--- kernel/trace/trace_output.h | 9 ++ kernel/trace/trace_sched_wakeup.c | 6 +- 13 files changed, 351 insertions(+), 74 deletions(-)
---------------------------
The pull request you sent on Tue, 25 Mar 2025 19:39:35 -0400:
The pull request you sent on Tue, 25 Mar 2025 19:39:35 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gitftrace-v6.15
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/31eb415bf6f06c90fdd9b635caf3a6c5110a38b6
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
________________________________________
From: [email protected] <[email protected]>
Sent: 28 March 2025 00:09
To: Steven Rostedt <[email protected]>
Cc: Linus Torvalds <[email protected]>; LKML <[email protected]>; Masami Hiramatsu <[email protected]>; Mark Rutland <[email protected]>; Mathieu Desnoyers <[email protected]>; Andrew Morton <[email protected]>; Haiyue Wang <[email protected]>; Jiapeng Chong <[email protected]>; Sasha Levin <[email protected]>; Sven Schnelle <[email protected]>; Tengda Wu <[email protected]> Subject: Re: [GIT PULL] ftrace: Updates for 6.15
Quoted 4 lines
The pull request you sent on Tue, 25 Mar 2025 19:39:35 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gitftrace-v6.15
Quoted 8 lines
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/31eb415bf6f06c90fdd9b635caf3a6c5110a38b6Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
Hi Steven,
I'm pretty sure this causes the build to fail on linus' tree and next:4e82c87058f4 (HEAD -> master, origin/master, origin/HEAD) Merge tag 'rust-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-gnu-ld: kernel/trace/trace_output.o: in function `print_function_args':/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:712: undefined reference to `btf_find_func_proto'
aarch64-linux-gnu-ld: /home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:716: undefined reference to `btf_get_func_param' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/data_nvme1n1/chrloe01/development/linux-mainline/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Sound familiar?
grep BTF .configCONFIG_DEBUG_INFO_BTF=yCONFIG_PAHOLE_HAS_SPLIT_BTF=yCONFIG_DEBUG_INFO_BTF_MODULES=y
# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
Enabling CONFIG_PROBE_EVENTS_BTF_ARGS passes the build.
Quoted 36 lines · Christian Loehle
________________________________________
From: [email protected] <[email protected]>
Sent: 28 March 2025 00:09
To: Steven Rostedt <[email protected]>
Cc: Linus Torvalds <[email protected]>; LKML <[email protected]>; Masami Hiramatsu <[email protected]>; Mark Rutland <[email protected]>; Mathieu Desnoyers <[email protected]>; Andrew Morton <[email protected]>; Haiyue Wang <[email protected]>; Jiapeng Chong <[email protected]>; Sasha Levin <[email protected]>; Sven Schnelle <[email protected]>; Tengda Wu <[email protected]>
Subject: Re: [GIT PULL] ftrace: Updates for 6.15Quoted 4 lines
The pull request you sent on Tue, 25 Mar 2025 19:39:35 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gitftrace-v6.15Quoted 8 lines
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/31eb415bf6f06c90fdd9b635caf3a6c5110a38b6Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.htmlHi Steven,
I'm pretty sure this causes the build to fail on linus' tree and next:4e82c87058f4(HEAD -> master, origin/master, origin/HEAD) Merge tag 'rust-6.15' ofgit://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linuxaarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-gnu-ld:kernel/trace/trace_output.o: in function `print_function_args':/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:712: undefined reference to `btf_find_func_proto'
aarch64-linux-gnu-ld:/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:716: undefined reference to `btf_get_func_param' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/data_nvme1n1/chrloe01/development/linux-mainline/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Quoted 9 lines
Sound familiar?
grep BTF .configCONFIG_DEBUG_INFO_BTF=yCONFIG_PAHOLE_HAS_SPLIT_BTF=yCONFIG_DEBUG_INFO_BTF_MODULES=y
#CONFIG_MODULE_ALLOW_BTF_MISMATCHis not setEnabling
CONFIG_PROBE_EVENTS_BTF_ARGSpasses the build.
In linus' tree we have:76fe0337c219 ftrace: Add arguments to function tracer c7a60a733c37 ftrace: Have funcgraph-args take affect during tracing ff5c9c576e75 ftrace: Add support for function argument to graph tracer 533c20b062d7 ftrace: Add print_function_args()3d44e1d1575a md: switch personalities to use md_submodule_head
3d44e1d1575a md: switch personalities to use md_submodule_head builds fine.
533c20b062d7 ftrace: Add print_function_args()
is the first one to fail but with:kernel/trace/trace_output.c: In function ‘print_function_args’:kernel/trace/trace_output.c:724:26: error: ‘FTRACE_REGS_MAX_ARGS’ undeclared (first use in this function)
724 | if (a == FTRACE_REGS_MAX_ARGS) {
| ^~~~~~~~~~~~~~~~~~~~kernel/trace/trace_output.c:724:26: note: each undeclared identifier is reported only once for each function it appears in
thenff5c9c576e75 ftrace: Add support for function argument to graph tracer shows
aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-gnu-ld: kernel/trace/trace_output.o: in function `print_function_args':/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:711: undefined reference to `btf_find_func_proto'
aarch64-linux-gnu-ld: /home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:715: undefined reference to `btf_get_func_param' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/data_nvme1n1/chrloe01/development/linux-mainline/Makefile:1226: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j16 -s Image 5747.92s user 554.69s system 830% cpu 12:38.50 total
fails just like reported linus' tree.
Quoted 27 lines · Christian Loehle
________________________________________
From: [email protected] <[email protected]>
Sent: 28 March 2025 00:09
To: Steven Rostedt <[email protected]>
Cc: Linus Torvalds <[email protected]>; LKML <[email protected]>; Masami Hiramatsu <[email protected]>; Mark Rutland <[email protected]>; Mathieu Desnoyers <[email protected]>; Andrew Morton <[email protected]>; Haiyue Wang <[email protected]>; Jiapeng Chong <[email protected]>; Sasha Levin <[email protected]>; Sven Schnelle <[email protected]>; Tengda Wu <[email protected]> Subject: Re: [GIT PULL] ftrace: Updates for 6.15Quoted 4 lines
The pull request you sent on Tue, 25 Mar 2025 19:39:35 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gitftrace-v6.15Quoted 8 lines
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/31eb415bf6f06c90fdd9b635caf3a6c5110a38b6Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.htmlHi Steven,
I'm pretty sure this causes the build to fail on linus' tree and next:4e82c87058f4(HEAD -> master, origin/master, origin/HEAD) Merge tag 'rust-6.15' ofgit://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
Quoted 8 lines
aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-gnu-ld:kernel/trace/trace_output.o: in function `print_function_args':/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:712: undefined reference to `btf_find_func_proto'
aarch64-linux-gnu-ld:/home/chrloe01/development/linux-mainline/kernel/trace/trace_output.c:716: undefined reference to `btf_get_func_param' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/data_nvme1n1/chrloe01/development/linux-mainline/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
We see same issue in our CI systems.
13:29:09 + make -s -j64 ARCH=x86 13:32:31 ld: kernel/trace/trace_output.o: in function `print_function_args': 13:32:31 /home/jenkins/agent/workspace/kernel_build/linux/kernel/trace/trace_output.c:713:(.text+0x20f1): undefined reference to `btf_find_func_proto' 13:32:31 ld: /home/jenkins/agent/workspace/kernel_build/linux/kernel/trace/trace_output.c:717:(.text+0x210d): undefined reference to `btf_get_func_param' 13:32:31 make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1 13:32:31 make[1]: *** [/home/jenkins/agent/workspace/kernel_build/linux/Makefile:1234: vmlinux] Error 2 13:32:31 make: *** [Makefile:251: __sub-make] Error 2
Thanks
Quoted 11 lines
Sound familiar?
grep BTF .configCONFIG_DEBUG_INFO_BTF=yCONFIG_PAHOLE_HAS_SPLIT_BTF=yCONFIG_DEBUG_INFO_BTF_MODULES=y
#CONFIG_MODULE_ALLOW_BTF_MISMATCHis not setEnabling
CONFIG_PROBE_EVENTS_BTF_ARGSpasses the build.
Quoted 9 lines · On Tue, 1 Apr 2025 14:31:59 +0300 Leon Romanovsky <[email protected]> wrote:
We see same issue in our CI systems.
13:29:09 + make -s -j64 ARCH=x86 13:32:31 ld: kernel/trace/trace_output.o: in function `print_function_args': 13:32:31 /home/jenkins/agent/workspace/kernel_build/linux/kernel/trace/trace_output.c:713:(.text+0x20f1): undefined reference to `btf_find_func_proto' 13:32:31 ld: /home/jenkins/agent/workspace/kernel_build/linux/kernel/trace/trace_output.c:717:(.text+0x210d): undefined reference to `btf_get_func_param' 13:32:31 make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1 13:32:31 make[1]: *** [/home/jenkins/agent/workspace/kernel_build/linux/Makefile:1234: vmlinux] Error 2 13:32:31 make: *** [Makefile:251: __sub-make] Error 2
Looks like a dependency is missing and/or an #ifdef block needs to be added.
Thanks for the report, I'll take a look into it.
-- Steve