The following commit has been merged into the perf/core branch of tip: Commit-ID: 0eed28220598cd990d094b7b9f8c832c425080c0 Gitweb: https://git.kernel.org/tip/0eed28220598cd990d094b7b9f8c832c425080c0 Author: Namhyung Kim <namhyung@xxxxxxxxxx> AuthorDate: Tue, 17 Jan 2023 22:05:59 -08:00 Committer: Ingo Molnar <mingo@xxxxxxxxxx> CommitterDate: Wed, 18 Jan 2023 11:57:21 +01:00 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@xxxxxxxxxx> Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> Tested-by: Jiri Olsa <jolsa@xxxxxxxxxx> Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx> Acked-by: Song Liu <song@xxxxxxxxxx> Acked-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230118060559.615653-9-namhyung@xxxxxxxxxx --- kernel/events/core.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 4aa73ed..380476a 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();