From: Alexei Starovoitov <ast@kernel.org>
To: <davem@davemloft.net>
Cc: <daniel@iogearbox.net>, <rostedt@goodmis.org>, <x86@kernel.org>,
<netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<kernel-team@fb.com>
Subject: [PATCH bpf 3/3] selftests/bpf: test function_graph tracer and bpf trampoline together
Date: Sun, 8 Dec 2019 16:01:14 -0800 [thread overview]
Message-ID: <20191209000114.1876138-4-ast@kernel.org> (raw)
In-Reply-To: <20191209000114.1876138-1-ast@kernel.org>
Add simple test script to execute funciton graph tracer while BPF trampoline
attaches and detaches from the functions being graph traced.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
tools/testing/selftests/bpf/test_ftrace.sh | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100755 tools/testing/selftests/bpf/test_ftrace.sh
diff --git a/tools/testing/selftests/bpf/test_ftrace.sh b/tools/testing/selftests/bpf/test_ftrace.sh
new file mode 100755
index 000000000000..20de7bb873bc
--- /dev/null
+++ b/tools/testing/selftests/bpf/test_ftrace.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+TR=/sys/kernel/debug/tracing/
+clear_trace() { # reset trace output
+ echo > $TR/trace
+}
+
+disable_tracing() { # stop trace recording
+ echo 0 > $TR/tracing_on
+}
+
+enable_tracing() { # start trace recording
+ echo 1 > $TR/tracing_on
+}
+
+reset_tracer() { # reset the current tracer
+ echo nop > $TR/current_tracer
+}
+
+disable_tracing
+clear_trace
+
+echo "" > $TR/set_ftrace_filter
+echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace
+
+echo "bpf_prog_test*" > $TR/set_graph_function
+echo "" > $TR/set_graph_notrace
+
+echo function_graph > $TR/current_tracer
+
+enable_tracing
+./test_progs -t fentry
+./test_progs -t fexit
+disable_tracing
+clear_trace
+
+reset_tracer
+
+exit 0
--
2.23.0
next prev parent reply other threads:[~2019-12-09 0:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 0:01 [PATCH bpf 0/3] bpf: Make BPF trampoline friendly to ftrace Alexei Starovoitov
2019-12-09 0:01 ` [PATCH bpf 1/3] ftrace: Fix function_graph tracer interaction with BPF trampoline Alexei Starovoitov
2019-12-10 16:19 ` Alexei Starovoitov
2019-12-10 16:30 ` Steven Rostedt
2019-12-10 23:35 ` Steven Rostedt
2019-12-10 23:49 ` Alexei Starovoitov
2019-12-09 0:01 ` [PATCH bpf 2/3] bpf: Make BPF trampoline use register_ftrace_direct() API Alexei Starovoitov
2019-12-09 0:01 ` Alexei Starovoitov [this message]
2019-12-09 18:42 ` [PATCH bpf 0/3] bpf: Make BPF trampoline friendly to ftrace Martin Lau
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=20191209000114.1876138-4-ast@kernel.org \
--to=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.