Re: [PATCH] perf tools: Fix bug when recording SPE and non SPE events

From: Suzuki Kuruppassery Poulose
Date: Mon Jan 13 2020 - 07:28:17 EST


On 20/12/2019 11:05, James Clark wrote:
This patch fixes an issue when non Arm SPE events are specified after an
Arm SPE event. In that case, perf will exit with an error code and not
produce a record file. This is because a loop index is used to store the
location of the relevant Arm SPE PMU, but if non SPE PMUs follow, that
index will be overwritten. Fix this issue by saving the PMU into a
variable instead of using the index, and also add an error message.

Before the fix:
./perf record -e arm_spe/ts_enable=1/ -e branch-misses ls; echo $?
237

After the fix:
./perf record -e arm_spe/ts_enable=1/ -e branch-misses ls; echo $?
...
0

Signed-off-by: James Clark <james.clark@xxxxxxx>
Cc: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Cc: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Igor Lubashev <ilubashe@xxxxxxxxxx>

Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>