Skip to contentSkip to conversation

perf vendor events arm64: Add AmpereOneX events and metrics and fix AmpereOne bugs

PATCH Applied Ilkka Koskinen 3 participants 8 messages Dec 1, 2023 – Dec 4, 2023

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

cover perf vendor events arm64: Add AmpereOneX events and metrics and fix AmpereOne bugs

Add support for AmpereOneX Core PMU events. In addition, fix typo in GPC_FLUSH_MEM_FAULT's name and add missing DefaultMetricgroupName to metrics.

Ilkka Koskinen (3):
perf vendor events arm64: AmpereOne: Add missing
DefaultMetricgroupName fields
perf vendor events arm64: AmpereOne: Rename BPU_FLUSH_MEM_FAULT to
GPC_FLUSH_MEM_FAULT
perf vendor events arm64: AmpereOneX: Add core PMU events and metrics

 .../arm64/ampere/ampereone/core-imp-def.json  |   2 +-
 .../arch/arm64/ampere/ampereone/metrics.json  |   2 +
 .../arch/arm64/ampere/ampereonex/branch.json  | 125 +++++
 .../arch/arm64/ampere/ampereonex/bus.json     |  20 +
 .../arch/arm64/ampere/ampereonex/cache.json   | 206 ++++++++
 .../arm64/ampere/ampereonex/core-imp-def.json | 464 ++++++++++++++++++
 .../arm64/ampere/ampereonex/exception.json    |  47 ++
 .../arm64/ampere/ampereonex/instruction.json  | 128 +++++
 .../arm64/ampere/ampereonex/intrinsic.json    |  14 +
 .../arch/arm64/ampere/ampereonex/memory.json  |  41 ++
 .../arch/arm64/ampere/ampereonex/metrics.json | 442 +++++++++++++++++
 .../arch/arm64/ampere/ampereonex/mmu.json     | 170 +++++++
 .../arm64/ampere/ampereonex/pipeline.json     |  41 ++
 .../arch/arm64/ampere/ampereonex/spe.json     |  14 +
 tools/perf/pmu-events/arch/arm64/mapfile.csv  |   1 +
 15 files changed, 1716 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/mmu.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/pipeline.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/spe.json
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/3 perf vendor events arm64: AmpereOne: Add missing DefaultMetricgroupName fields

AmpereOne metrics were missing DefaultMetricgroupName from metrics with "Default" in group name resulting perf to segfault. Add the missing field to address the issue.

Fixes 59faeaf80d02 ("perf vendor events arm64: Fix for AmpereOne metrics")
---
 tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json +2 -0
index e2848a9d4848..afcdad58ef89 100644
@@ -231,6 +231,7 @@
         "MetricName": "slots_lost_misspeculation_fraction",
         "MetricExpr": "100 * ((OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots))",
         "BriefDescription": "Fraction of slots lost due to misspeculation",
+        "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "ScaleUnit": "1percent of slots"
     },
@@ -238,6 +239,7 @@
         "MetricName": "retired_fraction",
         "MetricExpr": "100 * (OP_RETIRED / (CPU_CYCLES * #slots))",
         "BriefDescription": "Fraction of slots retiring, useful work",
+        "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
 	"ScaleUnit": "1percent of slots"
     },
Signature · 1 line
2.41.0
reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] perf vendor events arm64: AmpereOne: Add missing DefaultMetricgroupName fields

Quoted 7 lines · Ilkka Koskinen

AmpereOne metrics were missing DefaultMetricgroupName from metrics with "Default" in group name resulting perf to segfault. Add the missing field to address the issue.

Fixes 59faeaf80d02 ("perf vendor events arm64: Fix for AmpereOne metrics")

Sorry, I just stumbled across this and sent a fix too.
https://lore.kernel.org/lkml/[email protected]/
The patches are identical so I'd suggest taking this one and the first patch in my changes.

Thanks,
Ian

Quoted 27 lines
---
 tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json +2 -1
index e2848a9d4848..afcdad58ef89 100644
@@ -231,6 +231,7 @@
         "MetricName": "slots_lost_misspeculation_fraction",
         "MetricExpr": "100 * ((OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots))",
         "BriefDescription": "Fraction of slots lost due to misspeculation",
+        "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "ScaleUnit": "1percent of slots"
     },
@@ -238,6 +239,7 @@
         "MetricName": "retired_fraction",
         "MetricExpr": "100 * (OP_RETIRED / (CPU_CYCLES * #slots))",
         "BriefDescription": "Fraction of slots retiring, useful work",
+        "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
        "ScaleUnit": "1percent of slots"
     },
--

2.41.0

maintainer Applied
#3 lore raw

Re: [PATCH 1/3] perf vendor events arm64: AmpereOne: Add missing DefaultMetricgroupName fields

