[PATCH perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi

Jiri Olsa posted 22 patches 7 months, 4 weeks ago
There is a newer version of this series
[PATCH perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi
Posted by Jiri Olsa 7 months, 4 weeks ago
Renaming uprobe_syscall_executed prog to test_uretprobe_multi
to fit properly in the following changes that add more programs.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c   | 8 ++++----
 .../testing/selftests/bpf/progs/uprobe_syscall_executed.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
index 2b00f16406c8..3c74a079e6d9 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
@@ -277,10 +277,10 @@ static void test_uretprobe_syscall_call(void)
 		_exit(0);
 	}
 
-	skel->links.test = bpf_program__attach_uprobe_multi(skel->progs.test, pid,
-							    "/proc/self/exe",
-							    "uretprobe_syscall_call", &opts);
-	if (!ASSERT_OK_PTR(skel->links.test, "bpf_program__attach_uprobe_multi"))
+	skel->links.test_uretprobe_multi = bpf_program__attach_uprobe_multi(skel->progs.test_uretprobe_multi,
+							pid, "/proc/self/exe",
+							"uretprobe_syscall_call", &opts);
+	if (!ASSERT_OK_PTR(skel->links.test_uretprobe_multi, "bpf_program__attach_uprobe_multi"))
 		goto cleanup;
 
 	/* kick the child */
diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
index 0d7f1a7db2e2..2e1b689ed4fb 100644
--- a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
+++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
@@ -10,8 +10,8 @@ char _license[] SEC("license") = "GPL";
 int executed = 0;
 
 SEC("uretprobe.multi")
-int test(struct pt_regs *regs)
+int test_uretprobe_multi(struct pt_regs *ctx)
 {
-	executed = 1;
+	executed++;
 	return 0;
 }
-- 
2.49.0
Re: [PATCH perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi
Posted by Andrii Nakryiko 7 months, 3 weeks ago
On Mon, Apr 21, 2025 at 2:47 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Renaming uprobe_syscall_executed prog to test_uretprobe_multi
> to fit properly in the following changes that add more programs.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c   | 8 ++++----
>  .../testing/selftests/bpf/progs/uprobe_syscall_executed.c | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> index 2b00f16406c8..3c74a079e6d9 100644
> --- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> @@ -277,10 +277,10 @@ static void test_uretprobe_syscall_call(void)
>                 _exit(0);
>         }
>
> -       skel->links.test = bpf_program__attach_uprobe_multi(skel->progs.test, pid,
> -                                                           "/proc/self/exe",
> -                                                           "uretprobe_syscall_call", &opts);
> -       if (!ASSERT_OK_PTR(skel->links.test, "bpf_program__attach_uprobe_multi"))
> +       skel->links.test_uretprobe_multi = bpf_program__attach_uprobe_multi(skel->progs.test_uretprobe_multi,

this is a bit long, maybe

struct bpf_link *link;

link = bpf_program__attach...
skel->links.test_uretprobe_multi = link;

?

But other than that

Acked-by: Andrii Nakryiko <andrii@kernel.org>


> +                                                       pid, "/proc/self/exe",
> +                                                       "uretprobe_syscall_call", &opts);
> +       if (!ASSERT_OK_PTR(skel->links.test_uretprobe_multi, "bpf_program__attach_uprobe_multi"))
>                 goto cleanup;
>
>         /* kick the child */
> diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> index 0d7f1a7db2e2..2e1b689ed4fb 100644
> --- a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> @@ -10,8 +10,8 @@ char _license[] SEC("license") = "GPL";
>  int executed = 0;
>
>  SEC("uretprobe.multi")
> -int test(struct pt_regs *regs)
> +int test_uretprobe_multi(struct pt_regs *ctx)
>  {
> -       executed = 1;
> +       executed++;
>         return 0;
>  }
> --
> 2.49.0
>
Re: [PATCH perf/core 13/22] selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi
Posted by Jiri Olsa 7 months, 3 weeks ago
On Wed, Apr 23, 2025 at 10:36:22AM -0700, Andrii Nakryiko wrote:
> On Mon, Apr 21, 2025 at 2:47 PM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Renaming uprobe_syscall_executed prog to test_uretprobe_multi
> > to fit properly in the following changes that add more programs.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c   | 8 ++++----
> >  .../testing/selftests/bpf/progs/uprobe_syscall_executed.c | 4 ++--
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > index 2b00f16406c8..3c74a079e6d9 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > @@ -277,10 +277,10 @@ static void test_uretprobe_syscall_call(void)
> >                 _exit(0);
> >         }
> >
> > -       skel->links.test = bpf_program__attach_uprobe_multi(skel->progs.test, pid,
> > -                                                           "/proc/self/exe",
> > -                                                           "uretprobe_syscall_call", &opts);
> > -       if (!ASSERT_OK_PTR(skel->links.test, "bpf_program__attach_uprobe_multi"))
> > +       skel->links.test_uretprobe_multi = bpf_program__attach_uprobe_multi(skel->progs.test_uretprobe_multi,
> 
> this is a bit long, maybe
> 
> struct bpf_link *link;
> 
> link = bpf_program__attach...
> skel->links.test_uretprobe_multi = link;

ok, thanks

jirka

> 
> ?
> 
> But other than that
> 
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> 
> 
> > +                                                       pid, "/proc/self/exe",
> > +                                                       "uretprobe_syscall_call", &opts);
> > +       if (!ASSERT_OK_PTR(skel->links.test_uretprobe_multi, "bpf_program__attach_uprobe_multi"))
> >                 goto cleanup;
> >
> >         /* kick the child */
> > diff --git a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> > index 0d7f1a7db2e2..2e1b689ed4fb 100644
> > --- a/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> > +++ b/tools/testing/selftests/bpf/progs/uprobe_syscall_executed.c
> > @@ -10,8 +10,8 @@ char _license[] SEC("license") = "GPL";
> >  int executed = 0;
> >
> >  SEC("uretprobe.multi")
> > -int test(struct pt_regs *regs)
> > +int test_uretprobe_multi(struct pt_regs *ctx)
> >  {
> > -       executed = 1;
> > +       executed++;
> >         return 0;
> >  }
> > --
> > 2.49.0
> >