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 <[email protected]> Signed-off-by: Timothy Hayes <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Fastabend <[email protected]> Cc: John Garry <[email protected]> Cc: KP Singh <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Song Liu <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yonghong Song <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 4e13f67 commit 7599b70

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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)