All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: John Garry <john.garry@huawei.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"jolsa@redhat.com" <jolsa@redhat.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"irogers@google.com" <irogers@google.com>,
	"kjain@linux.ibm.com" <kjain@linux.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxarm@openeuler.org" <linuxarm@openeuler.org>
Subject: RE: [PATCH] perf metricgroup: Fix system PMU metrics
Date: Tue, 19 Jan 2021 11:13:29 +0000	[thread overview]
Message-ID: <DB8PR04MB6795D26063D0719C93300DDDE6A30@DB8PR04MB6795.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <86abd4dd-a92b-f69b-64e0-7f985506f717@huawei.com>


> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2021年1月19日 19:05
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; peterz@infradead.org;
> mingo@redhat.com; acme@kernel.org; mark.rutland@arm.com;
> alexander.shishkin@linux.intel.com; jolsa@redhat.com;
> namhyung@kernel.org; irogers@google.com; kjain@linux.ibm.com
> Cc: linux-kernel@vger.kernel.org; linuxarm@openeuler.org
> Subject: Re: [PATCH] perf metricgroup: Fix system PMU metrics
> 
> On 19/01/2021 10:56, Joakim Zhang wrote:
> >> 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@nxp.com>
> >> Signed-off-by: John Garry<john.garry@huawei.com>
> > root@imx8mmevk:~# ./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@nxp.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@read\\-cycles@ + imx8_ddr0@write\\-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)",
> 
> Hmmm... not sure what you mean by "compared to 5.10 kernel". As far as I'm
> concerned, none of this was supported in 5.10 and metrics did not work for
> arm64. Support for sys PMU events+metrics only came in 5.11-rc.

Yes, 5.10 doesn't support ARM64. I add some code let it work locally. And,
"MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"
Above metric expression can work fine.

> Anyway, can you share the full metric event which you say does not work, not
> just the "MetricExpr"?

OK, Could help check below metric? Thanks.
"MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"
or
"MetricExpr": "(( imx8mm_ddr.read_cycles + imx8mm_ddr.write_cycles ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"

Best Regards,
Joakim Zhang
 
> Thanks,
> John

  reply	other threads:[~2021-01-19 11:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 10:04 [PATCH] perf metricgroup: Fix system PMU metrics John Garry
2021-01-19 10:56 ` Joakim Zhang
2021-01-19 11:04   ` John Garry
2021-01-19 11:13     ` Joakim Zhang [this message]
2021-01-19 12:02   ` John Garry
2021-01-19 15:47   ` John Garry
2021-01-19 17:33     ` John Garry
2021-01-20  5:15       ` Joakim Zhang
2021-01-20  9:15         ` John Garry
2021-01-20 10:19           ` Joakim Zhang
2021-01-21 20:31           ` Arnaldo Carvalho de Melo
2021-01-21 21:40             ` John Garry
2021-01-20 12:56       ` Jiri Olsa
2021-01-20 13:07         ` John Garry
2021-02-05  9:56         ` John Garry
2021-01-20 21:42 ` Jiri Olsa

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=DB8PR04MB6795D26063D0719C93300DDDE6A30@DB8PR04MB6795.eurprd04.prod.outlook.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.