Em Mon, Dec 04, 2023 at 11:02:31AM -0800, Ian Rogers escreveu:

Quoted 10 lines
Quoted 7 lines · Ilkka Koskinen

AmpereOne metrics were missing DefaultMetricgroupName from metrics with "Default" in group name resulting perf to segfault. Add the missing field to address the issue.

Fixes 59faeaf80d02 ("perf vendor events arm64: Fix for AmpereOne metrics")
Quoted 6 lines

Sorry, I just stumbled across this and sent a fix too.
https://lore.kernel.org/lkml/[email protected]/
The patches are identical so I'd suggest taking this one and the first patch in my changes.

Thanks, applied the series.

- Arnaldo

#4 lore raw

PATCH 2/3 perf vendor events arm64: AmpereOne: Rename BPU_FLUSH_MEM_FAULT to GPC_FLUSH_MEM_FAULT

In reply to Ilkka Koskinen

The documentation wrongly called the event as BPU_FLUSH_MEM_FAULT and now has been fixed. Correct the name in the perf tool as well.

Fixes a9650b7f6fc0 ("perf vendor events arm64: Add AmpereOne core PMU events")
---
 .../pmu-events/arch/arm64/ampere/ampereone/core-imp-def.json    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/core-imp-def.json +1 -1
index 88b23b85e33c..879ff21e0b17 100644
@@ -110,7 +110,7 @@
     {
         "PublicDescription": "Flushes due to memory hazards",
         "EventCode": "0x121",
-        "EventName": "BPU_FLUSH_MEM_FAULT",
+        "EventName": "GPC_FLUSH_MEM_FAULT",
         "BriefDescription": "Flushes due to memory hazards"
     },
     {
Signature · 1 line
2.41.0
reviewer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] perf vendor events arm64: AmpereOne: Rename BPU_FLUSH_MEM_FAULT to GPC_FLUSH_MEM_FAULT

Quoted 6 lines · Ilkka Koskinen

The documentation wrongly called the event as BPU_FLUSH_MEM_FAULT and now has been fixed. Correct the name in the perf tool as well.

Fixes a9650b7f6fc0 ("perf vendor events arm64: Add AmpereOne core PMU events")

Thanks,
Ian

Quoted 20 lines
---
 .../pmu-events/arch/arm64/ampere/ampereone/core-imp-def.json    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/arch/arm64/ampere/ampereone/core-imp-def.json +1 -2
