Skip to contentSkip to conversation

perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations

PATCH Applied Ilkka Koskinen 3 participants 7 messages Mar 13, 2025 – Mar 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover perf vendor events arm64: AmpereOne/AmpereOneX: Add a new errata and fix metrics calculations

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(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/2 perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata

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.

---
 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(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json +3 -1
index 0711782bfa6b..13382d29b25f 100644
@@ -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"
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json +3 -1
index a211d94aacde..6c06bc928415 100644
@@ -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"
Signature · 1 line
2.47.0
reviewer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata

Quoted 16 lines · Ilkka Koskinen

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.

---
  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(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json +0 -0
index 0711782bfa6b..13382d29b25f 100644

tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json line 5

Quoted 6 lines
tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json +3 -1
@@ -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:

#3 lore raw

Re: [PATCH 1/2] perf vendor events arm64: AmpereOne/AmpereOneX: Mark LD_RETIRED impacted by errata

Hi James,

Quoted 27 lines · James Clark
Quoted 22 lines · Ilkka Koskinen

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.

---
  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(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/memory.json +3 -1
index 0711782bfa6b..13382d29b25f 100644
@@ -1,6 +1,8 @@
  [
      {
-        "ArchStdEvent": "LD_RETIRED"
+        "ArchStdEvent": "LD_RETIRED",
+        "Errata": "Errata AC03_CPU_52",
+        "BriefDescription": "Instruction architecturally executed, 
Quoted 1 line

condition code check pass, load. Impacted by errata -"

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

Quoted 1 line

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

#4 lore raw

PATCH 2/2 perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation

In reply to Ilkka Koskinen

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")
---
 .../arch/arm64/ampere/ampereonex/metrics.json          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json +5 -5
index c5d1d22bd034..5228f94a793f 100644
@@ -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"
Signature · 1 line
2.47.0
reviewer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation

Quoted 25 lines · Ilkka Koskinen

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")
---
  .../arch/arm64/ampere/ampereonex/metrics.json          | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json +2 -2
index c5d1d22bd034..5228f94a793f 100644
@@ -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"

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json line 244

Quoted 10 lines
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json +2 -2
      },
      {
          "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.

maintainer Applied
#6 lore raw
In reply to Ilkka Koskinen
Quoted 9 lines · Ilkka Koskinen

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