linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: John Garry <john.garry@huawei.com>
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
Subject: Re: [PATCH v6 06/10] perf metricgroup: Fix metrics using aliases covering multiple PMUs
Date: Mon, 7 Dec 2020 14:19:14 -0300	[thread overview]
Message-ID: <20201207171914.GC129853@kernel.org> (raw)
In-Reply-To: <1607080216-36968-7-git-send-email-john.garry@huawei.com>

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 <john.garry@huawei.com>
> Acked-by: Kajol Jain <kjain@linux.ibm.com>
> ---
>  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

  reply	other threads:[~2020-12-07 17:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 11:10 [PATCH v6 00/10] perf pmu-events: Support event aliasing for system PMUs John Garry
2020-12-04 11:10 ` [PATCH v6 01/10] perf jevents: Add support for an extra directory level John Garry
2020-12-04 11:10 ` [PATCH v6 02/10] perf jevents: Add support for system events tables John Garry
2020-12-04 11:10 ` [PATCH v6 03/10] perf pmu: Add pmu_id() John Garry
2020-12-04 11:10 ` [PATCH v6 04/10] perf pmu: Add pmu_add_sys_aliases() John Garry
2020-12-04 11:10 ` [PATCH v6 05/10] perf evlist: Change perf_evlist__splice_list_tail() ordering John Garry
2020-12-04 11:10 ` [PATCH v6 06/10] perf metricgroup: Fix metrics using aliases covering multiple PMUs John Garry
2020-12-07 17:19   ` Arnaldo Carvalho de Melo [this message]
2020-12-07 18:02     ` John Garry
2020-12-04 11:10 ` [PATCH v6 07/10] perf metricgroup: Split up metricgroup__print() John Garry
2020-12-04 11:10 ` [PATCH v6 08/10] perf metricgroup: Support printing metric groups for system PMUs John Garry
2020-12-07 17:23   ` Arnaldo Carvalho de Melo
2020-12-07 18:04     ` John Garry
2020-12-04 11:10 ` [PATCH v6 09/10] perf metricgroup: Support adding metrics " John Garry
2020-12-04 11:10 ` [PATCH v6 10/10] perf vendor events: Add JSON metrics for imx8mm DDR Perf John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201207171914.GC129853@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kim.phillips@amd.com \
    --cc=kjain@linux.ibm.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qiangqing.zhang@nxp.com \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).