Skip to content

Commit 7599b70

Browse files
timothy-hayesacmel
authored andcommitted
perf arm-spe: Fix SPE events with phys addresses
This patch corrects a bug whereby SPE collection is invoked with pa_enable=1 but synthesized events fail to show physical addresses. Reviewed-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Fastabend <john.fastabend@gmail.com> Cc: John Garry <john.garry@huawei.com> Cc: KP Singh <kpsingh@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Martin KaFai Lau <kafai@fb.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Song Liu <songliubraving@fb.com> Cc: Will Deacon <will@kernel.org> Cc: Yonghong Song <yhs@fb.com> Cc: bpf@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: netdev@vger.kernel.org Link: https://lore.kernel.org/r/20220421165205.117662-3-timothy.hayes@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4e13f67 commit 7599b70

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

tools/perf/arch/arm64/util/arm-spe.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
148148
bool privileged = perf_event_paranoid_check(-1);
149149
struct evsel *tracking_evsel;
150150
int err;
151+
u64 bit;
151152

152153
sper->evlist = evlist;
153154

@@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
245246
*/
246247
evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
247248

249+
/*
250+
* The PHYS_ADDR flag does not affect the driver behaviour, it is used to
251+
* inform that the resulting output's SPE samples contain physical addresses
252+
* where applicable.
253+
*/
254+
bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
255+
if (arm_spe_evsel->core.attr.config & bit)
256+
evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
257+
248258
/* Add dummy event to keep tracking */
249259
err = parse_events(evlist, "dummy:u", NULL);
250260
if (err)

tools/perf/util/arm-spe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
10331033
memset(&attr, 0, sizeof(struct perf_event_attr));
10341034
attr.size = sizeof(struct perf_event_attr);
10351035
attr.type = PERF_TYPE_HARDWARE;
1036-
attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
1036+
attr.sample_type = evsel->core.attr.sample_type &
1037+
(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
10371038
attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
10381039
PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
10391040
PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;

0 commit comments

Comments
 (0)