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 BE2FDC433EF for ; Sat, 11 Dec 2021 19:26:36 +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=cwGF7rnGdz9P/Hm7S3+lg5HKNf/QL/KmmT6hdsR3vTw=; b=QMVpeFYn6XuGZo yXt/mIytMEKoYFgZMZuhz0JssCRiuCtgLIaz+tgULhYCs0hOygqSfd1dHpT2VJl+et1aIv24Z83gV NB+vWeFFAP/SXeHgJ5rvS9PBETzbSDtNNaLa7FvM9ZAHah0bOOWnRNW5pAYLMPzH42/XH+m/awy5A 5NRfcP/V3hHT3RNGWLVA+rq7DITzZ+VoinNMKLRtk+e0NON41vbTZve0hEJozsI//vMI2LS9CX7jJ 1Nu//rvAKzoZTIW+oPF4vEnA5QOVK32nr9bPsEeIvGGdCS64g/Fcj7j+VRWQklMiAJVrRFA6CQedO c9HIlvgkVVERVPqdokUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mw7zY-005RMU-D7; Sat, 11 Dec 2021 19:25:08 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mw7zT-005RLH-Gg for linux-arm-kernel@lists.infradead.org; Sat, 11 Dec 2021 19:25:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639250701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bCtUaBAOzyXY3KXXR3aZzZQ4AfKFricrW8TE0Pl7r9c=; b=hGtv9BbLv5MuBVmM4x0I63xXv46a9ES6cV2d7n9+/BpBfurZauNvf2IFKM6RFxpAqyQPzA xJEQjSnWaqU29l/bwTdrNfum2JcwEg88hC9veOE466lngkP4Kqhvkay7isth8YPPKQFZW0 NoFYtatgc3frEXm/5yHiXniZ/Z7R6hs= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-409-15b8_rnCMYuZhBTPOZqwtg-1; Sat, 11 Dec 2021 14:24:58 -0500 X-MC-Unique: 15b8_rnCMYuZhBTPOZqwtg-1 Received: by mail-wm1-f72.google.com with SMTP id a85-20020a1c7f58000000b0033ddc0eacc8so8864113wmd.9 for ; Sat, 11 Dec 2021 11:24:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bCtUaBAOzyXY3KXXR3aZzZQ4AfKFricrW8TE0Pl7r9c=; b=hYpBJT812pKKgO2jxD/z9QmW6F8j6JiWhVS5s2gzNMsolMa/k2ZMoxPFZcY5CYlzPM EvpJGe2XVh+/sdLIeE1AtzMWg1ZQpkn/YcwujRhhoIq7HctK2IbTn2a8OyDtHYhlaPZo WQzVKzlpPwjrT6fBjnwQ1zRVdqeX0X2pI2QcMBOP7OBce97zBJKczill58VcZHcnAv99 JU0/IXkfIO66PPdVoFi52U75KcJWycUOFzZKEuF02mtzqMODqgZEX9TCI1KdQdxNtoDL CDojo6rkZpYsdiqOpKMur3shQ8gYS5tGtF1DRx7K8f6enxjclHT2t7pFbaJFJMewLgM/ qR7w== X-Gm-Message-State: AOAM531jrMM7J++P66wRgkTuqnj3PIueS5UZLKn0R8abYJlu0jvTRW04 Dy8j4c0cvakm0JHp2hJjChtdyDGFZDUhAWirQAuFLMfXBEbn9wkX88VEVBu3eKJK4dxCS7+p/JY RwCgCEQqWLilX92lPACEGLN88BGnFOsesQAM= X-Received: by 2002:a5d:4107:: with SMTP id l7mr21737555wrp.209.1639250697296; Sat, 11 Dec 2021 11:24:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9I/tj/f+gGo2zMIx5mkdqIEGB0qOPQDR8i8T0zr5AELbrNeig84rZPb11rSNDGxbEebTbqw== X-Received: by 2002:a5d:4107:: with SMTP id l7mr21737534wrp.209.1639250697085; Sat, 11 Dec 2021 11:24:57 -0800 (PST) Received: from krava (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id bg34sm2228709wmb.47.2021.12.11.11.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Dec 2021 11:24:56 -0800 (PST) Date: Sat, 11 Dec 2021 20:24:54 +0100 From: Jiri Olsa To: Ian Rogers Cc: Andi Kleen , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, eranian@google.com Subject: Re: [PATCH 03/22] perf stat: Switch aggregation to use for_each loop Message-ID: References: <20211208024607.1784932-1-irogers@google.com> <20211208024607.1784932-4-irogers@google.com> MIME-Version: 1.0 In-Reply-To: <20211208024607.1784932-4-irogers@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211211_112503_888976_299A010C X-CRM114-Status: GOOD ( 25.83 ) 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 On Tue, Dec 07, 2021 at 06:45:48PM -0800, Ian Rogers wrote: > Tidy up the use of cpu and index to hopefully make the code less error > prone. Avoid unused warnings with (void) which will be removed in a > later patch. > > In aggr_update_shadow, the perf_cpu_map is switched from > the evlist to the counter's cpu map, so the index is appropriate. This > addresses a problem where uncore counts, with a cpumap like: > $ cat /sys/devices/uncore_imc_0/cpumask > 0,18 > Don't aggregate counts in CPUs based on the index of those values in the > cpumap (0 and 1) but on the actual CPU (0 and 18). Thereby correcting > metric calculations in per-socket mode for counters with without a full > cpumask. > > Signed-off-by: Ian Rogers > --- > tools/perf/util/stat-display.c | 48 +++++++++++++++++++--------------- > 1 file changed, 27 insertions(+), 21 deletions(-) > > diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c > index 588601000f3f..efab39a759ff 100644 > --- a/tools/perf/util/stat-display.c > +++ b/tools/perf/util/stat-display.c > @@ -330,8 +330,8 @@ static void print_metric_header(struct perf_stat_config *config, > static int first_shadow_cpu(struct perf_stat_config *config, > struct evsel *evsel, struct aggr_cpu_id id) > { > - struct evlist *evlist = evsel->evlist; > - int i; > + struct perf_cpu_map *cpus; > + int cpu, idx; > > if (config->aggr_mode == AGGR_NONE) > return id.core; > @@ -339,14 +339,11 @@ static int first_shadow_cpu(struct perf_stat_config *config, > if (!config->aggr_get_id) > return 0; > > - for (i = 0; i < evsel__nr_cpus(evsel); i++) { > - int cpu2 = evsel__cpus(evsel)->map[i]; > - > - if (cpu_map__compare_aggr_cpu_id( > - config->aggr_get_id(config, evlist->core.cpus, cpu2), > - id)) { > - return cpu2; > - } > + cpus = evsel__cpus(evsel); > + perf_cpu_map__for_each_cpu(cpu, idx, cpus) { > + if (cpu_map__compare_aggr_cpu_id(config->aggr_get_id(config, cpus, idx), > + id)) > + return cpu; so this looks strange, you pass idx instead of cpu2 to aggr_get_id, which takes idx as 3rd argument, so it looks like it was broken now, should this be a separate fix? also the original code for some reason passed evlist->core.cpus to aggr_get_id, which might differ rom evsel's cpus same for aggr_update_shadow change jirka _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel