[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YkIbXzCYEutqxQRE@kernel.org>
Date: Mon, 28 Mar 2022 17:32:31 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...aro.org>,
John Garry <john.garry@...wei.com>,
Will Deacon <will@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Kajol Jain <kjain@...ux.ibm.com>,
James Clark <james.clark@....com>,
German Gomez <german.gomez@....com>,
Adrian Hunter <adrian.hunter@...el.com>,
Riccardo Mancini <rickyman7@...il.com>,
Andi Kleen <ak@...ux.intel.com>,
Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
Alexander Antonov <alexander.antonov@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
netdev@...r.kernel.org, bpf@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 4/5] perf stat: Avoid segv if core.user_cpus isn't set.
Em Sun, Mar 27, 2022 at 11:24:13PM -0700, Ian Rogers escreveu:
> Passing null to perf_cpu_map__max doesn't make sense as there is no
> valid max. Avoid this problem by null checking in
> perf_stat_init_aggr_mode.
Applying this one after changing user_cpus back to cpus as this is a fix
independent of this patchset.
In the future, please try to have such patches at the beginning of the
series, so that they can get cherry-picked more easily.
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/builtin-stat.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 5bee529f7656..ecd5cf4fd872 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -1472,7 +1472,10 @@ static int perf_stat_init_aggr_mode(void)
> * taking the highest cpu number to be the size of
> * the aggregation translate cpumap.
> */
> - nr = perf_cpu_map__max(evsel_list->core.user_cpus).cpu;
> + if (evsel_list->core.user_cpus)
> + nr = perf_cpu_map__max(evsel_list->core.user_cpus).cpu;
> + else
> + nr = 0;
> stat_config.cpus_aggr_map = cpu_aggr_map__empty_new(nr + 1);
> return stat_config.cpus_aggr_map ? 0 : -ENOMEM;
> }
> --
> 2.35.1.1021.g381101b075-goog
--
- Arnaldo
Powered by blists - more mailing lists