From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E317C433F5 for ; Mon, 28 Mar 2022 20:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aGtB8BOFq4d0rh44FlZMvERP6R//3J441G0EC50ZMBA=; b=Hj5mmbKCzgk2gg dfgLdmbR/q8zyRg5TaaTtR9+2YL+skXIu2qG27cPD7UUW/nly424y92QAMgyV4dBcMbiYhKiCs64C WqHintNiWI+0nx3eV9MlXYbpghDIr0t1FetrXW+vElmax1kiv7Avgf6rArixRIgTeJEcHANnSDT21 P8fljKvVuRuiUj4QL7rS/8ph2ReN9na4nCqMC/jHxnK3LN38yf/Rny5mNgkzdE3ymLmvqDc33DbIl oRVNNnNr10WaewtY7x0rkGjeiGU5q8w33Km5zi8LPWr+ozSQ2WsiSEzPzHk0FPp2kAuBU3FCRPFqe aaYgKrIGhAnk3SikhuJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYw2W-00A5KU-QP; Mon, 28 Mar 2022 20:32:36 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYw2V-00A5K5-5V for linux-arm-kernel@bombadil.infradead.org; Mon, 28 Mar 2022 20:32:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5ayH9VdoRfyFRRCkwUFoqk1o0EvYeUpE6zCj/jfIqkc=; b=rhKKZv3/WF38YpfT5LnVFYC7o9 13yY1bpAQ0nXzUO7u1rWh06sOYSof8d5GfbYDRkw7PXmpo/YTuWyiTMY5xI260ZfPl+9FDPdTG+9z uSTF3X3IKZYBajk3lRT+NVIoIfKZoCqIhpjqMS52ao1XniqPO2iwVVdKneaJYj9BuK37SmH0zWm8s fA+PJGEvbgnvoBgoagysk77FAVVngLtdwjNhTm+byey3DwCgpY7KHEZvg2xGuhkS6kvnYqZaBmIwX 5CMleJq2M6Loj9CPJoa7AihsDmXO1VkQssDu0t/NCaYiSYM9R/LdlzMC9jJHWy/f8JmTKFn4Bc3WL t+04Sdaw==; Received: from [187.19.239.165] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYw2T-00HFF7-Lw; Mon, 28 Mar 2022 20:32:33 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3A55E40407; Mon, 28 Mar 2022 17:32:31 -0300 (-03) Date: Mon, 28 Mar 2022 17:32:31 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Kajol Jain , James Clark , German Gomez , Adrian Hunter , Riccardo Mancini , Andi Kleen , Alexey Bayduraev , Alexander Antonov , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH 4/5] perf stat: Avoid segv if core.user_cpus isn't set. Message-ID: References: <20220328062414.1893550-1-irogers@google.com> <20220328062414.1893550-5-irogers@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220328062414.1893550-5-irogers@google.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel