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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A57AC433EF for ; Wed, 8 Dec 2021 12:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233780AbhLHMyT (ORCPT ); Wed, 8 Dec 2021 07:54:19 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:4232 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233750AbhLHMyT (ORCPT ); Wed, 8 Dec 2021 07:54:19 -0500 Received: from fraeml737-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4J8H3W3mtnz67nPb; Wed, 8 Dec 2021 20:46:31 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml737-chm.china.huawei.com (10.206.15.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 8 Dec 2021 13:50:45 +0100 Received: from [10.47.91.245] (10.47.91.245) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 8 Dec 2021 12:50:43 +0000 Subject: Re: [PATCH 02/22] perf stat: Add aggr creators that are passed a cpu. To: Ian Rogers , Andi Kleen , "Jiri Olsa" , Namhyung Kim , Kajol Jain , "Paul A . Clarke" , "Arnaldo Carvalho de Melo" , Riccardo Mancini , Kan Liang , Peter Zijlstra , "Ingo Molnar" , Mark Rutland , "Alexander Shishkin" , , , "Vineet Singh" , James Clark , "Mathieu Poirier" , Suzuki K Poulose , Mike Leach , Leo Yan , , CC: References: <20211208024607.1784932-1-irogers@google.com> <20211208024607.1784932-3-irogers@google.com> From: John Garry Message-ID: Date: Wed, 8 Dec 2021 12:50:24 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20211208024607.1784932-3-irogers@google.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.91.245] X-ClientProxiedBy: lhreml724-chm.china.huawei.com (10.201.108.75) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/12/2021 02:45, Ian Rogers wrote: > The cpu_map and index can get confused. Add variants of the cpu_map__get > routines that are passed a cpu. Make the existing cpu_map__get routines > use the new functions with a view to remove them when no longer used. > > Signed-off-by: Ian Rogers > --- > tools/perf/util/cpumap.c | 79 +++++++++++++++++++++++----------------- > tools/perf/util/cpumap.h | 6 ++- > 2 files changed, 51 insertions(+), 34 deletions(-) > > diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c > index 87d3eca9b872..49fba2c53822 100644 > --- a/tools/perf/util/cpumap.c > +++ b/tools/perf/util/cpumap.c > @@ -128,21 +128,23 @@ int cpu_map__get_socket_id(int cpu) > return ret ?: value; > } > > -struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx, > - void *data __maybe_unused) > +struct aggr_cpu_id cpu_map__get_socket_aggr_by_cpu(int cpu, void *data __maybe_unused) > { > - int cpu; > struct aggr_cpu_id id = cpu_map__empty_aggr_cpu_id(); > > - if (idx > map->nr) > - return id; > - > - cpu = map->map[idx]; > - > id.socket = cpu_map__get_socket_id(cpu); > return id; > } > > +struct aggr_cpu_id cpu_map__get_socket(struct perf_cpu_map *map, int idx, This is code added in this patch - so is "idx" a cpu map index? that's what the commit message implies. regardless of this - you add code here and then remove it later in the series. Can you arrange the series such that any code added in the series is not removed (later in that series)? That's a general practice we adhere to. Thanks, John