index 88b23b85e33c..879ff21e0b17 100644
@@ -110,7 +110,7 @@
     {
         "PublicDescription": "Flushes due to memory hazards",
         "EventCode": "0x121",
-        "EventName": "BPU_FLUSH_MEM_FAULT",
+        "EventName": "GPC_FLUSH_MEM_FAULT",
         "BriefDescription": "Flushes due to memory hazards"
     },
     {
--

2.41.0

#6 lore raw

PATCH 3/3 perf vendor events arm64: AmpereOneX: Add core PMU events and metrics

In reply to Ilkka Koskinen

Add JSON files for AmpereOneX core PMU events and metrics.

---
 .../arch/arm64/ampere/ampereonex/branch.json  | 125 +++++
 .../arch/arm64/ampere/ampereonex/bus.json     |  20 +
 .../arch/arm64/ampere/ampereonex/cache.json   | 206 ++++++++
 .../arm64/ampere/ampereonex/core-imp-def.json | 464 ++++++++++++++++++
 .../arm64/ampere/ampereonex/exception.json    |  47 ++
 .../arm64/ampere/ampereonex/instruction.json  | 128 +++++
 .../arm64/ampere/ampereonex/intrinsic.json    |  14 +
 .../arch/arm64/ampere/ampereonex/memory.json  |  41 ++
 .../arch/arm64/ampere/ampereonex/metrics.json | 442 +++++++++++++++++
 .../arch/arm64/ampere/ampereonex/mmu.json     | 170 +++++++
 .../arm64/ampere/ampereonex/pipeline.json     |  41 ++
 .../arch/arm64/ampere/ampereonex/spe.json     |  14 +
 tools/perf/pmu-events/arch/arm64/mapfile.csv  |   1 +
 13 files changed, 1713 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/mmu.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/pipeline.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereonex/spe.json
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/branch.json new file +125 -0
new file mode 100644
index 000000000000..a632755fc086
@@ -0,0 +1,125 @@
+[
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC"
+    },
+    {
+        "ArchStdEvent": "BR_RETURN_SPEC"
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC"
+    },
+    {
+        "ArchStdEvent": "BR_MIS_PRED"
+    },
+    {
+        "ArchStdEvent": "BR_PRED"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, branch not taken",
+        "EventCode": "0x8107",
+        "EventName": "BR_SKIP_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, branch not taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, immediate branch taken",
+        "EventCode": "0x8108",
+        "EventName": "BR_IMMED_TAKEN_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, immediate branch taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, indirect branch excluding return retired",
+        "EventCode": "0x810c",
+        "EventName": "BR_INDNR_TAKEN_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, indirect branch excluding return retired"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted immediate branch",
+        "EventCode": "0x8110",
+        "EventName": "BR_IMMED_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted immediate branch"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted immediate branch",
+        "EventCode": "0x8111",
+        "EventName": "BR_IMMED_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted immediate branch"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted indirect branch",
+        "EventCode": "0x8112",
+        "EventName": "BR_IND_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted indirect branch"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted indirect branch",
+        "EventCode": "0x8113",
+        "EventName": "BR_IND_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted indirect branch"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted procedure return",
+        "EventCode": "0x8114",
+        "EventName": "BR_RETURN_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted procedure return"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted procedure return",
+        "EventCode": "0x8115",
+        "EventName": "BR_RETURN_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted procedure return"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted indirect branch excluding return",
+        "EventCode": "0x8116",
+        "EventName": "BR_INDNR_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted indirect branch excluding return"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted indirect branch excluding return",
+        "EventCode": "0x8117",
+        "EventName": "BR_INDNR_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted indirect branch excluding return"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted branch, taken",
+        "EventCode": "0x8118",
+        "EventName": "BR_TAKEN_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted branch, taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted branch, taken",
+        "EventCode": "0x8119",
+        "EventName": "BR_TAKEN_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted branch, taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted branch, not taken",
+        "EventCode": "0x811a",
+        "EventName": "BR_SKIP_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted branch, not taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, mispredicted branch, not taken",
+        "EventCode": "0x811b",
+        "EventName": "BR_SKIP_MIS_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, mispredicted branch, not taken"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, predicted branch",
+        "EventCode": "0x811c",
+        "EventName": "BR_PRED_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, predicted branch"
+    },
+    {
+        "PublicDescription": "Instruction architecturally executed, indirect branch",
+        "EventCode": "0x811d",
+        "EventName": "BR_IND_RETIRED",
+        "BriefDescription": "Instruction architecturally executed, indirect branch"
+    },
+    {
+        "PublicDescription": "Branch Record captured.",
+        "EventCode": "0x811f",
+        "EventName": "BRB_FILTRATE",
+        "BriefDescription": "Branch Record captured."
+    }
+]
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/bus.json new file +20 -0
new file mode 100644
index 000000000000..2aeb9907831d
@@ -0,0 +1,20 @@
+[
+    {
+        "ArchStdEvent": "CPU_CYCLES"
+    },
+    {
+        "ArchStdEvent": "BUS_CYCLES"
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD"
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR"
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS"
+    },
+    {
+        "ArchStdEvent": "CNT_CYCLES"
+    }
+]
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/cache.json new file +206 -0

206 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/core-imp-def.json new file +464 -0

464 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/exception.json new file +47 -0

47 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/instruction.json new file +128 -0

128 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/intrinsic.json new file +14 -0
new file mode 100644
index 000000000000..7ecffb989ae0
@@ -0,0 +1,14 @@
+[
+    {
+        "ArchStdEvent": "LDREX_SPEC"
+    },
+    {
+        "ArchStdEvent": "STREX_PASS_SPEC"
+    },
+    {
+        "ArchStdEvent": "STREX_FAIL_SPEC"
+    },
+    {
+        "ArchStdEvent": "STREX_SPEC"
+    }
+]
tools/perf/pmu-events/arch/arm64/ampere/ampereonex/memory.json new file +41 -0

41 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/metrics.json new file +442 -0

442 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/mmu.json new file +170 -0

170 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/pipeline.json new file +41 -0

41 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/ampereonex/spe.json new file +14 -0
new file mode 100644
index 000000000000..20f2165c85fe
@@ -0,0 +1,14 @@
+[
+    {
+        "ArchStdEvent": "SAMPLE_POP"
+    },
+    {
+        "ArchStdEvent": "SAMPLE_FEED"
+    },
+    {
+        "ArchStdEvent": "SAMPLE_FILTRATE"
+    },
+    {
+        "ArchStdEvent": "SAMPLE_COLLISION"
+    }
+]
tools/perf/pmu-events/arch/arm64/mapfile.csv +1 -0
index 32674ddd2b63..d286354d8753 100644
@@ -42,3 +42,4 @@
 0x00000000480fd010,v1,hisilicon/hip08,core
 0x00000000500f0000,v1,ampere/emag,core
 0x00000000c00fac30,v1,ampere/ampereone,core
+0x00000000c00fac40,v1,ampere/ampereonex,core
Signature · 1 line
2.41.0