diff mbox series

[v5,2/6] perf vendor events arm64: Add TLB metrics for neoverse-n2

Message ID 1672745976-2800146-3-git-send-email-renyu.zj@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series Add metrics for neoverse-n2 | expand

Commit Message

Jing Zhang Jan. 3, 2023, 11:39 a.m. UTC
Add TLB related metrics.

Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
Acked-by: Ian Rogers <irogers@google.com>
---
 .../arch/arm64/arm/neoverse-n2/metrics.json        | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Ian Rogers Jan. 3, 2023, 5:14 p.m. UTC | #1
On Tue, Jan 3, 2023 at 3:39 AM Jing Zhang <renyu.zj@linux.alibaba.com> wrote:
>
> Add TLB related metrics.
>
> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
> Acked-by: Ian Rogers <irogers@google.com>
> ---
>  .../arch/arm64/arm/neoverse-n2/metrics.json        | 49 ++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
> diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> index c126f1bc..8a74e07 100644
> --- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> +++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> @@ -26,5 +26,54 @@
>          "MetricGroup": "TopdownL1",
>          "MetricName": "backend_bound",
>          "ScaleUnit": "100%"
> +    },
> +    {
> +        "MetricExpr": "L1D_TLB_REFILL / L1D_TLB",
> +        "BriefDescription": "The rate of L1D TLB refill to the overall L1D TLB lookups",
> +        "MetricGroup": "TLB",
> +        "MetricName": "l1d_tlb_miss_rate",
> +        "ScaleUnit": "100%"
> +    },
> +    {
> +        "MetricExpr": "L1I_TLB_REFILL / L1I_TLB",
> +        "BriefDescription": "The rate of L1I TLB refill to the overall L1I TLB lookups",
> +        "MetricGroup": "TLB",
> +        "MetricName": "l1i_tlb_miss_rate",
> +        "ScaleUnit": "100%"
> +    },
> +    {
> +        "MetricExpr": "L2D_TLB_REFILL / L2D_TLB",
> +        "BriefDescription": "The rate of L2D TLB refill to the overall L2D TLB lookups",
> +        "MetricGroup": "TLB",
> +        "MetricName": "l2_tlb_miss_rate",
> +        "ScaleUnit": "100%"
> +    },
> +    {
> +        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
> +        "MetricGroup": "TLB",
> +        "MetricName": "dtlb_mpki",
> +        "ScaleUnit": "MPKI"
> +    },
> +    {
> +        "MetricExpr": "DTLB_WALK / L1D_TLB",
> +        "BriefDescription": "The rate of DTLB Walks to the overall L1D TLB lookups",
> +        "MetricGroup": "TLB",
> +        "MetricName": "dtlb_walk_rate",
> +        "ScaleUnit": "100%"
> +    },
> +    {
> +        "MetricExpr": "ITLB_WALK / INST_RETIRED * 1000",
> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for instruction accesses",
> +        "MetricGroup": "TLB",
> +        "MetricName": "itlb_mpki",
> +        "ScaleUnit": "MPKI"

Did you test this? IIRC if there is no number in the ScaleUnit then
the scale factor becomes 0 and the metric value is always multiplied
by zero. Perhaps:

"MetricName": "itlb_miss_rate",
"MetricExpr": "ITLB / INST_RETIRED"
"ScaleUnit": "1000MPKI"

Thanks,
Ian

> +    },
> +    {
> +        "MetricExpr": "ITLB_WALK / L1I_TLB",
> +        "BriefDescription": "The rate of ITLB Walks to the overall L1I TLB lookups",
> +        "MetricGroup": "TLB",
> +        "MetricName": "itlb_walk_rate",
> +        "ScaleUnit": "100%"
>      }
>  ]
> --
> 1.8.3.1
>
Jing Zhang Jan. 4, 2023, 5:21 a.m. UTC | #2
在 2023/1/4 上午1:14, Ian Rogers 写道:
> On Tue, Jan 3, 2023 at 3:39 AM Jing Zhang <renyu.zj@linux.alibaba.com> wrote:
>>
>> Add TLB related metrics.
>>
>> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
>> Acked-by: Ian Rogers <irogers@google.com>
>> ---
>>  .../arch/arm64/arm/neoverse-n2/metrics.json        | 49 ++++++++++++++++++++++
>>  1 file changed, 49 insertions(+)
>>
>> diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>> index c126f1bc..8a74e07 100644
>> --- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>> +++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>> @@ -26,5 +26,54 @@
>>          "MetricGroup": "TopdownL1",
>>          "MetricName": "backend_bound",
>>          "ScaleUnit": "100%"
>> +    },
>> +    {
>> +        "MetricExpr": "L1D_TLB_REFILL / L1D_TLB",
>> +        "BriefDescription": "The rate of L1D TLB refill to the overall L1D TLB lookups",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "l1d_tlb_miss_rate",
>> +        "ScaleUnit": "100%"
>> +    },
>> +    {
>> +        "MetricExpr": "L1I_TLB_REFILL / L1I_TLB",
>> +        "BriefDescription": "The rate of L1I TLB refill to the overall L1I TLB lookups",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "l1i_tlb_miss_rate",
>> +        "ScaleUnit": "100%"
>> +    },
>> +    {
>> +        "MetricExpr": "L2D_TLB_REFILL / L2D_TLB",
>> +        "BriefDescription": "The rate of L2D TLB refill to the overall L2D TLB lookups",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "l2_tlb_miss_rate",
>> +        "ScaleUnit": "100%"
>> +    },
>> +    {
>> +        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "dtlb_mpki",
>> +        "ScaleUnit": "MPKI"
>> +    },
>> +    {
>> +        "MetricExpr": "DTLB_WALK / L1D_TLB",
>> +        "BriefDescription": "The rate of DTLB Walks to the overall L1D TLB lookups",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "dtlb_walk_rate",
>> +        "ScaleUnit": "100%"
>> +    },
>> +    {
>> +        "MetricExpr": "ITLB_WALK / INST_RETIRED * 1000",
>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for instruction accesses",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "itlb_mpki",
>> +        "ScaleUnit": "MPKI"
> 
> Did you test this? IIRC if there is no number in the ScaleUnit then
> the scale factor becomes 0 and the metric value is always multiplied
> by zero. Perhaps:
> 
> "MetricName": "itlb_miss_rate",
> "MetricExpr": "ITLB / INST_RETIRED"
> "ScaleUnit": "1000MPKI"
> 
> Thanks,
> Ian
> 

You are absolutely right, I only tested TLB metrics. Sorry for not double checking. I will repost the corrected patches.

>> +    },
>> +    {
>> +        "MetricExpr": "ITLB_WALK / L1I_TLB",
>> +        "BriefDescription": "The rate of ITLB Walks to the overall L1I TLB lookups",
>> +        "MetricGroup": "TLB",
>> +        "MetricName": "itlb_walk_rate",
>> +        "ScaleUnit": "100%"
>>      }
>>  ]
>> --
>> 1.8.3.1
>>
Jing Zhang Jan. 4, 2023, 8:40 a.m. UTC | #3
在 2023/1/4 下午1:21, Jing Zhang 写道:
> 
> 
> 在 2023/1/4 上午1:14, Ian Rogers 写道:
>> On Tue, Jan 3, 2023 at 3:39 AM Jing Zhang <renyu.zj@linux.alibaba.com> wrote:
>>>
>>> Add TLB related metrics.
>>>
>>> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
>>> Acked-by: Ian Rogers <irogers@google.com>
>>> ---
>>>  .../arch/arm64/arm/neoverse-n2/metrics.json        | 49 ++++++++++++++++++++++
>>>  1 file changed, 49 insertions(+)
>>>
>>> diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>>> index c126f1bc..8a74e07 100644
>>> --- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>>> +++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
>>> @@ -26,5 +26,54 @@
>>>          "MetricGroup": "TopdownL1",
>>>          "MetricName": "backend_bound",
>>>          "ScaleUnit": "100%"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "L1D_TLB_REFILL / L1D_TLB",
>>> +        "BriefDescription": "The rate of L1D TLB refill to the overall L1D TLB lookups",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "l1d_tlb_miss_rate",
>>> +        "ScaleUnit": "100%"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "L1I_TLB_REFILL / L1I_TLB",
>>> +        "BriefDescription": "The rate of L1I TLB refill to the overall L1I TLB lookups",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "l1i_tlb_miss_rate",
>>> +        "ScaleUnit": "100%"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "L2D_TLB_REFILL / L2D_TLB",
>>> +        "BriefDescription": "The rate of L2D TLB refill to the overall L2D TLB lookups",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "l2_tlb_miss_rate",
>>> +        "ScaleUnit": "100%"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
>>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "dtlb_mpki",
>>> +        "ScaleUnit": "MPKI"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "DTLB_WALK / L1D_TLB",
>>> +        "BriefDescription": "The rate of DTLB Walks to the overall L1D TLB lookups",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "dtlb_walk_rate",
>>> +        "ScaleUnit": "100%"
>>> +    },
>>> +    {
>>> +        "MetricExpr": "ITLB_WALK / INST_RETIRED * 1000",
>>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for instruction accesses",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "itlb_mpki",
>>> +        "ScaleUnit": "MPKI"
>>
>> Did you test this? IIRC if there is no number in the ScaleUnit then
>> the scale factor becomes 0 and the metric value is always multiplied
>> by zero. Perhaps:
>>
>> "MetricName": "itlb_miss_rate",
>> "MetricExpr": "ITLB / INST_RETIRED"
>> "ScaleUnit": "1000MPKI"
>>
>> Thanks,
>> Ian
>>
> 
> You are absolutely right, I only tested TLB metrics. Sorry for not double checking. I will repost the corrected patches.
> 

I rethought it. I want to change the ScaleUnit to "1MPKI" and keep the MetricExpr multiplied by 1000,
so that the "MetricExpr" expresses the value of per kilo instruciton, which can be consistent with the
description in "BriefDescription". Like:
   {
        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
        "MetricGroup": "TLB",
        "MetricName": "dtlb_mpki",
        "ScaleUnit": "1MPKI"
    },


In addition, I think it is more reasonable for ScaleUnit to have a default scale factor of 1 when there
is no number. I want to try to fix this bug.

Ian, what's your opnion?


>>> +    },
>>> +    {
>>> +        "MetricExpr": "ITLB_WALK / L1I_TLB",
>>> +        "BriefDescription": "The rate of ITLB Walks to the overall L1I TLB lookups",
>>> +        "MetricGroup": "TLB",
>>> +        "MetricName": "itlb_walk_rate",
>>> +        "ScaleUnit": "100%"
>>>      }
>>>  ]
>>> --
>>> 1.8.3.1
>>>
Ian Rogers Jan. 4, 2023, 4:57 p.m. UTC | #4
On Wed, Jan 4, 2023 at 12:40 AM Jing Zhang <renyu.zj@linux.alibaba.com> wrote:
>
>
>
> 在 2023/1/4 下午1:21, Jing Zhang 写道:
> >
> >
> > 在 2023/1/4 上午1:14, Ian Rogers 写道:
> >> On Tue, Jan 3, 2023 at 3:39 AM Jing Zhang <renyu.zj@linux.alibaba.com> wrote:
> >>>
> >>> Add TLB related metrics.
> >>>
> >>> Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
> >>> Acked-by: Ian Rogers <irogers@google.com>
> >>> ---
> >>>  .../arch/arm64/arm/neoverse-n2/metrics.json        | 49 ++++++++++++++++++++++
> >>>  1 file changed, 49 insertions(+)
> >>>
> >>> diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> >>> index c126f1bc..8a74e07 100644
> >>> --- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> >>> +++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
> >>> @@ -26,5 +26,54 @@
> >>>          "MetricGroup": "TopdownL1",
> >>>          "MetricName": "backend_bound",
> >>>          "ScaleUnit": "100%"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "L1D_TLB_REFILL / L1D_TLB",
> >>> +        "BriefDescription": "The rate of L1D TLB refill to the overall L1D TLB lookups",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "l1d_tlb_miss_rate",
> >>> +        "ScaleUnit": "100%"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "L1I_TLB_REFILL / L1I_TLB",
> >>> +        "BriefDescription": "The rate of L1I TLB refill to the overall L1I TLB lookups",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "l1i_tlb_miss_rate",
> >>> +        "ScaleUnit": "100%"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "L2D_TLB_REFILL / L2D_TLB",
> >>> +        "BriefDescription": "The rate of L2D TLB refill to the overall L2D TLB lookups",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "l2_tlb_miss_rate",
> >>> +        "ScaleUnit": "100%"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
> >>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "dtlb_mpki",
> >>> +        "ScaleUnit": "MPKI"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "DTLB_WALK / L1D_TLB",
> >>> +        "BriefDescription": "The rate of DTLB Walks to the overall L1D TLB lookups",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "dtlb_walk_rate",
> >>> +        "ScaleUnit": "100%"
> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "ITLB_WALK / INST_RETIRED * 1000",
> >>> +        "BriefDescription": "The rate of TLB Walks per kilo instructions for instruction accesses",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "itlb_mpki",
> >>> +        "ScaleUnit": "MPKI"
> >>
> >> Did you test this? IIRC if there is no number in the ScaleUnit then
> >> the scale factor becomes 0 and the metric value is always multiplied
> >> by zero. Perhaps:
> >>
> >> "MetricName": "itlb_miss_rate",
> >> "MetricExpr": "ITLB / INST_RETIRED"
> >> "ScaleUnit": "1000MPKI"
> >>
> >> Thanks,
> >> Ian
> >>
> >
> > You are absolutely right, I only tested TLB metrics. Sorry for not double checking. I will repost the corrected patches.
> >
>
> I rethought it. I want to change the ScaleUnit to "1MPKI" and keep the MetricExpr multiplied by 1000,
> so that the "MetricExpr" expresses the value of per kilo instruciton, which can be consistent with the
> description in "BriefDescription". Like:
>    {
>         "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
>         "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
>         "MetricGroup": "TLB",
>         "MetricName": "dtlb_mpki",
>         "ScaleUnit": "1MPKI"
>     },
>
>
> In addition, I think it is more reasonable for ScaleUnit to have a default scale factor of 1 when there
> is no number. I want to try to fix this bug.
>
> Ian, what's your opnion?

