提交 0eed2822 编写于 作者: N Namhyung Kim 提交者: Ingo Molnar

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: NNamhyung Kim <namhyung@kernel.org>
Signed-off-by: NIngo Molnar <mingo@kernel.org>
Tested-by: NJiri Olsa <jolsa@kernel.org>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Acked-by: NSong Liu <song@kernel.org>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230118060559.615653-9-namhyung@kernel.org
上级 f6e70715
...@@ -10356,13 +10356,7 @@ static void bpf_overflow_handler(struct perf_event *event, ...@@ -10356,13 +10356,7 @@ static void bpf_overflow_handler(struct perf_event *event,
rcu_read_lock(); rcu_read_lock();
prog = READ_ONCE(event->prog); prog = READ_ONCE(event->prog);
if (prog) { if (prog) {
if (prog->call_get_stack && perf_prepare_sample(data, event, regs);
(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;
}
ret = bpf_prog_run(prog, &ctx); ret = bpf_prog_run(prog, &ctx);
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册