All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Shuah Khan" <shuah@kernel.org>
Cc: <ebpf@linuxfoundation.org>,
	"Bastien Curutchet" <bastien.curutchet@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	<linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next 0/2] selftests/bpf: port test_ftrace.sh into test_progs
Date: Sat, 31 Oct 2026 22:54:16 +0000	[thread overview]
Message-ID: <DMJE6776F9F0.1O5A9ZMKWYEUP@gmail.com> (raw)
In-Reply-To: <20261030-ftrace_in_test_progs-v1-0-aa50c5dd1ccc@bootlin.com>

On Fri, Oct 30, 2026 at 11:50 AM Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com> wrote:
> - commit 1 brings a few new helpers to manipulate ftrace from test_progs
> - commit 2 performs the actual porting
[...]
>  5 files changed, 412 insertions(+), 46 deletions(-)

This is quite heavy for a port of a 44 line script.

Lets use a tracing instance. function_graph works in instances.
An instance has its own set_ftrace_filter, current_tracer and ring
buffer. rmdir undoes all of it.

What goes away:

  series                          tracing instance
  ------------------------------  ------------------------------
  global tracefs files            files of the instance
  save and restore, patch 1       rmdir
  serial_                         not needed
  all functions are patched       only the filtered functions
  new progs                       progs/modify_return.c as is

modify_return has fentry, fmod_ret and fexit on the same function
and checks the return values.

The removal of test_ftrace.sh stays.

Instead of patches 1 and 2:

diff --git a/tools/testing/selftests/bpf/prog_tests/modify_return.c b/tools/testing/selftests/bpf/prog_tests/modify_return.c
--- a/tools/testing/selftests/bpf/prog_tests/modify_return.c
+++ b/tools/testing/selftests/bpf/prog_tests/modify_return.c
@@ -61,3 +61,28 @@ void test_modify_return(void)
 		 0 /* want_side_effect */,
 		 -EINVAL * 2 /* want_ret */);
 }
+
+/*
+ * The same test while function_graph traces the same functions.
+ * A tracing instance has its own filter, tracer and ring buffer.
+ * rmdir() undoes all of it.
+ */
+void test_modify_return_fgraph(void)
+{
+	char dir[128];
+
+	snprintf(dir, sizeof(dir), "%s/instances/bpf-XXXXXX",
+		 access("/sys/kernel/tracing/trace", F_OK) ?
+		 "/sys/kernel/debug/tracing" : "/sys/kernel/tracing");
+	if (!ASSERT_OK_PTR(mkdtemp(dir), "mkdtemp"))
+		return;
+
+	SYS(out, "echo 'bpf_modify_return_test*' > %s/set_ftrace_filter", dir);
+	SYS(out, "echo function_graph > %s/current_tracer", dir);
+
+	test_modify_return();
+
+	SYS(out, "grep -q bpf_modify_return_test2 %s/trace", dir);
+out:
+	ASSERT_OK(rmdir(dir), "rmdir");
+}

pw-bot: cr

  parent reply	other threads:[~2026-10-31 22:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 18:50 [PATCH bpf-next 0/2] selftests/bpf: port test_ftrace.sh into test_progs Alexis Lothoré (eBPF Foundation)
2026-10-30 18:50 ` [PATCH bpf-next 1/2] selftests/bpf: add helpers to manipulate ftrace Alexis Lothoré (eBPF Foundation)
2026-10-30 19:02   ` sashiko-bot
2026-10-30 19:34   ` bot+bpf-ci
2026-10-30 18:50 ` [PATCH bpf-next 2/2] selftests/bpf: port test_ftrace.sh to test_progs Alexis Lothoré (eBPF Foundation)
2026-10-30 19:05   ` sashiko-bot
2026-10-31 22:54 ` Alexei Starovoitov [this message]
2026-11-03  9:13   ` [PATCH bpf-next 0/2] selftests/bpf: port test_ftrace.sh into test_progs Alexis Lothoré
2026-11-03 18:14     ` Alexei Starovoitov
2026-11-03 18:50       ` Alexis Lothoré

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=DMJE6776F9F0.1O5A9ZMKWYEUP@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrii@kernel.org \
    --cc=bastien.curutchet@bootlin.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ebpf@linuxfoundation.org \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yonghong.song@linux.dev \
    /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.