[PATCH bpf-next 2/3] selftests/bpf: skip recursive functions for kprobe_multi

Menglong Dong posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH bpf-next 2/3] selftests/bpf: skip recursive functions for kprobe_multi
Posted by Menglong Dong 1 month, 2 weeks ago
Some functions is recursive for the kprobe_multi and impact the benchmark
results. So just skip them.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 tools/testing/selftests/bpf/trace_helpers.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index d24baf244d1f..9da9da51b132 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -559,6 +559,22 @@ static bool skip_entry(char *name)
 	if (!strncmp(name, "__ftrace_invalid_address__",
 		     sizeof("__ftrace_invalid_address__") - 1))
 		return true;
+
+	if (!strcmp(name, "migrate_disable"))
+		return true;
+	if (!strcmp(name, "migrate_enable"))
+		return true;
+	if (!strcmp(name, "rcu_read_unlock_strict"))
+		return true;
+	if (!strcmp(name, "preempt_count_add"))
+		return true;
+	if (!strcmp(name, "preempt_count_sub"))
+		return true;
+	if (!strcmp(name, "__rcu_read_lock"))
+		return true;
+	if (!strcmp(name, "__rcu_read_unlock"))
+		return true;
+
 	return false;
 }
 
-- 
2.50.1
Re: [PATCH bpf-next 2/3] selftests/bpf: skip recursive functions for kprobe_multi
Posted by Andrii Nakryiko 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 8:40 PM Menglong Dong <menglong8.dong@gmail.com> wrote:
>
> Some functions is recursive for the kprobe_multi and impact the benchmark
> results. So just skip them.
>
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
>  tools/testing/selftests/bpf/trace_helpers.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
> index d24baf244d1f..9da9da51b132 100644
> --- a/tools/testing/selftests/bpf/trace_helpers.c
> +++ b/tools/testing/selftests/bpf/trace_helpers.c
> @@ -559,6 +559,22 @@ static bool skip_entry(char *name)
>         if (!strncmp(name, "__ftrace_invalid_address__",
>                      sizeof("__ftrace_invalid_address__") - 1))
>                 return true;
> +
> +       if (!strcmp(name, "migrate_disable"))
> +               return true;
> +       if (!strcmp(name, "migrate_enable"))
> +               return true;
> +       if (!strcmp(name, "rcu_read_unlock_strict"))
> +               return true;
> +       if (!strcmp(name, "preempt_count_add"))
> +               return true;
> +       if (!strcmp(name, "preempt_count_sub"))
> +               return true;
> +       if (!strcmp(name, "__rcu_read_lock"))
> +               return true;
> +       if (!strcmp(name, "__rcu_read_unlock"))
> +               return true;
> +

static const char *trace_blacklist[] = {
    "migrate_disable",
    "migrate_enable",
    ...
};

it's not like it's one or two functions where copy-pasting strcmp might be fine

pw-bot: cr


>         return false;
>  }
>
> --
> 2.50.1
>
Re: [PATCH bpf-next 2/3] selftests/bpf: skip recursive functions for kprobe_multi
Posted by Menglong Dong 1 month, 2 weeks ago
On Thu, Aug 21, 2025 at 6:47 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Mon, Aug 18, 2025 at 8:40 PM Menglong Dong <menglong8.dong@gmail.com> wrote:
> >
> > Some functions is recursive for the kprobe_multi and impact the benchmark
> > results. So just skip them.
> >
> > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > ---
> >  tools/testing/selftests/bpf/trace_helpers.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
> > index d24baf244d1f..9da9da51b132 100644
> > --- a/tools/testing/selftests/bpf/trace_helpers.c
> > +++ b/tools/testing/selftests/bpf/trace_helpers.c
> > @@ -559,6 +559,22 @@ static bool skip_entry(char *name)
> >         if (!strncmp(name, "__ftrace_invalid_address__",
> >                      sizeof("__ftrace_invalid_address__") - 1))
> >                 return true;
> > +
> > +       if (!strcmp(name, "migrate_disable"))
> > +               return true;
> > +       if (!strcmp(name, "migrate_enable"))
> > +               return true;
> > +       if (!strcmp(name, "rcu_read_unlock_strict"))
> > +               return true;
> > +       if (!strcmp(name, "preempt_count_add"))
> > +               return true;
> > +       if (!strcmp(name, "preempt_count_sub"))
> > +               return true;
> > +       if (!strcmp(name, "__rcu_read_lock"))
> > +               return true;
> > +       if (!strcmp(name, "__rcu_read_unlock"))
> > +               return true;
> > +
>
> static const char *trace_blacklist[] = {
>     "migrate_disable",
>     "migrate_enable",
>     ...
> };
>
> it's not like it's one or two functions where copy-pasting strcmp might be fine

OK!

>
> pw-bot: cr
>
>
> >         return false;
> >  }
> >
> > --
> > 2.50.1
> >