diff mbox series

[V1,3/4] perf vendor events: Add JSON metrics for imx8mq DDR Perf

Message ID 20210119025647.12569-4-qiangqing.zhang@nxp.com (mailing list archive)
State New, archived
Headers show
Series tools: perf: Add JSON metrics for i.MX8M platforms | expand

Commit Message

Joakim Zhang Jan. 19, 2021, 2:56 a.m. UTC
Add JSON metrics for imx8mq DDR Perf.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 .../arch/arm64/freescale/imx8mq/sys/ddrc.json | 37 +++++++++++++++++++
 .../arm64/freescale/imx8mq/sys/metrics.json   | 26 +++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/ddrc.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json

Comments

John Garry Jan. 19, 2021, 10:40 a.m. UTC | #1
On 19/01/2021 02:56, Joakim Zhang wrote:
> index 000000000000..c3e9f89a4a4d
> --- /dev/null
> +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json
> @@ -0,0 +1,26 @@
> +[
> +   {
> +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",

Why mention the evk board specifically? Is this metric only specific to 
that board, and not all i.MX8MQ platforms?

Thanks,
John

> +	    "MetricName": "imx8mq_bandwidth_usage.lpddr4",
> +	    "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (800 * 1000000 * 4 * 4)",
> +	    "ScaleUnit": "1e2%",
> +	    "Unit": "imx8_ddr",
> +	    "Compat": "i.MX8MQ"
> +   },
Joakim Zhang Jan. 19, 2021, 11 a.m. UTC | #2
> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2021年1月19日 18:40
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; acme@kernel.org;
> jolsa@redhat.com
> Cc: will@kernel.org; linux-perf-users@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; mark.rutland@arm.com;
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for imx8mq
> DDR Perf
> 
> On 19/01/2021 02:56, Joakim Zhang wrote:
> > index 000000000000..c3e9f89a4a4d
> > --- /dev/null
> > +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.js
> > +++ on
> > @@ -0,0 +1,26 @@
> > +[
> > +   {
> > +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
> 
> Why mention the evk board specifically? Is this metric only specific to that
> board, and not all i.MX8MQ platforms?

Yes, John, we have lpddr4 evk board and ddr4 evk borad......

John, change to your new framework, I found it can't support all features which is supported in 5.10 kernel.

Best Regards,
Joakim Zhang
> Thanks,
> John
> 
> > +	    "MetricName": "imx8mq_bandwidth_usage.lpddr4",
> > +	    "MetricExpr": "(( imx8_ddr0@read\\-cycles@ +
> imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (800 * 1000000 * 4 *
> 4)",
> > +	    "ScaleUnit": "1e2%",
> > +	    "Unit": "imx8_ddr",
> > +	    "Compat": "i.MX8MQ"
> > +   },
John Garry Jan. 19, 2021, 12:27 p.m. UTC | #3
On 19/01/2021 11:00, Joakim Zhang wrote:
>> -----Original Message-----
>> From: John Garry<john.garry@huawei.com>
>> Sent: 2021年1月19日 18:40
>> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
>> jolsa@redhat.com
>> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
>> <linux-imx@nxp.com>;mark.rutland@arm.com;
>> linux-arm-kernel@lists.infradead.org
>> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for imx8mq
>> DDR Perf
>>
>> On 19/01/2021 02:56, Joakim Zhang wrote:
>>> index 000000000000..c3e9f89a4a4d
>>> --- /dev/null
>>> +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.js
>>> +++ on
>>> @@ -0,0 +1,26 @@
>>> +[
>>> +   {
>>> +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
>> Why mention the evk board specifically? Is this metric only specific to that
>> board, and not all i.MX8MQ platforms?
> Yes, John, we have lpddr4 evk board and ddr4 evk borad......
> 

How is this supposed to work?

So perf matches on the identifier file for system PMUs; however the 
contents of this file are based on the HW implementation for imx DDR 
PMU, not the board.

> John, change to your new framework, I found it can't support all features which is supported in 5.10 kernel.

Yes, so let me know about all the problems.

Thanks,
john
Joakim Zhang Jan. 20, 2021, 5:46 a.m. UTC | #4
> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2021年1月19日 20:27
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; acme@kernel.org;
> jolsa@redhat.com
> Cc: will@kernel.org; linux-perf-users@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; mark.rutland@arm.com;
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for imx8mq
> DDR Perf
> 
> On 19/01/2021 11:00, Joakim Zhang wrote:
> >> -----Original Message-----
> >> From: John Garry<john.garry@huawei.com>
> >> Sent: 2021年1月19日 18:40
> >> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
> >> jolsa@redhat.com
> >> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
> >> <linux-imx@nxp.com>;mark.rutland@arm.com;
> >> linux-arm-kernel@lists.infradead.org
> >> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for
> >> imx8mq DDR Perf
> >>
> >> On 19/01/2021 02:56, Joakim Zhang wrote:
> >>> index 000000000000..c3e9f89a4a4d
> >>> --- /dev/null
> >>> +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.
> >>> +++ js
> >>> +++ on
> >>> @@ -0,0 +1,26 @@
> >>> +[
> >>> +   {
> >>> +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
> >> Why mention the evk board specifically? Is this metric only specific
> >> to that board, and not all i.MX8MQ platforms?
> > Yes, John, we have lpddr4 evk board and ddr4 evk borad......
> >
> 
> How is this supposed to work?
> 
> So perf matches on the identifier file for system PMUs; however the contents of
> this file are based on the HW implementation for imx DDR PMU, not the board.

Yes, I know this feature is for system PMU, not board. You know DDR bandwidth calculation is based on DDR clock frequency, which is vary form boards.

e.g.
lpddr4 board, DDR clock frequency is 750MHZ:
"MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"    

ddr4 board, DDR clock frequency is 600MHZ.
"MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (600 * 1000000 * 4 * 4)"

I give different metric names, 
"MetricName": "imx8mm_bandwidth_usage.lpddr4"
"MetricName": "imx8mm_bandwidth_usage.ddr4"

So users can select correct bandwidth metric according to their own board types. To a certain extent, it can also support some board-level metrics.

If it is okay for you, I will send a V2 to replace ( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) with ( imx8mm_ddr.read_cycles + imx8mm_ddr.write_cycles ).

> > John, change to your new framework, I found it can't support all features
> which is supported in 5.10 kernel.
> 
> Yes, so let me know about all the problems.

It should have worked as 5.10 kernel at my side. Thanks.

Best Regards,
Joakim Zhang
> Thanks,
> john
>
John Garry Jan. 20, 2021, 9:25 a.m. UTC | #5
On 20/01/2021 05:46, Joakim Zhang wrote:
>> -----Original Message-----
>> From: John Garry<john.garry@huawei.com>
>> Sent: 2021年1月19日 20:27
>> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
>> jolsa@redhat.com
>> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
>> <linux-imx@nxp.com>;mark.rutland@arm.com;
>> linux-arm-kernel@lists.infradead.org
>> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for imx8mq
>> DDR Perf
>>
>> On 19/01/2021 11:00, Joakim Zhang wrote:
>>>> -----Original Message-----
>>>> From: John Garry<john.garry@huawei.com>
>>>> Sent: 2021年1月19日 18:40
>>>> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
>>>> jolsa@redhat.com
>>>> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
>>>> <linux-imx@nxp.com>;mark.rutland@arm.com;
>>>> linux-arm-kernel@lists.infradead.org
>>>> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for
>>>> imx8mq DDR Perf
>>>>
>>>> On 19/01/2021 02:56, Joakim Zhang wrote:
>>>>> index 000000000000..c3e9f89a4a4d
>>>>> --- /dev/null
>>>>> +++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.
>>>>> +++ js
>>>>> +++ on
>>>>> @@ -0,0 +1,26 @@
>>>>> +[
>>>>> +   {
>>>>> +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
>>>> Why mention the evk board specifically? Is this metric only specific
>>>> to that board, and not all i.MX8MQ platforms?
>>> Yes, John, we have lpddr4 evk board and ddr4 evk borad......
>>>
>> How is this supposed to work?
>>
>> So perf matches on the identifier file for system PMUs; however the contents of
>> this file are based on the HW implementation for imx DDR PMU, not the board.
> Yes, I know this feature is for system PMU, not board. You know DDR bandwidth calculation is based on DDR clock frequency, which is vary form boards.
> 
> e.g.
> lpddr4 board, DDR clock frequency is 750MHZ:
> "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"
> 
> ddr4 board, DDR clock frequency is 600MHZ.
> "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (600 * 1000000 * 4 * 4)"
> 
> I give different metric names,
> "MetricName": "imx8mm_bandwidth_usage.lpddr4"
> "MetricName": "imx8mm_bandwidth_usage.ddr4"
> 

But that is just not how things are done. We - or I - would expect that 
perf tool would have the intelligence to know the appropriate metric for 
that specific platform. Or, more specifically, we should not present the 
user with many metrics and expect him/her to know the appropriate metric 
for the specific board.

Are there other cases for other architectures where things are done like 
this?

Thanks,
John

> So users can select correct bandwidth metric according to their own board types. To a certain extent, it can also support some board-level metrics.
> 
> If it is okay for you, I will send a V2 to replace ( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) with ( imx8mm_ddr.read_cycles + imx8mm_ddr.write_cycles ).
> 
>>> John, change to your new framework, I found it can't support all features
>> which is supported in 5.10 kernel.
>>
>> Yes, so let me know about all the problems.
> It should have worked as 5.10 kernel at my side. Thanks.
Joakim Zhang Jan. 21, 2021, 10:24 a.m. UTC | #6
> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2021年1月20日 17:26
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; acme@kernel.org;
> jolsa@redhat.com
> Cc: will@kernel.org; linux-perf-users@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>; mark.rutland@arm.com;
> linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for imx8mq
> DDR Perf
> 
> On 20/01/2021 05:46, Joakim Zhang wrote:
> >> -----Original Message-----
> >> From: John Garry<john.garry@huawei.com>
> >> Sent: 2021年1月19日 20:27
> >> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
> >> jolsa@redhat.com
> >> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
> >> <linux-imx@nxp.com>;mark.rutland@arm.com;
> >> linux-arm-kernel@lists.infradead.org
> >> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics for
> >> imx8mq DDR Perf
> >>
> >> On 19/01/2021 11:00, Joakim Zhang wrote:
> >>>> -----Original Message-----
> >>>> From: John Garry<john.garry@huawei.com>
> >>>> Sent: 2021年1月19日 18:40
> >>>> To: Joakim Zhang<qiangqing.zhang@nxp.com>;acme@kernel.org;
> >>>> jolsa@redhat.com
> >>>> Cc:will@kernel.org;linux-perf-users@vger.kernel.org; dl-linux-imx
> >>>> <linux-imx@nxp.com>;mark.rutland@arm.com;
> >>>> linux-arm-kernel@lists.infradead.org
> >>>> Subject: Re: [PATCH V1 3/4] perf vendor events: Add JSON metrics
> >>>> for imx8mq DDR Perf
> >>>>
> >>>> On 19/01/2021 02:56, Joakim Zhang wrote:
> >>>>> index 000000000000..c3e9f89a4a4d
> >>>>> --- /dev/null
> >>>>> +++
> b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.
> >>>>> +++ js
> >>>>> +++ on
> >>>>> @@ -0,0 +1,26 @@
> >>>>> +[
> >>>>> +   {
> >>>>> +	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
> >>>> Why mention the evk board specifically? Is this metric only
> >>>> specific to that board, and not all i.MX8MQ platforms?
> >>> Yes, John, we have lpddr4 evk board and ddr4 evk borad......
> >>>
> >> How is this supposed to work?
> >>
> >> So perf matches on the identifier file for system PMUs; however the
> >> contents of this file are based on the HW implementation for imx DDR PMU,
> not the board.
> > Yes, I know this feature is for system PMU, not board. You know DDR
> bandwidth calculation is based on DDR clock frequency, which is vary form
> boards.
> >
> > e.g.
> > lpddr4 board, DDR clock frequency is 750MHZ:
> > "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ )
> * 4 * 4 / duration_time) / (750 * 1000000 * 4 * 4)"
> >
> > ddr4 board, DDR clock frequency is 600MHZ.
> > "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ )
> * 4 * 4 / duration_time) / (600 * 1000000 * 4 * 4)"
> >
> > I give different metric names,
> > "MetricName": "imx8mm_bandwidth_usage.lpddr4"
> > "MetricName": "imx8mm_bandwidth_usage.ddr4"
> >
> 
> But that is just not how things are done. We - or I - would expect that perf tool
> would have the intelligence to know the appropriate metric for that specific
> platform. Or, more specifically, we should not present the user with many
> metrics and expect him/her to know the appropriate metric for the specific
> board.
> 
> Are there other cases for other architectures where things are done like this?


I don't know if exist other cases. If you can’t accept it, I can only push part of it first, and let bandwidth metric locally.


Best Regards,
Joakim Zhang
> Thanks,
> John
> 
> > So users can select correct bandwidth metric according to their own board
> types. To a certain extent, it can also support some board-level metrics.
> >
> > If it is okay for you, I will send a V2 to replace ( imx8_ddr0@read\\-cycles@ +
> imx8_ddr0@write\\-cycles@ ) with ( imx8mm_ddr.read_cycles +
> imx8mm_ddr.write_cycles ).
> >
> >>> John, change to your new framework, I found it can't support all
> >>> features
> >> which is supported in 5.10 kernel.
> >>
> >> Yes, so let me know about all the problems.
> > It should have worked as 5.10 kernel at my side. Thanks.
diff mbox series

Patch

diff --git a/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/ddrc.json b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/ddrc.json
new file mode 100644
index 000000000000..c8682728ddad
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/ddrc.json
@@ -0,0 +1,37 @@ 
+[
+   {
+           "BriefDescription": "ddr cycles event",
+           "EventCode": "0x00",
+           "EventName": "imx8mq_ddr.cycles",
+           "Unit": "imx8_ddr",
+           "Compat": "i.MX8MQ"
+   },
+   {
+           "BriefDescription": "ddr read-cycles event",
+           "EventCode": "0x2a",
+           "EventName": "imx8mq_ddr.read_cycles",
+           "Unit": "imx8_ddr",
+           "Compat": "i.MX8MQ"
+   },
+   {
+           "BriefDescription": "ddr write-cycles event",
+           "EventCode": "0x2b",
+           "EventName": "imx8mq_ddr.write_cycles",
+           "Unit": "imx8_ddr",
+           "Compat": "i.MX8MQ"
+   },
+   {
+           "BriefDescription": "ddr read event",
+           "EventCode": "0x35",
+           "EventName": "imx8mq_ddr.read",
+           "Unit": "imx8_ddr",
+           "Compat": "i.MX8MQ"
+   },
+   {
+           "BriefDescription": "ddr write event",
+           "EventCode": "0x38",
+           "EventName": "imx8mq_ddr.write",
+           "Unit": "imx8_ddr",
+           "Compat": "i.MX8MQ"
+   }
+]
diff --git a/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json
new file mode 100644
index 000000000000..c3e9f89a4a4d
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/freescale/imx8mq/sys/metrics.json
@@ -0,0 +1,26 @@ 
+[
+   {
+	    "BriefDescription": "bandwidth usage for lpddr4 evk board",
+	    "MetricName": "imx8mq_bandwidth_usage.lpddr4",
+	    "MetricExpr": "(( imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@ ) * 4 * 4 / duration_time) / (800 * 1000000 * 4 * 4)",
+	    "ScaleUnit": "1e2%",
+	    "Unit": "imx8_ddr",
+	    "Compat": "i.MX8MQ"
+   },
+   {
+	    "BriefDescription": "bytes all masters read from ddr based on read-cycles event",
+	    "MetricName": "imx8mq_ddr_read.all",
+	    "MetricExpr": "imx8mq_ddr.read_cycles * 4 * 4",
+	    "ScaleUnit": "9.765625e-4KB",
+	    "Unit": "imx8_ddr",
+	    "Compat": "i.MX8MQ"
+   },
+   {
+	    "BriefDescription": "bytes all masters write to ddr based on write-cycles event",
+	    "MetricName": "imx8mq_ddr_write.all",
+	    "MetricExpr": "imx8mq_ddr.write_cycles * 4 * 4",
+	    "ScaleUnit": "9.765625e-4KB",
+	    "Unit": "imx8_ddr",
+	    "Compat": "i.MX8MQ"
+    }
+]