From: Ian Rogers <irogers@google.com>
To: John Garry <john.garry@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>, Kajol Jain <kjain@linux.ibm.com>,
Andi Kleen <ak@linux.intel.com>,
Jin Yao <yao.jin@linux.intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Kim Phillips <kim.phillips@amd.com>,
LKML <linux-kernel@vger.kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
linux-perf-users <linux-perf-users@vger.kernel.org>,
Stephane Eranian <eranian@google.com>
Subject: Re: Issue of metrics for multiple uncore PMUs (was Re: [RFC PATCH v2 23/23] perf metricgroup: remove duped metric group events)
Date: Tue, 6 Oct 2020 07:42:11 -0700 [thread overview]
Message-ID: <CAP-5=fUy6FOszNRwJF6ZNpqQSSyrnLPV6GbkEcZMqAhUp3X0ZA@mail.gmail.com> (raw)
In-Reply-To: <b621fdcb-9af5-bbc2-992a-ebfaa7888dc2@huawei.com>
On Tue, Oct 6, 2020 at 7:22 AM John Garry <john.garry@huawei.com> wrote:
>
> On 05/10/2020 19:05, John Garry wrote:
> >> Can you provide a reproduction? Looking on broadwell
> >> this metric doesn't exist.
> >
> > Right, I just added this test metric as my 2x x86 platform has no
> > examples which I can find:
> >
> > diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > index 8cdc7c13dc2a..fc6d9adf996a 100644
> > --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > @@ -348,5 +348,11 @@
> > "MetricExpr": "(cstate_pkg@c7\\-residency@ / msr@tsc@) * 100",
> > "MetricGroup": "Power",
> > "MetricName": "C7_Pkg_Residency"
> > + },
> > + {
> > + "BriefDescription": "test metric",
> > + "MetricExpr": "UNC_CBO_XSNP_RESPONSE.MISS_XCORE *
> > UNC_CBO_XSNP_RESPONSE.MISS_EVICTION",
> > + "MetricGroup": "Test",
> > + "MetricName": "test_metric_inc"
> > }
> > ]
> >
>
> It seems that the code in find_evsel_group() does not properly handle
> the scenario of event alias matching different PMUs (as I already said).
>
> So I got it working on top of "perf metricgroup: Fix uncore metric
> expressions" with the following change:
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index d948a7f910cf..6293378c019c 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -213,7 +213,8 @@ static struct evsel *find_evsel_group(struct evlist
> *perf_evlist,
> /* Ignore event if already used and merging is disabled. */
> if (metric_no_merge && test_bit(ev->idx, evlist_used))
> continue;
> - if (!has_constraint && ev->leader != current_leader) {
> + if (!has_constraint && (!current_leader ||
> strcmp(current_leader->name, ev->leader->name))) {
> /*
> * Start of a new group, discard the whole match and
> * start again.
> @@ -279,7 +280,8 @@ static struct evsel *find_evsel_group(struct evlist
> *perf_evlist,
> * when then group is left.
> */
> if (!has_constraint &&
> - ev->leader != metric_events[i]->leader)
> + strcmp(ev->leader->name, metric_events[i]->leader->name))
> break;
> if (!strcmp(metric_events[i]->name, ev->name)) {
> set_bit(ev->idx, evlist_used);
>
> which gives for my test metric:
>
> ./perf stat -v -M test_metric_inc sleep 1
> Using CPUID GenuineIntel-6-3D-4
> metric expr unc_cbo_xsnp_response.miss_xcore /
> unc_cbo_xsnp_response.miss_eviction for test_metric_inc
> found event unc_cbo_xsnp_response.miss_eviction
> found event unc_cbo_xsnp_response.miss_xcore
> adding
> {unc_cbo_xsnp_response.miss_eviction,unc_cbo_xsnp_response.miss_xcore}:W
> 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: 595175 1001021311 1001021311
> unc_cbo_xsnp_response.miss_eviction: 592516 1001020037 1001020037
> unc_cbo_xsnp_response.miss_xcore: 39139 1001021311 1001021311
> unc_cbo_xsnp_response.miss_xcore: 38718 1001020037 1001020037
>
> Performance counter stats for 'system wide':
>
> 1,187,691 unc_cbo_xsnp_response.miss_eviction # 0.07
> test_metric_inc
> 77,857 unc_cbo_xsnp_response.miss_xcore
>
>
> 1.001068918 seconds time elapsed
>
> John
Thanks John! I was able to repro the problem, let me investigate what
is happening here as it seems there may be something wrong with the
grouping logic.
Ian
prev parent reply other threads:[~2020-10-06 14:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 14:07 [RFC PATCH v2 00/23] Share events between metrics Ian Rogers
2020-05-07 14:07 ` [RFC PATCH v2 01/23] perf expr: unlimited escaped characters in a symbol Ian Rogers
2020-05-07 14:07 ` [RFC PATCH v2 02/23] perf metrics: fix parse errors in cascade lake metrics Ian Rogers
2020-05-07 14:07 ` [RFC PATCH v2 03/23] perf metrics: fix parse errors in skylake metrics Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 04/23] perf expr: allow ',' to be an other token Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 05/23] perf expr: increase max other Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 06/23] perf expr: parse numbers as doubles Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 07/23] perf expr: debug lex if debugging yacc Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 08/23] perf metrics: fix parse errors in power8 metrics Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 09/23] perf metrics: fix parse errors in power9 metrics Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 10/23] perf expr: print a debug message for division by zero Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 11/23] perf parse-events: expand add PMU error/verbose messages Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 12/23] perf test: improve pmu event metric testing Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 13/23] lib/bpf hashmap: increase portability Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 14/23] libbpf: Fix memory leak and possible double-free in hashmap__clear Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 15/23] perf expr: fix memory leaks in bison Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 16/23] perf evsel: fix 2 memory leaks Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 17/23] perf expr: migrate expr ids table to libbpf's hashmap Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 18/23] perf metricgroup: change evlist_used to a bitmap Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 19/23] perf metricgroup: free metric_events on error Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 20/23] perf metricgroup: always place duration_time last Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 21/23] perf metricgroup: delay events string creation Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 22/23] perf metricgroup: order event groups by size Ian Rogers
2020-05-07 14:08 ` [RFC PATCH v2 23/23] perf metricgroup: remove duped metric group events Ian Rogers
2020-10-02 11:57 ` Issue of metrics for multiple uncore PMUs (was Re: [RFC PATCH v2 23/23] perf metricgroup: remove duped metric group events) John Garry
2020-10-02 20:46 ` Ian Rogers
2020-10-05 10:03 ` John Garry
2020-10-05 16:28 ` Ian Rogers
2020-10-05 18:05 ` John Garry
2020-10-06 14:19 ` John Garry
2020-10-06 14:42 ` Ian Rogers [this message]
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='CAP-5=fUy6FOszNRwJF6ZNpqQSSyrnLPV6GbkEcZMqAhUp3X0ZA@mail.gmail.com' \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eranian@google.com \
--cc=john.fastabend@gmail.com \
--cc=john.garry@huawei.com \
--cc=jolsa@redhat.com \
--cc=kafai@fb.com \
--cc=kan.liang@linux.intel.com \
--cc=kim.phillips@amd.com \
--cc=kjain@linux.ibm.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=xiyou.wangcong@gmail.com \
--cc=yao.jin@linux.intel.com \
--cc=yhs@fb.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).