Skip to content

Commit bd3c628

Browse files
stkidacmel
authored andcommitted
perf tools: Fix record failure when mixed with ARM SPE event
When recording with cache-misses and arm_spe_x event, I found that it will just fail without showing any error info if i put cache-misses after 'arm_spe_x' event. [root@localhost 0620]# perf record -e cache-misses \ -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.067 MB perf.data ] [root@localhost 0620]# [root@localhost 0620]# perf record -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ \ -e cache-misses sleep 1 [root@localhost 0620]# The current code can only work if the only event to be traced is an 'arm_spe_x', or if it is the last event to be specified. Otherwise the last event type will be checked against all the arm_spe_pmus[i]->types, none will match and an out of bound 'i' index will be used in arm_spe_recording_init(). We don't support concurrent multiple arm_spe_x events currently, that is checked in arm_spe_recording_options(), and it will show the relevant info. So add the check and record of the first found 'arm_spe_pmu' to fix this issue here. Fixes: ffd3d18 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support") Signed-off-by: Wei Li <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Tested-by-by: Leo Yan <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 463538a commit bd3c628

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/perf/arch/arm/util/auxtrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct auxtrace_record
5656
struct perf_pmu *cs_etm_pmu;
5757
struct evsel *evsel;
5858
bool found_etm = false;
59-
bool found_spe = false;
59+
struct perf_pmu *found_spe = NULL;
6060
static struct perf_pmu **arm_spe_pmus = NULL;
6161
static int nr_spes = 0;
6262
int i = 0;
@@ -74,12 +74,12 @@ struct auxtrace_record
7474
evsel->core.attr.type == cs_etm_pmu->type)
7575
found_etm = true;
7676

77-
if (!nr_spes)
77+
if (!nr_spes || found_spe)
7878
continue;
7979

8080
for (i = 0; i < nr_spes; i++) {
8181
if (evsel->core.attr.type == arm_spe_pmus[i]->type) {
82-
found_spe = true;
82+
found_spe = arm_spe_pmus[i];
8383
break;
8484
}
8585
}
@@ -96,7 +96,7 @@ struct auxtrace_record
9696

9797
#if defined(__aarch64__)
9898
if (found_spe)
99-
return arm_spe_recording_init(err, arm_spe_pmus[i]);
99+
return arm_spe_recording_init(err, found_spe);
100100
#endif
101101

102102
/*

0 commit comments

Comments
 (0)