From: Jiri Olsa <olsajiri@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Sven Schnelle <svens@linux.ibm.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Guo Ren <guoren@kernel.org>,
Donglin Peng <dolinux.peng@gmail.com>,
Zheng Yejian <zhengyejian@huaweicloud.com>,
bpf@vger.kernel.org
Subject: Re: [PATCH v2 0/4] ftrace: Add function arguments to function tracers
Date: Wed, 25 Dec 2024 22:40:53 +0100 [thread overview]
Message-ID: <Z2x75Yumj1TKYce0@krava> (raw)
In-Reply-To: <20241223201347.609298489@goodmis.org>
On Mon, Dec 23, 2024 at 03:13:47PM -0500, Steven Rostedt wrote:
>
> These patches add support for printing function arguments in ftrace.
>
> Example usage:
>
> function tracer:
>
> ~# cd /sys/kernel/tracing/
> ~# echo icmp_rcv >set_ftrace_filter
> ~# echo function >current_tracer
> ~# echo 1 >options/func-args
> ~# ping -c 10 127.0.0.1
> [..]
> ~# cat trace
> [..]
> ping-1277 [030] ..s1. 39.120939: icmp_rcv(skb=0xa0ecab00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 39.120946: icmp_rcv(skb=0xa0ecac00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 40.179724: icmp_rcv(skb=0xa0ecab00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 40.179730: icmp_rcv(skb=0xa0ecac00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 41.219700: icmp_rcv(skb=0xa0ecab00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 41.219706: icmp_rcv(skb=0xa0ecac00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 42.259717: icmp_rcv(skb=0xa0ecab00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 42.259725: icmp_rcv(skb=0xa0ecac00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 43.299735: icmp_rcv(skb=0xa0ecab00) <-ip_protocol_deliver_rcu
> ping-1277 [030] ..s1. 43.299742: icmp_rcv(skb=0xa0ecac00) <-ip_protocol_deliver_rcu
>
> function graph:
>
> ~# cd /sys/kernel/tracing
> ~# echo icmp_rcv >set_graph_function
> ~# echo function_graph >current_tracer
> ~# echo 1 >options/funcgraph-args
>
> ~# ping -c 1 127.0.0.1
>
> ~# cat trace
>
> 30) | icmp_rcv(skb=0xa0ecab00) {
> 30) | __skb_checksum_complete(skb=0xa0ecab00) {
> 30) | skb_checksum(skb=0xa0ecab00, offset=0, len=64, csum=0) {
> 30) | __skb_checksum(skb=0xa0ecab00, offset=0, len=64, csum=0, ops=0x232e0327a88) {
> 30) 0.418 us | csum_partial(buff=0xa0d20924, len=64, sum=0)
> 30) 0.985 us | }
> 30) 1.463 us | }
> 30) 2.039 us | }
> [..]
>
> This was last posted by Sven Schnelle here:
>
> https://lore.kernel.org/all/20240904065908.1009086-1-svens@linux.ibm.com/
>
> As Sven hasn't worked on it since, I decided to continue to push it
> through. I'm keeping Sven as original author and added myself as
> "Co-developed-by".
>
> The main changes are:
>
> - Made the kconfig option unconditional if all the dependencies are set.
>
> - Not save ftrace_regs in the ring buffer, as that is an abstract
> descriptor defined by the architectures and should remain opaque from
> generic code. Instead, the args are read at the time they are recorded
> (with the ftrace_regs passed to the callback function), and saved into
> the ring buffer. Then the print function only takes an array of elements.
>
> This could allow archs to retrieve arguments that are on the stack where
> as, post processing ftrace_regs could cause undesirable results.
>
> - Made the function and function graph entry events dynamically sized
> to allow the arguments to be appended to the event in the ring buffer.
> The print function only looks to see if the event saved in the ring
> buffer is big enough to hold all the arguments defined by the new
> FTRACE_REGS_MAX_ARGS macro and if so, it will assume there are arguments
> there and print them. This also means user space will not break on
> reading these events as arguments will simply be ignored.
>
> - The printing of the arguments has some more data when things are not
> processed by BPF. Any unsupported argument will have the type printed
> out in the ring buffer.
>
> - Also removed the spaces around the '=' as that's more in line to how
> trace events show their fields.
>
> - One new patch I added to convert function graph tracing over to using
> args as soon as the user sets the option even if function graph tracing
> is enabled. Function tracer did this already by default.
>
> Steven Rostedt (1):
> 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
hi,
what branch is this based on? can't find any that would apply patch#2
without conflict.
thanks,
jirka
>
> ----
> include/linux/ftrace_regs.h | 5 +
> kernel/trace/Kconfig | 12 +++
> kernel/trace/trace.c | 12 ++-
> kernel/trace/trace.h | 4 +-
> kernel/trace/trace_entries.h | 12 ++-
> kernel/trace/trace_functions.c | 46 ++++++++-
> kernel/trace/trace_functions_graph.c | 174 ++++++++++++++++++++++++++++-------
> kernel/trace/trace_irqsoff.c | 4 +-
> kernel/trace/trace_output.c | 96 ++++++++++++++++++-
> kernel/trace/trace_output.h | 9 ++
> kernel/trace/trace_sched_wakeup.c | 4 +-
> 11 files changed, 324 insertions(+), 54 deletions(-)
>
next prev parent reply other threads:[~2024-12-25 21:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 20:13 [PATCH v2 0/4] ftrace: Add function arguments to function tracers Steven Rostedt
2024-12-23 20:13 ` [PATCH v2 1/4] ftrace: Add print_function_args() Steven Rostedt
2024-12-23 21:36 ` Steven Rostedt
2024-12-25 13:15 ` Masami Hiramatsu
2024-12-25 21:59 ` Steven Rostedt
[not found] ` <CAErzpms4g8=3486Uv-PPxiA0GSkNQQm1Ez67eo-H3LtAhTAJCA@mail.gmail.com>
2025-01-08 4:52 ` Masami Hiramatsu
2025-01-08 11:19 ` Alan Maguire
2025-01-08 15:24 ` Steven Rostedt
2025-01-08 15:39 ` Alan Maguire
2024-12-23 20:13 ` [PATCH v2 2/4] ftrace: Add support for function argument to graph tracer Steven Rostedt
2024-12-25 15:41 ` Masami Hiramatsu
2024-12-25 22:02 ` Steven Rostedt
2024-12-23 20:13 ` [PATCH v2 3/4] ftrace: Have funcgraph-args take affect during tracing Steven Rostedt
2024-12-25 14:23 ` Masami Hiramatsu
2024-12-23 20:13 ` [PATCH v2 4/4] ftrace: Add arguments to function tracer Steven Rostedt
2024-12-25 14:21 ` Masami Hiramatsu
2024-12-25 21:40 ` Jiri Olsa [this message]
2024-12-25 21:56 ` [PATCH v2 0/4] ftrace: Add function arguments to function tracers Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z2x75Yumj1TKYce0@krava \
--to=olsajiri@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=bpf@vger.kernel.org \
--cc=dolinux.peng@gmail.com \
--cc=guoren@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rostedt@goodmis.org \
--cc=svens@linux.ibm.com \
--cc=zhengyejian@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).