linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>, Guo Ren <guoren@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org
Subject: [PATCH 0/7] add function arguments to ftrace
Date: Wed,  4 Sep 2024 08:58:54 +0200	[thread overview]
Message-ID: <20240904065908.1009086-1-svens@linux.ibm.com> (raw)

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    |    }
[..]


Sven Schnelle (7):
  tracing: add ftrace_regs to function_graph_enter()
  x86/tracing: pass ftrace_regs to function_graph_enter()
  s390/tracing: pass ftrace_regs to function_graph_enter()
  Add print_function_args()
  tracing: add config option for print arguments in ftrace
  tracing: add support for function argument to graph tracer
  tracing: add arguments to function tracer

 arch/arm/kernel/ftrace.c             |  2 +-
 arch/arm64/kernel/ftrace.c           |  2 +-
 arch/csky/kernel/ftrace.c            |  2 +-
 arch/loongarch/kernel/ftrace.c       |  2 +-
 arch/loongarch/kernel/ftrace_dyn.c   |  2 +-
 arch/microblaze/kernel/ftrace.c      |  2 +-
 arch/mips/kernel/ftrace.c            |  2 +-
 arch/parisc/kernel/ftrace.c          |  2 +-
 arch/powerpc/kernel/trace/ftrace.c   |  2 +-
 arch/riscv/kernel/ftrace.c           |  2 +-
 arch/s390/kernel/entry.h             |  4 +-
 arch/s390/kernel/ftrace.c            |  4 +-
 arch/sh/kernel/ftrace.c              |  2 +-
 arch/sparc/kernel/ftrace.c           |  2 +-
 arch/x86/include/asm/ftrace.h        |  2 +-
 arch/x86/kernel/ftrace.c             |  6 +-
 include/linux/ftrace.h               |  4 +-
 kernel/trace/Kconfig                 | 12 ++++
 kernel/trace/fgraph.c                |  7 ++-
 kernel/trace/trace.c                 |  8 ++-
 kernel/trace/trace.h                 |  4 +-
 kernel/trace/trace_entries.h         |  7 ++-
 kernel/trace/trace_functions.c       | 46 ++++++++++++++--
 kernel/trace/trace_functions_graph.c | 74 +++++++++++++------------
 kernel/trace/trace_irqsoff.c         |  4 +-
 kernel/trace/trace_output.c          | 82 +++++++++++++++++++++++++++-
 kernel/trace/trace_output.h          |  9 +++
 kernel/trace/trace_sched_wakeup.c    |  4 +-
 28 files changed, 228 insertions(+), 73 deletions(-)

--
2.43.0

             reply	other threads:[~2024-09-04  6:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  6:58 Sven Schnelle [this message]
2024-09-04  6:58 ` [PATCH 1/7] tracing: add ftrace_regs to function_graph_enter() Sven Schnelle
2024-09-05 15:16 ` [PATCH 0/7] add function arguments to ftrace Steven Rostedt
2024-09-06  6:18   ` Sven Schnelle
2024-09-06 14:07     ` Steven Rostedt
2024-09-08 13:28       ` Masami Hiramatsu
2024-09-09  7:52         ` Sven Schnelle
2024-09-13  6:03           ` Sven Schnelle
2024-09-20  8:17             ` Masami Hiramatsu

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=20240904065908.1009086-1-svens@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=guoren@kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.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 \
    /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).