]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf tools: Skip BPF sideband event for userspace profiling
authorNamhyung Kim <namhyung@kernel.org>
Wed, 26 Feb 2025 20:30:39 +0000 (12:30 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Sun, 2 Mar 2025 17:47:24 +0000 (09:47 -0800)
The BPF sideband information is tracked using a separate thread and
evlist.  But it's only useful for profiling kernel and we can skip it
when users profile their application only.

It seems it already fails to open the sideband event in that case.
Let's remove the noise in the verbose output anyway.

Reviewed-by: Ian Rogers <irogers@google.com>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20250226203039.1099131-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/util/evlist.c
tools/perf/util/evlist.h

index 9af3f21fd0153327f920b6790fc796179dc6e0bb..ba20bf7c011d7765c6e479bce47e76f6f8f8f607 100644 (file)
@@ -2535,6 +2535,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
                goto out_free_threads;
        }
 
+       if (!evlist__needs_bpf_sb_event(rec->evlist))
+               opts->no_bpf_event = true;
+
        err = record__setup_sb_evlist(rec);
        if (err)
                goto out_free_threads;
index e1115b8317a0fe3d656351938066b80b0841d844..2c41d3aea46b204bf7174e6fe1f0ffe093510898 100644 (file)
@@ -1822,6 +1822,9 @@ int cmd_top(int argc, const char **argv)
                goto out_delete_evlist;
        }
 
+       if (!evlist__needs_bpf_sb_event(top.evlist))
+               top.record_opts.no_bpf_event = true;
+
 #ifdef HAVE_LIBBPF_SUPPORT
        if (!top.record_opts.no_bpf_event) {
                top.sb_evlist = evlist__new();
index f0dd174e2debdbe8786813f41a37b724ef3aad26..43adf6b3d855771a6f2887f9a2ee28e64a5dae79 100644 (file)
@@ -2594,3 +2594,17 @@ bool evlist__has_bpf_output(struct evlist *evlist)
 
        return false;
 }
+
+bool evlist__needs_bpf_sb_event(struct evlist *evlist)
+{
+       struct evsel *evsel;
+
+       evlist__for_each_entry(evlist, evsel) {
+               if (evsel__is_dummy_event(evsel))
+                       continue;
+               if (!evsel->core.attr.exclude_kernel)
+                       return true;
+       }
+
+       return false;
+}
index adddb1db1ad2b25d30068f6389bef7f5ea71d135..edcbf1c10e92f0c47339fa5710b060a57d64333e 100644 (file)
@@ -435,5 +435,6 @@ void evlist__check_mem_load_aux(struct evlist *evlist);
 void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_list);
 void evlist__uniquify_name(struct evlist *evlist);
 bool evlist__has_bpf_output(struct evlist *evlist);
+bool evlist__needs_bpf_sb_event(struct evlist *evlist);
 
 #endif /* __PERF_EVLIST_H */