diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2023-03-14 16:42:29 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-03-15 10:34:33 -0300 |
| commit | 56ec9457a4a20c5e07ad94bfb6e23077d54cb28e (patch) | |
| tree | cafe1144949eb53e95bfbbfc4e2ce9fb87e04c1f /tools/perf/util/evsel.h | |
| parent | 990a71e904f6ec2d7d84eecb37e5127b75721985 (diff) | |
| download | linux-56ec9457a4a20c5e07ad94bfb6e23077d54cb28e.tar.gz linux-56ec9457a4a20c5e07ad94bfb6e23077d54cb28e.tar.bz2 linux-56ec9457a4a20c5e07ad94bfb6e23077d54cb28e.zip | |
perf bpf filter: Implement event sample filtering
The BPF program will be attached to a perf_event and be triggered when
it overflows. It'd iterate the filters map and compare the sample
value according to the expression. If any of them fails, the sample
would be dropped.
Also it needs to have the corresponding sample data for the expression
so it compares data->sample_flags with the given value. To access the
sample data, it uses the bpf_cast_to_kern_ctx() kfunc which was added
in v6.2 kernel.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Song Liu <song@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel.h')
| -rw-r--r-- | tools/perf/util/evsel.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index c272c06565c0..68072ec655ce 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -150,8 +150,10 @@ struct evsel { */ struct bpf_counter_ops *bpf_counter_ops; - /* for perf-stat -b */ - struct list_head bpf_counter_list; + union { + struct list_head bpf_counter_list; /* for perf-stat -b */ + struct list_head bpf_filters; /* for perf-record --filter */ + }; /* for perf-stat --use-bpf */ int bperf_leader_prog_fd; @@ -159,6 +161,7 @@ struct evsel { union { struct bperf_leader_bpf *leader_skel; struct bperf_follower_bpf *follower_skel; + void *bpf_skel; }; unsigned long open_flags; int precise_ip_original; |
