perf arm-spe: Correct sample flags for SPE event
authorLeo Yan <leo.yan@linaro.org>
Wed, 19 May 2021 04:15:43 +0000 (12:15 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 May 2021 12:48:31 +0000 (09:48 -0300)
Now it's hard code to set sample flags for CPU, TIME and TID for SPE
event, which is pointless.

The CPU is useful for sampling only for per-mmap case, it is used to
indicate the AUX trace is associated to which CPU.

The TIME sample is not needed for AUX event, since the time for AUX
event is not really used and this time is a different thing from the
timestamp in Arm SPE trace, the timestamp tracing which is controlled
by Arm SPE's config bit.

The TID sample is not useful for AUX event.

This patch corrects the sample flags for SPE event, it only set CPU
sample bit for per-cpu mmap case.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: James Clark <james.clark@arm.com>
Tested-by: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Al Grant <Al.Grant@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20210519041546.1574961-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/arm64/util/arm-spe.c

index 414c8a5584b13a68774cb18dcf958eb7722e29e4..902e73a64184cbf4eed5b2e8cd8f2cdd082f8285 100644 (file)
@@ -68,6 +68,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
                        container_of(itr, struct arm_spe_recording, itr);
        struct perf_pmu *arm_spe_pmu = sper->arm_spe_pmu;
        struct evsel *evsel, *arm_spe_evsel = NULL;
+       struct perf_cpu_map *cpus = evlist->core.cpus;
        bool privileged = perf_event_paranoid_check(-1);
        struct evsel *tracking_evsel;
        int err;
@@ -120,9 +121,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
         */
        evlist__to_front(evlist, arm_spe_evsel);
 
-       evsel__set_sample_bit(arm_spe_evsel, CPU);
-       evsel__set_sample_bit(arm_spe_evsel, TIME);
-       evsel__set_sample_bit(arm_spe_evsel, TID);
+       /* In the case of per-cpu mmaps, sample CPU for AUX event. */
+       if (!perf_cpu_map__empty(cpus))
+               evsel__set_sample_bit(arm_spe_evsel, CPU);
 
        /* Add dummy event to keep tracking */
        err = parse_events(evlist, "dummy:u", NULL);