linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations
@ 2025-03-13 20:15 Ilkka Koskinen
  2025-03-13 20:15 ` [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata Ilkka Koskinen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ilkka Koskinen @ 2025-03-13 20:15 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers, John Garry,
	Will Deacon, James Clark, Mike Leach, Leo Yan, Peter Zijlstra,
	Ingo Molnar, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Liang, Kan, Mark Rutland
  Cc: Ilkka Koskinen, linux-arm-kernel, linux-perf-users, linux-kernel

Add an errata reference to a impacted event and fix metrics calculation
caused by a scaling issue.

Ilkka Koskinen (2):
  perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED
    impacted by errata
  perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation

 .../pmu-events/arch/arm64/ampere/ampereone/memory.json |  4 +++-
 .../arch/arm64/ampere/ampereonex/memory.json           |  4 +++-
 .../arch/arm64/ampere/ampereonex/metrics.json          | 10 +++++-----
 3 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.47.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata
  2025-03-13 20:15 [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Ilkka Koskinen
@ 2025-03-13 20:15 ` Ilkka Koskinen
  2025-03-18 10:48   ` James Clark
  2025-03-13 20:15 ` [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation Ilkka Koskinen
  2025-03-21 18:30 ` [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Namhyung Kim
  2 siblings, 1 reply; 7+ messages in thread
From: Ilkka Koskinen @ 2025-03-13 20:15 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers, John Garry,
	Will Deacon, James Clark, Mike Leach, Leo Yan, Peter Zijlstra,
	Ingo Molnar, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Liang, Kan, Mark Rutland
  Cc: Ilkka Koskinen, linux-arm-kernel, linux-perf-users, linux-kernel

Atomic instructions are both memory-reading and memory-writing
instructions and so should be counted by both LD_RETIRED and ST_RETIRED
performance monitoring events. However LD_RETIRED does not count atomic
instructions.

Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
---
 tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json | 4 +++-
 .../perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
index 0711782bfa6b..13382d29b25f 100644
--- a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
+++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
@@ -1,6 +1,8 @@
 [
     {
-        "ArchStdEvent": "LD_RETIRED"
+        "ArchStdEvent": "LD_RETIRED",
+        "Errata": "Errata AC03_CPU_52",
+        "BriefDescription": "Instruction architecturally executed, condition code check pass, load. Impacted by errata -"
     },
     {
         "ArchStdEvent": "MEM_ACCESS_RD"
diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json
index a211d94aacde..6c06bc928415 100644
--- a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json
+++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json
@@ -1,6 +1,8 @@
 [
     {
-        "ArchStdEvent": "LD_RETIRED"
+        "ArchStdEvent": "LD_RETIRED",
+        "Errata": "Errata AC04_CPU_21",
+        "BriefDescription": "Instruction architecturally executed, condition code check pass, load. Impacted by errata -"
     },
     {
         "ArchStdEvent": "MEM_ACCESS_RD"
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation
  2025-03-13 20:15 [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Ilkka Koskinen
  2025-03-13 20:15 ` [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata Ilkka Koskinen
@ 2025-03-13 20:15 ` Ilkka Koskinen
  2025-03-18 10:47   ` James Clark
  2025-03-21 18:30 ` [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Namhyung Kim
  2 siblings, 1 reply; 7+ messages in thread
From: Ilkka Koskinen @ 2025-03-13 20:15 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers, John Garry,
	Will Deacon, James Clark, Mike Leach, Leo Yan, Peter Zijlstra,
	Ingo Molnar, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Liang, Kan, Mark Rutland
  Cc: Ilkka Koskinen, linux-arm-kernel, linux-perf-users, linux-kernel

frontend_bound metrics was miscalculated due to different scaling in
a couple of metrics it depends on. Change the scaling to match with
AmpereOne.

Fixes: 16438b652b46 ("perf vendor events arm64 AmpereOneX: Add core PMU events and metrics")
Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
---
 .../arch/arm64/ampere/ampereonex/metrics.json          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
index c5d1d22bd034..5228f94a793f 100644
--- a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
+++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
@@ -229,19 +229,19 @@
     },
     {
         "MetricName": "slots_lost_misspeculation_fraction",
-        "MetricExpr": "(OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)",
+        "MetricExpr": "100 * (OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)",
         "BriefDescription": "Fraction of slots lost due to misspeculation",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
-        "ScaleUnit": "100percent of slots"
+        "ScaleUnit": "1percent of slots"
     },
     {
         "MetricName": "retired_fraction",
-        "MetricExpr": "OP_RETIRED / (CPU_CYCLES * #slots)",
+        "MetricExpr": "100 * OP_RETIRED / (CPU_CYCLES * #slots)",
         "BriefDescription": "Fraction of slots retiring, useful work",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
-        "ScaleUnit": "100percent of slots"
+        "ScaleUnit": "1percent of slots"
     },
     {
         "MetricName": "backend_core",
@@ -266,7 +266,7 @@
     },
     {
         "MetricName": "frontend_bandwidth",
-        "MetricExpr": "frontend_bound - frontend_latency",
+        "MetricExpr": "frontend_bound - 100 * frontend_latency",
         "BriefDescription": "Fraction of slots the CPU did not dispatch at full bandwidth - able to dispatch partial slots only (1, 2, or 3 uops)",
         "MetricGroup": "TopdownL2",
         "ScaleUnit": "1percent of slots"
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation
  2025-03-13 20:15 ` [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation Ilkka Koskinen
@ 2025-03-18 10:47   ` James Clark
  0 siblings, 0 replies; 7+ messages in thread
From: James Clark @ 2025-03-18 10:47 UTC (permalink / raw)
  To: Ilkka Koskinen
  Cc: linux-arm-kernel, linux-perf-users, linux-kernel, Namhyung Kim,
	Arnaldo Carvalho de Melo, Ian Rogers, John Garry, Will Deacon,
	Mike Leach, Leo Yan, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Liang, Kan,
	Mark Rutland



On 13/03/2025 8:15 pm, Ilkka Koskinen wrote:
> frontend_bound metrics was miscalculated due to different scaling in
> a couple of metrics it depends on. Change the scaling to match with
> AmpereOne.
> 
> Fixes: 16438b652b46 ("perf vendor events arm64 AmpereOneX: Add core PMU events and metrics")
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
>   .../arch/arm64/ampere/ampereonex/metrics.json          | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
> index c5d1d22bd034..5228f94a793f 100644
> --- a/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
> +++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
> @@ -229,19 +229,19 @@
>       },
>       {
>           "MetricName": "slots_lost_misspeculation_fraction",
> -        "MetricExpr": "(OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)",
> +        "MetricExpr": "100 * (OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots)",
>           "BriefDescription": "Fraction of slots lost due to misspeculation",
>           "DefaultMetricgroupName": "TopdownL1",
>           "MetricGroup": "Default;TopdownL1",
> -        "ScaleUnit": "100percent of slots"
> +        "ScaleUnit": "1percent of slots"
>       },
>       {
>           "MetricName": "retired_fraction",
> -        "MetricExpr": "OP_RETIRED / (CPU_CYCLES * #slots)",
> +        "MetricExpr": "100 * OP_RETIRED / (CPU_CYCLES * #slots)",
>           "BriefDescription": "Fraction of slots retiring, useful work",
>           "DefaultMetricgroupName": "TopdownL1",
>           "MetricGroup": "Default;TopdownL1",
> -        "ScaleUnit": "100percent of slots"
> +        "ScaleUnit": "1percent of slots"

I never considered that ScaleUnit could be an issue when the metric was 
included in other metrics with different scales. Seems like an easy trap.

Reviewed-by: James Clark <james.clark@linaro.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata
  2025-03-13 20:15 ` [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata Ilkka Koskinen
@ 2025-03-18 10:48   ` James Clark
  2025-03-20 20:10     ` Ilkka Koskinen
  0 siblings, 1 reply; 7+ messages in thread
From: James Clark @ 2025-03-18 10:48 UTC (permalink / raw)
  To: Ilkka Koskinen
  Cc: linux-arm-kernel, linux-perf-users, linux-kernel, Namhyung Kim,
	Arnaldo Carvalho de Melo, Ian Rogers, John Garry, Will Deacon,
	Mike Leach, Leo Yan, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Liang, Kan,
	Mark Rutland



On 13/03/2025 8:15 pm, Ilkka Koskinen wrote:
> Atomic instructions are both memory-reading and memory-writing
> instructions and so should be counted by both LD_RETIRED and ST_RETIRED
> performance monitoring events. However LD_RETIRED does not count atomic
> instructions.
> 
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
>   tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json | 4 +++-
>   .../perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json  | 4 +++-
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
> index 0711782bfa6b..13382d29b25f 100644
> --- a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
> +++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
> @@ -1,6 +1,8 @@
>   [
>       {
> -        "ArchStdEvent": "LD_RETIRED"
> +        "ArchStdEvent": "LD_RETIRED",
> +        "Errata": "Errata AC03_CPU_52",
> +        "BriefDescription": "Instruction architecturally executed, condition code check pass, load. Impacted by errata -"

I think this could also have a 'Fixes:' tag, either way:

Reviewed-by: James Clark <james.clark@linaro.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata
  2025-03-18 10:48   ` James Clark
@ 2025-03-20 20:10     ` Ilkka Koskinen
  0 siblings, 0 replies; 7+ messages in thread
From: Ilkka Koskinen @ 2025-03-20 20:10 UTC (permalink / raw)
  To: James Clark
  Cc: Ilkka Koskinen, linux-arm-kernel, linux-perf-users, linux-kernel,
	Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers, John Garry,
	Will Deacon, Mike Leach, Leo Yan, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Liang, Kan,
	Mark Rutland


Hi James,

On Tue, 18 Mar 2025, James Clark wrote:
> On 13/03/2025 8:15 pm, Ilkka Koskinen wrote:
>> Atomic instructions are both memory-reading and memory-writing
>> instructions and so should be counted by both LD_RETIRED and ST_RETIRED
>> performance monitoring events. However LD_RETIRED does not count atomic
>> instructions.
>> 
>> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
>> ---
>>   tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json | 4 +++-
>>   .../perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json  | 4 +++-
>>   2 files changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json 
>> b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
>> index 0711782bfa6b..13382d29b25f 100644
>> --- a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
>> +++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json
>> @@ -1,6 +1,8 @@
>>   [
>>       {
>> -        "ArchStdEvent": "LD_RETIRED"
>> +        "ArchStdEvent": "LD_RETIRED",
>> +        "Errata": "Errata AC03_CPU_52",
>> +        "BriefDescription": "Instruction architecturally executed, 
>> condition code check pass, load. Impacted by errata -"
>
> I think this could also have a 'Fixes:' tag, either way:
>
> Reviewed-by: James Clark <james.clark@linaro.org>

Yeah, that's true. I guess, I was thinking about using 'Fixes' more on 
broken patches rather than when adding a patch dealing with a new hw 
errata. Well, given you're find with this, I don't think I'll resubmit it
with a Fixes tag this time.

Cheers, Ilkka


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations
  2025-03-13 20:15 [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Ilkka Koskinen
  2025-03-13 20:15 ` [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata Ilkka Koskinen
  2025-03-13 20:15 ` [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation Ilkka Koskinen
@ 2025-03-21 18:30 ` Namhyung Kim
  2 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2025-03-21 18:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, John Garry, Will Deacon,
	James Clark, Mike Leach, Leo Yan, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Liang, Kan,
	Mark Rutland, Ilkka Koskinen
  Cc: linux-arm-kernel, linux-perf-users, linux-kernel

On Thu, 13 Mar 2025 20:15:57 +0000, Ilkka Koskinen wrote:
> Add an errata reference to a impacted event and fix metrics calculation
> caused by a scaling issue.
> 
> Ilkka Koskinen (2):
>   perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED
>     impacted by errata
>   perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-21 18:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 20:15 [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Ilkka Koskinen
2025-03-13 20:15 ` [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata Ilkka Koskinen
2025-03-18 10:48   ` James Clark
2025-03-20 20:10     ` Ilkka Koskinen
2025-03-13 20:15 ` [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation Ilkka Koskinen
2025-03-18 10:47   ` James Clark
2025-03-21 18:30 ` [PATCH 0/2] perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations Namhyung Kim

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).