[PATCH v2 6/7] perf tools: arm-spe: fix record hang after being terminated

From: James Clark
Date: Thu Jan 23 2020 - 11:08:44 EST


From: Wei Li <liwei391@xxxxxxxxxx>

If the spe event is terminated, we don't enable it again here.

Signed-off-by: Wei Li <liwei391@xxxxxxxxxx>
Tested-by: Qi Liu <liuqi115@xxxxxxxxxxxxx>
Signed-off-by: James Clark <james.clark@xxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Tan Xiaojun <tanxiaojun@xxxxxxxxxx>
Cc: Al Grant <al.grant@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/arch/arm64/util/arm-spe.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index eba6541ec0f1..629badda724d 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -165,9 +165,13 @@ static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
struct evsel *evsel;

evlist__for_each_entry(sper->evlist, evsel) {
- if (evsel->core.attr.type == sper->arm_spe_pmu->type)
- return perf_evlist__enable_event_idx(sper->evlist,
- evsel, idx);
+ if (evsel->core.attr.type == sper->arm_spe_pmu->type) {
+ if (evsel->terminated)
+ return 0;
+ else
+ return perf_evlist__enable_event_idx(
+ sper->evlist, evsel, idx);
+ }
}
return -EINVAL;
}
--
2.25.0