From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
Song Liu <songliubraving@fb.com>, Hao Luo <haoluo@google.com>,
Milian Wolff <milian.wolff@kdab.com>,
bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
Blake Jones <blakejones@google.com>
Subject: [PATCH 1/4] perf report: Do not extend sample type of bpf-output event
Date: Fri, 6 May 2022 13:16:24 -0700 [thread overview]
Message-ID: <20220506201627.85598-2-namhyung@kernel.org> (raw)
In-Reply-To: <20220506201627.85598-1-namhyung@kernel.org>
Currently evsel__new_idx() sets more sample_type bits when it finds a
BPF-output event. But it should honor what's recorded in the perf
data file rather than blindly sets the bits. Otherwise it could lead
to a parse error when it recorded with a modified sample_type.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/evsel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d38722560e80..63a8b832b822 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -269,8 +269,8 @@ struct evsel *evsel__new_idx(struct perf_event_attr *attr, int idx)
return NULL;
evsel__init(evsel, attr, idx);
- if (evsel__is_bpf_output(evsel)) {
- evsel->core.attr.sample_type |= (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
+ if (evsel__is_bpf_output(evsel) && !attr->sample_type) {
+ evsel->core.attr.sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD),
evsel->core.attr.sample_period = 1;
}
--
2.36.0.512.ge40c2bad7a-goog
next prev parent reply other threads:[~2022-05-06 20:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 20:16 [RFC 0/4] perf record: Implement off-cpu profiling with BPF (v2) Namhyung Kim
2022-05-06 20:16 ` Namhyung Kim [this message]
2022-05-10 16:49 ` [PATCH 1/4] perf report: Do not extend sample type of bpf-output event Arnaldo Carvalho de Melo
2022-05-12 6:00 ` Namhyung Kim
2022-05-06 20:16 ` [PATCH 2/4] perf record: Enable off-cpu analysis with BPF Namhyung Kim
2022-05-10 17:02 ` Arnaldo Carvalho de Melo
2022-05-12 6:13 ` Namhyung Kim
2022-05-06 20:16 ` [PATCH 3/4] perf record: Implement basic filtering for off-cpu Namhyung Kim
2022-05-06 20:16 ` [PATCH 4/4] perf record: Handle argument change in sched_switch Namhyung Kim
-- strict thread matches above, loose matches on Subject: below --
2022-04-22 15:05 [RFC RESEND 0/4] perf record: Implement off-cpu profiling with BPF (v1) Namhyung Kim
2022-04-22 15:05 ` [PATCH 1/4] perf report: Do not extend sample type of bpf-output event Namhyung Kim
2022-04-22 5:33 [RFC 0/4] perf record: Implement off-cpu profiling with BPF (v1) Namhyung Kim
2022-04-22 5:33 ` [PATCH 1/4] perf report: Do not extend sample type of bpf-output event Namhyung Kim
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=20220506201627.85598-2-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=blakejones@google.com \
--cc=bpf@vger.kernel.org \
--cc=haoluo@google.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).