]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf tools arm-spe: Don't allocate buffer or tracking event in discard mode
authorJames Clark <james.clark@linaro.org>
Wed, 8 Jan 2025 14:28:59 +0000 (14:28 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Jan 2025 14:45:03 +0000 (11:45 -0300)
The buffer will never be written to so don't bother allocating it. The
tracking event is also not required.

Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Graham Woodward <graham.woodward@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20250108142904.401139-5-james.clark@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/arm64/util/arm-spe.c

index 1b543855f2066b1ffd3cd317c4a5b55c75f3a504..4301181b8e45050a6e5763c3e4511218b6b28b22 100644 (file)
@@ -376,7 +376,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
                        container_of(itr, struct arm_spe_recording, itr);
        struct evsel *evsel, *tmp;
        struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
-
+       bool discard = false;
        int err;
 
        sper->evlist = evlist;
@@ -396,10 +396,17 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
                return 0;
 
        evlist__for_each_entry_safe(evlist, tmp, evsel) {
-               if (evsel__is_aux_event(evsel))
+               if (evsel__is_aux_event(evsel)) {
                        arm_spe_setup_evsel(evsel, cpus);
+                       if (evsel->core.attr.config &
+                           perf_pmu__format_bits(evsel->pmu, "discard"))
+                               discard = true;
+               }
        }
 
+       if (discard)
+               return 0;
+
        err = arm_spe_setup_aux_buffer(opts);
        if (err)
                return err;