]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf stat: Don't size aggregation ids from user_requested_cpus
authorIan Rogers <irogers@google.com>
Sat, 19 Jul 2025 03:05:05 +0000 (20:05 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 24 Jul 2025 20:41:34 +0000 (13:41 -0700)
As evsels may have additional CPU terms, the user_requested_cpus may
not reflect all the CPUs requested. Use evlist->all_cpus to size the
array as that reflects all the CPUs potentially needed by the evlist.

Reviewed-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250719030517.1990983-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-stat.c

index 73b4521ab8af2afc3bb76244382ad9c9bc8d6c11..00fce828cd5e6235a0e52798017ccdf4696b9959 100644 (file)
@@ -1513,11 +1513,8 @@ static int perf_stat_init_aggr_mode(void)
         * taking the highest cpu number to be the size of
         * the aggregation translate cpumap.
         */
-       if (!perf_cpu_map__is_any_cpu_or_is_empty(evsel_list->core.user_requested_cpus))
-               nr = perf_cpu_map__max(evsel_list->core.user_requested_cpus).cpu;
-       else
-               nr = 0;
-       stat_config.cpus_aggr_map = cpu_aggr_map__empty_new(nr + 1);
+       nr = perf_cpu_map__max(evsel_list->core.all_cpus).cpu + 1;
+       stat_config.cpus_aggr_map = cpu_aggr_map__empty_new(nr);
        return stat_config.cpus_aggr_map ? 0 : -ENOMEM;
 }