[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB8PR04MB67957F13AE831ECC67EFFD7BE6A30@DB8PR04MB6795.eurprd04.prod.outlook.com>
Date: Tue, 19 Jan 2021 10:56:46 +0000
From: Joakim Zhang <qiangqing.zhang@....com>
To: John Garry <john.garry@...wei.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"acme@...nel.org" <acme@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com"
<alexander.shishkin@...ux.intel.com>,
"jolsa@...hat.com" <jolsa@...hat.com>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"irogers@...gle.com" <irogers@...gle.com>,
"kjain@...ux.ibm.com" <kjain@...ux.ibm.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxarm@...neuler.org" <linuxarm@...neuler.org>
Subject: RE: [PATCH] perf metricgroup: Fix system PMU metrics
> -----Original Message-----
> From: John Garry <john.garry@...wei.com>
> Sent: 2021年1月19日 18:04
> To: peterz@...radead.org; mingo@...hat.com; acme@...nel.org;
> mark.rutland@....com; alexander.shishkin@...ux.intel.com;
> jolsa@...hat.com; namhyung@...nel.org; irogers@...gle.com;
> kjain@...ux.ibm.com
> Cc: linux-kernel@...r.kernel.org; linuxarm@...neuler.org; Joakim Zhang
> <qiangqing.zhang@....com>; John Garry <john.garry@...wei.com>
> Subject: [PATCH] perf metricgroup: Fix system PMU metrics
>
> Joakim reports that getting "perf stat" for multiple system PMU metrics
> segfaults:
> ./perf stat -a -I 1000 -M imx8mm_ddr_write.all,imx8mm_ddr_write.all
> Segmentation fault
>
> While the same works without issue for a single metric.
>
> The logic in metricgroup__add_metric_sys_event_iter() is broken, in that
> add_metric() @m argument should be NULL for each new metric. Fix by not
> passing a holder for that, and rather make local in
> metricgroup__add_metric_sys_event_iter().
>
> Fixes: be335ec28efa ("perf metricgroup: Support adding metrics for system
> PMUs")
> Reported-by: Joakim Zhang <qiangqing.zhang@....com>
> Signed-off-by: John Garry <john.garry@...wei.com>
root@...8mmevk:~# ./perf stat -a -I 1000 -M imx8mm_ddr_read.all,imx8mm_ddr_write .all
# time counts unit events
1.001446500 40832 imx8mm_ddr.read_cycles # 638.0 KB imx8mm_ddr_read.all
1.001446500 16973 imx8mm_ddr.write_cycles # 265.2 KB imx8mm_ddr_write.all
2.003150250 28836 imx8mm_ddr.read_cycles # 450.6 KB imx8mm_ddr_read.all
2.003150250 6705 imx8mm_ddr.write_cycles # 104.8 KB imx8mm_ddr_write.all
For this issue, Tested-by: Joakim Zhang <qiangqing.zhang@....com>
Hi John,
It seems have other issue compared to 5.10 kernel after switching to this framework, below metric can't work.
"MetricExpr": "(( imx8_ddr0@...d\\-cycles@ + imx8_ddr0@...te\\-cycles@ ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"
After change to:
"MetricExpr": "(( imx8mm_ddr.read_cycles + imx8mm_ddr.write_cycles ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)",
Best Regards,
Joakim Zhang
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index
> ee94d3e8dd65..2e60ee170abc 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -766,7 +766,6 @@ int __weak arch_get_runtimeparam(struct pmu_event
> *pe __maybe_unused) struct metricgroup_add_iter_data {
> struct list_head *metric_list;
> const char *metric;
> - struct metric **m;
> struct expr_ids *ids;
> int *ret;
> bool *has_match;
> @@ -1058,12 +1057,13 @@ static int
> metricgroup__add_metric_sys_event_iter(struct pmu_event *pe,
> void *data)
> {
> struct metricgroup_add_iter_data *d = data;
> + struct metric *m = NULL;
> int ret;
>
> if (!match_pe_metric(pe, d->metric))
> return 0;
>
> - ret = add_metric(d->metric_list, pe, d->metric_no_group, d->m, NULL,
> d->ids);
> + ret = add_metric(d->metric_list, pe, d->metric_no_group, &m, NULL,
> +d->ids);
> if (ret)
> return ret;
>
> @@ -1114,7 +1114,6 @@ static int metricgroup__add_metric(const char
> *metric, bool metric_no_group,
> .metric_list = &list,
> .metric = metric,
> .metric_no_group = metric_no_group,
> - .m = &m,
> .ids = &ids,
> .has_match = &has_match,
> .ret = &ret,
> --
> 2.26.2
Powered by blists - more mailing lists