I like intention revealing, itlb_mpki is something of a soup of
characters to de-acronym-ify compared to itlb_miss_rate, but rate may
not be completely intuitive in that name. I'm happy to follow your
lead. Putting the 1000 in the ScaleUnit or the expression doesn't
matter, so again happy to follow what you think is best.

Thanks,
Ian

> >>> +    },
> >>> +    {
> >>> +        "MetricExpr": "ITLB_WALK / L1I_TLB",
> >>> +        "BriefDescription": "The rate of ITLB Walks to the overall L1I TLB lookups",
> >>> +        "MetricGroup": "TLB",
> >>> +        "MetricName": "itlb_walk_rate",
> >>> +        "ScaleUnit": "100%"
> >>>      }
> >>>  ]
> >>> --
> >>> 1.8.3.1
> >>>
diff mbox series

Patch

diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
index c126f1bc..8a74e07 100644
--- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
+++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json
@@ -26,5 +26,54 @@ 
         "MetricGroup": "TopdownL1",
         "MetricName": "backend_bound",
         "ScaleUnit": "100%"
+    },
+    {
+        "MetricExpr": "L1D_TLB_REFILL / L1D_TLB",
+        "BriefDescription": "The rate of L1D TLB refill to the overall L1D TLB lookups",
+        "MetricGroup": "TLB",
+        "MetricName": "l1d_tlb_miss_rate",
+        "ScaleUnit": "100%"
+    },
+    {
+        "MetricExpr": "L1I_TLB_REFILL / L1I_TLB",
+        "BriefDescription": "The rate of L1I TLB refill to the overall L1I TLB lookups",
+        "MetricGroup": "TLB",
+        "MetricName": "l1i_tlb_miss_rate",
+        "ScaleUnit": "100%"
+    },
+    {
+        "MetricExpr": "L2D_TLB_REFILL / L2D_TLB",
+        "BriefDescription": "The rate of L2D TLB refill to the overall L2D TLB lookups",
+        "MetricGroup": "TLB",
+        "MetricName": "l2_tlb_miss_rate",
+        "ScaleUnit": "100%"
+    },
+    {
+        "MetricExpr": "DTLB_WALK / INST_RETIRED * 1000",
+        "BriefDescription": "The rate of TLB Walks per kilo instructions for data accesses",
+        "MetricGroup": "TLB",
+        "MetricName": "dtlb_mpki",
+        "ScaleUnit": "MPKI"
+    },
+    {
+        "MetricExpr": "DTLB_WALK / L1D_TLB",
+        "BriefDescription": "The rate of DTLB Walks to the overall L1D TLB lookups",
+        "MetricGroup": "TLB",
+        "MetricName": "dtlb_walk_rate",
+        "ScaleUnit": "100%"
+    },
+    {
+        "MetricExpr": "ITLB_WALK / INST_RETIRED * 1000",
+        "BriefDescription": "The rate of TLB Walks per kilo instructions for instruction accesses",
+        "MetricGroup": "TLB",
+        "MetricName": "itlb_mpki",
+        "ScaleUnit": "MPKI"
+    },
+    {
+        "MetricExpr": "ITLB_WALK / L1I_TLB",
+        "BriefDescription": "The rate of ITLB Walks to the overall L1I TLB lookups",
+        "MetricGroup": "TLB",
+        "MetricName": "itlb_walk_rate",
+        "ScaleUnit": "100%"
     }
 ]