From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Song Liu <song@kernel.org>,
bpf@vger.kernel.org
Subject: [PATCH 8/8] perf/core: Call perf_prepare_sample() before running BPF
Date: Tue, 17 Jan 2023 22:05:59 -0800 [thread overview]
Message-ID: <20230118060559.615653-9-namhyung@kernel.org> (raw)
In-Reply-To: <20230118060559.615653-1-namhyung@kernel.org>
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.
Cc: bpf@vger.kernel.org
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
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 73c40ce84c48..5af61d0292ab 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10363,13 +10363,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();
--
2.39.0.314.g84b9a713c41-goog
next prev parent reply other threads:[~2023-01-18 6:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 6:05 [PATCHSET 0/8] perf/core: Prepare sample data for BPF (v3) Namhyung Kim
2023-01-18 6:05 ` [PATCH 1/8] perf/core: Save the dynamic parts of sample data size Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 2/8] perf/core: Add perf_sample_save_callchain() helper Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 3/8] perf/core: Add perf_sample_save_raw_data() helper Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 4/8] perf/core: Add perf_sample_save_brstack() helper Namhyung Kim
2023-01-18 6:05 ` Namhyung Kim
2023-01-18 9:06 ` Athira Rajeev
2023-01-18 9:06 ` Athira Rajeev
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 5/8] perf/core: Set data->sample_flags in perf_prepare_sample() Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 6/8] perf/core: Do not pass header for sample id init Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] perf/core: Do not pass header for sample ID init tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` [PATCH 7/8] perf/core: Introduce perf_prepare_header() Namhyung Kim
2023-01-18 11:37 ` [tip: perf/core] " tip-bot2 for Namhyung Kim
2023-01-18 6:05 ` Namhyung Kim [this message]
2023-01-18 11:37 ` [tip: perf/core] perf/core: Call perf_prepare_sample() before running BPF tip-bot2 for Namhyung Kim
2023-01-18 10:50 ` [PATCHSET 0/8] perf/core: Prepare sample data for BPF (v3) Peter Zijlstra
2023-01-18 19:42 ` Alexei Starovoitov
2023-01-18 22:08 ` Namhyung Kim
-- strict thread matches above, loose matches on Subject: below --
2023-01-12 21:40 [PATCHSET 0/8] perf/core: Prepare sample data for BPF Namhyung Kim
2023-01-12 21:40 ` [PATCH 8/8] perf/core: Call perf_prepare_sample() before running BPF Namhyung Kim
2023-01-13 21:06 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230118060559.615653-9-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bpf@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.