summaryrefslogtreecommitdiffstats
path: root/kernel/events/core.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2023-01-18 07:05:59 +0100
committerIngo Molnar <mingo@kernel.org>2023-01-18 11:57:21 +0100
commit0eed28220598cd990d094b7b9f8c832c425080c0 (patch)
tree98d16fb509d0475b7a7ed7588817d229e24acaf8 /kernel/events/core.c
parentperf/core: Introduce perf_prepare_header() (diff)
downloadlinux-0eed28220598cd990d094b7b9f8c832c425080c0.tar.xz
linux-0eed28220598cd990d094b7b9f8c832c425080c0.zip
perf/core: Call perf_prepare_sample() before running BPF
As BPF can access sample data, it needs to populate the data. Also remove the logic to get the callchain specifically as it's covered by the perf_prepare_sample() now. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <song@kernel.org> Acked-by: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230118060559.615653-9-namhyung@kernel.org
Diffstat (limited to 'kernel/events/core.c')
-rw-r--r--kernel/events/core.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4aa73edbaf4c..380476a934e8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10356,13 +10356,7 @@ static void bpf_overflow_handler(struct perf_event *event,
rcu_read_lock();
prog = READ_ONCE(event->prog);
if (prog) {
- if (prog->call_get_stack &&
- (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) &&
- !(data->sample_flags & PERF_SAMPLE_CALLCHAIN)) {
- data->callchain = perf_callchain(event, regs);
- data->sample_flags |= PERF_SAMPLE_CALLCHAIN;
- }
-
+ perf_prepare_sample(data, event, regs);
ret = bpf_prog_run(prog, &ctx);
}
rcu_read_unlock();