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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E4ABC433FE for ; Mon, 7 Dec 2020 17:20:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 443E723731 for ; Mon, 7 Dec 2020 17:20:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 443E723731 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=lMdp/jckhPLQ2502T3nt25it86IUrsyAK58F3khf6+Y=; b=gXQh1eMvTPZJzPGojnI1waVJr QkrSNC5J+GGsnVl280RE8LRnNmRPpWfVx+LMwXiofWaTTWQU7yb8hHOmoL4YSSngA1cxGBUXKAWLP ULPs3duiRPdNOBG7GKog28nj5gqZS9DKY+c79vkwdWTHF1aWDG+7xgzaSHji8ASgegIIbU6brTzev 9dQ7TLwoN9VVWViuHsJ/nkrzZ46lR1noW8/M6rOCd92U4RXPI1RiIccTj3kJiw1/Fqc/61ccBjVQB VTZaoC/9MJlHGOA93tviI2gyj1DT/Zyyt2tMkzvqcVEqyIB+agQ1gvKjmxM1gi7f352vW90mJ0UQU 4Qlo0q1yg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmKAI-0000d1-GV; Mon, 07 Dec 2020 17:19:10 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmKAG-0000ck-Oa for linux-arm-kernel@merlin.infradead.org; Mon, 07 Dec 2020 17:19:08 +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=Y0PpNYb//gjLXkCRXNrypBE/8UsOassjctQPu/sz3sQ=; b=SJCwbGbC9TtTs/EWcVK0BlpSyv Yb1wdEcT/qfAPdcgWGv9uV5YahUkvZA8c01cuOP+Jait3/iSMS0o3apgW2Z+rOgv+ILbzNzJtqpFU vy3IJ361rtYIvZkVPhhXW0OwtAP0RyJiw/ZDIN3QB8gX6yFQTh8olxsIGheglSZdHar9JSZGueVa5 I41fWUcYaba52lrr0tgYb0oeIh6izAdwVQNcJTEpc9568lsM0G/fwmS1H0UQ6ngfis+1lObp1j/Sb +2tkr9RhqhgSlWKm+gAOEBqRcAfmDsH4ZnxVWRCXzpQR9vAne4gpe8pUU/ghZnilxS+MIVNfN2JAY BkatKMBA==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmKAE-00058E-7B; Mon, 07 Dec 2020 17:19:07 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 1FFEC4079D; Mon, 7 Dec 2020 14:19:14 -0300 (-03) Date: Mon, 7 Dec 2020 14:19:14 -0300 From: Arnaldo Carvalho de Melo To: John Garry Subject: Re: [PATCH v6 06/10] perf metricgroup: Fix metrics using aliases covering multiple PMUs Message-ID: <20201207171914.GC129853@kernel.org> References: <1607080216-36968-1-git-send-email-john.garry@huawei.com> <1607080216-36968-7-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1607080216-36968-7-git-send-email-john.garry@huawei.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, irogers@google.com, ak@linux.intel.com, mathieu.poirier@linaro.org, peterz@infradead.org, will@kernel.org, linuxarm@huawei.com, qiangqing.zhang@nxp.com, linux-kernel@vger.kernel.org, zhangshaokun@hisilicon.com, alexander.shishkin@linux.intel.com, kjain@linux.ibm.com, mingo@redhat.com, leo.yan@linaro.org, namhyung@kernel.org, kim.phillips@amd.com, jolsa@redhat.com, linux-arm-kernel@lists.infradead.org, kan.liang@linux.intel.com 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 Fri, Dec 04, 2020 at 07:10:12PM +0800, John Garry escreveu: > Support for metric expressions using aliases which cover multiple PMUs is > broken. Consider the following test metric expression: > > "MetricExpr": "UNC_CBO_XSNP_RESPONSE.MISS_XCORE * UNC_CBO_XSNP_RESPONSE.MISS_EVICTION" > > When used on my broadwell, "perf stat" gives: > > unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_1/umask=0x81,event=0x22/ > unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_0/umask=0x81,event=0x22/ > unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_1/umask=0x41,event=0x22/ > unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_0/umask=0x41,event=0x22/ > Control descriptor is not initialized > unc_cbo_xsnp_response.miss_eviction: 3645925 1000850523 1000850523 > unc_cbo_xsnp_response.miss_xcore: 106850 1000850523 1000850523 > > Performance counter stats for 'system wide': > > 3,645,925 unc_cbo_xsnp_response.miss_eviction # 389567086250.00 test_metric_inc > 106,850 unc_cbo_xsnp_response.miss_xcore > > 1.000883096 seconds time elapsed > > > Notice that only the results from one PMU are included. Fix the logic of > find_evsel_group() to enable events which apply to multiple PMUs, by > checking if the event pmu_name matches that of the metric event. > > With that, "perf stat" now gives: > > unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_1/umask=0x81,event=0x22/ > unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_0/umask=0x81,event=0x22/ > unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_1/umask=0x41,event=0x22/ > unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_0/umask=0x41,event=0x22/ > Control descriptor is not initialized > unc_cbo_xsnp_response.miss_eviction: 4237983 1000904100 1000904100 > unc_cbo_xsnp_response.miss_xcore: 218643 1000904100 1000904100 > unc_cbo_xsnp_response.miss_eviction: 4254148 1000902629 1000902629 > unc_cbo_xsnp_response.miss_xcore: 213352 1000902629 1000902629 > > Performance counter stats for 'system wide': > > 4,237,983 unc_cbo_xsnp_response.miss_eviction # 3668558131345.00 test_metric_inc > 218,643 unc_cbo_xsnp_response.miss_xcore > 4,254,148 unc_cbo_xsnp_response.miss_eviction > 213,352 unc_cbo_xsnp_response.miss_xcore > > 1.000938151 seconds time elapsed > Next time please try to provides a Fixes: tag to help with backporting/stable@kernel.org work. - Arnaldo > Signed-off-by: John Garry > Acked-by: Kajol Jain > --- > tools/perf/util/metricgroup.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index 81d201c8b833..b89160718c04 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -279,7 +279,9 @@ static struct evsel *find_evsel_group(struct evlist *perf_evlist, > * when then group is left. > */ > if (!has_constraint && > - ev->leader != metric_events[i]->leader) > + ev->leader != metric_events[i]->leader && > + !strcmp(ev->leader->pmu_name, > + metric_events[i]->leader->pmu_name)) > break; > if (!strcmp(metric_events[i]->name, ev->name)) { > set_bit(ev->idx, evlist_used); > -- > 2.26.2 > -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel