]> www.infradead.org Git - users/hch/misc.git/commitdiff
selftests/bpf: skip recursive functions for kprobe_multi
authorMenglong Dong <menglong8.dong@gmail.com>
Thu, 4 Sep 2025 02:10:10 +0000 (10:10 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 4 Sep 2025 16:00:25 +0000 (09:00 -0700)
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>
Link: https://lore.kernel.org/r/20250904021011.14069-3-dongml2@chinatelecom.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/trace_helpers.c

index d24baf244d1f343139f8fea5696f9fb125b9fa7b..9577979bd84da45902cd82b4c2fc81419dd87ec8 100644 (file)
@@ -19,6 +19,7 @@
 #include <gelf.h>
 #include "bpf/hashmap.h"
 #include "bpf/libbpf_internal.h"
+#include "bpf_util.h"
 
 #define TRACEFS_PIPE   "/sys/kernel/tracing/trace_pipe"
 #define DEBUGFS_PIPE   "/sys/kernel/debug/tracing/trace_pipe"
@@ -540,8 +541,20 @@ static bool is_invalid_entry(char *buf, bool kernel)
        return false;
 }
 
+static const char * const trace_blacklist[] = {
+       "migrate_disable",
+       "migrate_enable",
+       "rcu_read_unlock_strict",
+       "preempt_count_add",
+       "preempt_count_sub",
+       "__rcu_read_lock",
+       "__rcu_read_unlock",
+};
+
 static bool skip_entry(char *name)
 {
+       int i;
+
        /*
         * We attach to almost all kernel functions and some of them
         * will cause 'suspicious RCU usage' when fprobe is attached
@@ -559,6 +572,12 @@ static bool skip_entry(char *name)
        if (!strncmp(name, "__ftrace_invalid_address__",
                     sizeof("__ftrace_invalid_address__") - 1))
                return true;
+
+       for (i = 0; i < ARRAY_SIZE(trace_blacklist); i++) {
+               if (!strcmp(name, trace_blacklist[i]))
+                       return true;
+       }
+
        return false;
 }