Skip to contentSkip to conversation

perf vendor events arm64: Revise core JSON events for eMAG

PATCH Superseded Sean V Kelley 3 participants 8 messages Sep 10, 2018 – Sep 17, 2018

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +23 -0
new file mode 100644
index 000000000000..abc98b018446
@@ -0,0 +1,23 @@
+[
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_RETURN_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC",
+    },
+    {
+        "PublicDescription": "Mispredicted or not predicted branch speculatively executed",
+        "EventCode": "0x10",
+        "EventName": "BR_MIS_PRED",
+        "BriefDescription": "Branch mispredicted"
+    },
+    {
+        "PublicDescription": "Predictable branch speculatively executed",
+        "EventCode": "0x12",
+        "EventName": "BR_PRED",
+        "BriefDescription": "Predictable branch"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +26 -0
new file mode 100644
index 000000000000..687b2629e1d1
@@ -0,0 +1,26 @@
+[
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NOT_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NORMAL",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_PERIPH",
+    },
+    {
+        "PublicDescription": "Bus access",
+        "EventCode": "0x19",
+        "EventName": "BUS_ACCESS",
+        "BriefDescription": "Bus access"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json new file +191 -0

191 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json new file +20 -0
new file mode 100644
index 000000000000..38cd1f1a70dc
@@ -0,0 +1,20 @@
+[
+    {
+        "PublicDescription": "The number of core clock cycles",
+        "EventCode": "0x11",
+        "EventName": "CPU_CYCLES",
+        "BriefDescription": "Clock cycles"
+    },
+    {
+        "PublicDescription": "FSU clocking gated off cycle",
+        "EventCode": "0x101",
+        "EventName": "FSU_CLOCK_OFF_CYCLES",
+        "BriefDescription": "FSU clocking gated off cycle"
+    },
+    {
+        "PublicDescription": "Wait state cycle",
+        "EventCode": "0x110",
+        "EventName": "Wait_CYCLES",
+        "BriefDescription": "Wait state cycle"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json deleted +0 -32
deleted file mode 100644
index bc03c06c3918..000000000000
@@ -1,32 +0,0 @@
-[
-    {
-        "ArchStdEvent": "L1D_CACHE_RD",
-    },
-    {
-        "ArchStdEvent": "L1D_CACHE_WR",
-    },
-    {
-        "ArchStdEvent": "L1D_CACHE_REFILL_RD",
-    },
-    {
-        "ArchStdEvent": "L1D_CACHE_REFILL_WR",
-    },
-    {
-        "ArchStdEvent": "L1D_TLB_REFILL_RD",
-    },
-    {
-        "ArchStdEvent": "L1D_TLB_REFILL_WR",
-    },
-    {
-        "ArchStdEvent": "L1D_TLB_RD",
-    },
-    {
-        "ArchStdEvent": "L1D_TLB_WR",
-    },
-    {
-        "ArchStdEvent": "BUS_ACCESS_RD",
-   },
-   {
-        "ArchStdEvent": "BUS_ACCESS_WR",
-   }
-]
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +8 -0
new file mode 100644
index 000000000000..6561ed58f13f
@@ -0,0 +1,8 @@
+[
+    {
+        "PublicDescription": "For odd-numbered counters, increments the count by one for each overflow of the preceding even-numbered counter. For even-numbered counters there is no increment.",
+        "EventCode": "0x1e",
+        "EventName": "CHAIN",
+        "BriefDescription": "Chain counter"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json new file +50 -0

50 lines not on this page · raw message

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

89 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json new file +14 -0
new file mode 100644
index 000000000000..2aecc5c2347d
@@ -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/emag/memory.json new file +29 -0
new file mode 100644
index 000000000000..08508697b318
@@ -0,0 +1,29 @@
+[
+    {
+        "ArchStdEvent": "MEM_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "MEM_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_LD_SPEC",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_ST_SPEC",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_LDST_SPEC",
+    },
+    {
+        "PublicDescription": "Data memory access",
+        "EventCode": "0x13",
+        "EventName": "MEM_ACCESS",
+        "BriefDescription": "Memory access"
+    },
+    {
+        "PublicDescription": "Local memory error. This event counts any correctable or uncorrectable memory error (ECC or parity) in the protected core RAMs",
+        "EventCode": "0x1a",
+        "EventName": "MEM_ERROR",
+        "BriefDescription": "Memory error"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Quoted 36 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
Quoted 8 lines
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json

I don't feel too strongly about this, but it would be better to organise all arm64 JSONs into this same structre for consistency?

However I actually like a single per-chip JSON for arm64 since it allows easy diff against armv8-recommended.json, so we don't miss/replicate events.

Quoted 12 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +5 -0
new file mode 100644
index 000000000000..abc98b018446
@@ -0,0 +1,23 @@
+[
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC",
+    },
+    {

tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json line 15

Quoted 10 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +10 -0
+        "ArchStdEvent": "BR_RETURN_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC",
+    },
+    {
+        "PublicDescription": "Mispredicted or not predicted branch speculatively executed",
+        "EventCode": "0x10",
+        "EventName": "BR_MIS_PRED",
+        "BriefDescription": "Branch mispredicted"

Isn't this a common architectural event, covered by the arm64 kernel perf driver?

Quoted 31 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +8 -0
+    },
+    {
+        "PublicDescription": "Predictable branch speculatively executed",
+        "EventCode": "0x12",
+        "EventName": "BR_PRED",
+        "BriefDescription": "Predictable branch"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +17 -0
new file mode 100644
index 000000000000..687b2629e1d1
@@ -0,0 +1,26 @@
+[
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NOT_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NORMAL",
+    },
+    {

tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json line 26

Quoted 10 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +9 -0
+        "ArchStdEvent": "BUS_ACCESS_PERIPH",
+    },
+    {
+        "PublicDescription": "Bus access",
+        "EventCode": "0x19",
+        "EventName": "BUS_ACCESS",
+        "BriefDescription": "Bus access"
 
+    },
+]

Thanks,
John

#2 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Quoted 47 lines · John Garry
Quoted 36 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
Quoted 8 lines
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
Quoted 5 lines

I don't feel too strongly about this, but it would be better to organise all arm64 JSONs into this same structre for consistency?

However I actually like a single per-chip JSON for arm64 since it allows easy diff against armv8-recommended.json, so we don't miss/replicate events.

Well for those matching implementation defined counters, i.e., "ArchStdEvent", we could retain core-imp-def.json.
But allow break-out of the rest. That would satisfy the easy diff against the armv8-recommended.json.

Quoted 19 lines
Quoted 19 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +10 -0
new file mode 100644
index 000000000000..abc98b018446
@@ -0,0 +1,23 @@
+[
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_RETURN_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC",
+    },
Quoted 9 lines

tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json line 15

Quoted 5 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +5 -0
+    {
+        "PublicDescription": "Mispredicted or not predicted branch speculatively executed",
+        "EventCode": "0x10",
+        "EventName": "BR_MIS_PRED",
+        "BriefDescription": "Branch mispredicted"

Isn't this a common architectural event, covered by the arm64 kernel perf driver?

Yes, it is exposed by the ARM64 perf driver, armv8_pmuv3_0. I'm not sure that an additional alias would be problematic and it actually allows for descriptions.
Finally, I'm trying to synchronize this patch with a patch to ARM's StreamLine gator daemon here with the same information:

https://github.com/ARM-software/gator/pull/5/commits/bfd20f692ac4ff69b0363ec57d78ed7ed914adca

Thanks,

Sean

Quoted 46 lines
Quoted 32 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +8 -0
+    },
+    {
+        "PublicDescription": "Predictable branch speculatively executed",
+        "EventCode": "0x12",
+        "EventName": "BR_PRED",
+        "BriefDescription": "Predictable branch"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +17 -0
new file mode 100644
index 000000000000..687b2629e1d1
@@ -0,0 +1,26 @@
+[
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NOT_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NORMAL",
+    },
+    {

tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json line 26

Quoted 10 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +9 -0
+        "ArchStdEvent": "BUS_ACCESS_PERIPH",
+    },
+    {
+        "PublicDescription": "Bus access",
+        "EventCode": "0x19",
+        "EventName": "BUS_ACCESS",
+        "BriefDescription": "Bus access"
 
+    },
+]

Thanks,
John

#3 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Quoted 10 lines · Sean V Kelley
Quoted 8 lines · John Garry
Quoted 6 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Gentle reminder for additional feedback on my V2 patch.

Thanks!

Sean

Quoted 133 lines
Quoted 31 lines
Quoted 22 lines
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
Quoted 8 lines
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
Quoted 5 lines

I don't feel too strongly about this, but it would be better to organise all arm64 JSONs into this same structre for consistency?

However I actually like a single per-chip JSON for arm64 since it allows easy diff against armv8-recommended.json, so we don't miss/replicate events.

Well for those matching implementation defined counters, i.e., "ArchStdEvent", we could retain core-imp-def.json.
But allow break-out of the rest. That would satisfy the easy diff against the armv8-recommended.json.

Quoted 19 lines
Quoted 19 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +10 -0
new file mode 100644
index 000000000000..abc98b018446
@@ -0,0 +1,23 @@
+[
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_RETURN_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC",
+    },
Quoted 9 lines

tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json line 15

Quoted 5 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +5 -0
+    {
+        "PublicDescription": "Mispredicted or not predicted branch speculatively executed",
+        "EventCode": "0x10",
+        "EventName": "BR_MIS_PRED",
+        "BriefDescription": "Branch mispredicted"

Isn't this a common architectural event, covered by the arm64 kernel perf driver?

Yes, it is exposed by the ARM64 perf driver, armv8_pmuv3_0. I'm not sure that an additional alias would be problematic and it actually allows for descriptions.
Finally, I'm trying to synchronize this patch with a patch to ARM's StreamLine gator daemon here with the same information:

https://github.com/ARM-software/gator/pull/5/commits/bfd20f692ac4ff69b0363ec57d78ed7ed914adca

Thanks,

Sean

Quoted 46 lines
Quoted 32 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json new file +8 -0
+    },
+    {
+        "PublicDescription": "Predictable branch speculatively executed",
+        "EventCode": "0x12",
+        "EventName": "BR_PRED",
+        "BriefDescription": "Predictable branch"
+    },
+]
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +17 -0
new file mode 100644
index 000000000000..687b2629e1d1
@@ -0,0 +1,26 @@
+[
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NOT_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NORMAL",
+    },
+    {

tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json line 26

Quoted 10 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json new file +9 -0
+        "ArchStdEvent": "BUS_ACCESS_PERIPH",
+    },
+    {
+        "PublicDescription": "Bus access",
+        "EventCode": "0x19",
+        "EventName": "BUS_ACCESS",
+        "BriefDescription": "Bus access"
 
+    },
+]

Thanks,
John

#4 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

In reply to Sean V Kelley
Quoted 36 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
Quoted 8 lines
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json

Hi,

The patch looks okay for most part. It would be good to factor out the events 0x00-0x38 from "Table D5-8 PMU common architectural and microarchitectural event numbers" in https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf and have them in armv8-recommended.json so events like BR_MIS_PRED and BR_PRED (and anything else in the range of 0x000-0x038) just end up be ArchStdEvent like the other predefined events. Maybe do the factoring out as a follow on patch to this patch.

The following counter.json wouldn't be that useful. Perf doesn't allow layout of what goes in which PMU register. It should be removed:

Quoted 6 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +0 -0
new file mode 100644
index 000000000000..6561ed58f13f

tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json line 8

Quoted 8 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +8 -0
@@ -0,0 +1,8 @@
+[
+    {
+        "PublicDescription": "For odd-numbered counters, increments the count by one for each overflow of the preceding even-numbered counter. For even-numbered counters there is no increment.",
+        "EventCode": "0x1e",
+        "EventName": "CHAIN",
+        "BriefDescription": "Chain counter"
+    },
+]

-Will Cohen

#5 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Quoted 46 lines · William Cohen
Quoted 36 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

--
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William --

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc William Cohen <[email protected]>
Cc John Garry <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
Quoted 8 lines
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
Quoted 4 lines

Hi,

The patch looks okay for most part. It would be good to factor out the events 0x00-0x38 from "Table D5-8 PMU common architectural and microarchitectural event numbers" in https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf and have them in armv8-recommended.json so events like BR_MIS_PRED and BR_PRED (and anything else in the range of 0x000-0x038) just end up be ArchStdEvent like the other predefined events. Maybe do the factoring out as a follow on patch to this patch.

I know it's not ideal, but I think it would be better to only use the common arch events exposed by the pmu kernel driver, as:
- it's generally bad to replicate
- the common arch event support are detected by PMCEIDx, so there is need to add perf tool churn in defining per-SoC support
- potential problems in enabling replicated events

Thanks,
John

Quoted 23 lines

The following counter.json wouldn't be that useful. Perf doesn't allow layout of what goes in which PMU register. It should be removed:

Quoted 6 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +0 -0
new file mode 100644
index 000000000000..6561ed58f13f

tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json line 8

Quoted 8 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +8 -0
@@ -0,0 +1,8 @@
+[
+    {
+        "PublicDescription": "For odd-numbered counters, increments the count by one for each overflow of the preceding even-numbered counter. For even-numbered counters there is no increment.",
+        "EventCode": "0x1e",
+        "EventName": "CHAIN",
+        "BriefDescription": "Chain counter"
+    },
+]

-Will Cohen

.

#6 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Quoted 52 lines · John Garry
Quoted 46 lines · William Cohen
Quoted 4 lines · Sean V Kelley

Split the PMU events into meaningful functional groups.? Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

Quoted 40 lines

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

Signature · 35 lines
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William
-- 

Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: William Cohen <[email protected]>
Cc: John Garry <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org

Signed-off-by: Sean V Kelley <[email protected]>
---
?.../arch/arm64/ampere/emag/branch.json??????? |? 23 +++
?.../arch/arm64/ampere/emag/bus.json?????????? |? 26 +++
?.../arch/arm64/ampere/emag/cache.json???????? | 191 ++++++++++++++++++
?.../arch/arm64/ampere/emag/clock.json???????? |? 20 ++
?.../arch/arm64/ampere/emag/core-imp-def.json? |? 32 ---
?.../arch/arm64/ampere/emag/counter.json?????? |?? 8 +
?.../arch/arm64/ampere/emag/exception.json???? |? 50 +++++
?.../arch/arm64/ampere/emag/instruction.json?? |? 89 ++++++++
?.../arch/arm64/ampere/emag/intrinsic.json???? |? 14 ++
?.../arch/arm64/ampere/emag/memory.json??????? |? 29 +++
?.../arch/arm64/ampere/emag/pipeline.json????? |? 50 +++++
?11 files changed, 500 insertions(+), 32 deletions(-)
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
?delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
?create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
Quoted 4 lines

Hi,

The patch looks okay for most part. It would be good to factor out the events 0x00-0x38 from "Table D5-8 PMU common architectural and microarchitectural event numbers" in https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf and have them in armv8-recommended.json so events like BR_MIS_PRED and BR_PRED (and anything else in the range of 0x000-0x038) just end up be ArchStdEvent like the other predefined events.? Maybe do the factoring out as a follow on patch to this patch.

Quoted 7 lines

I know it's not ideal, but I think it would be better to only use the common arch events exposed by the pmu kernel driver, as:
- it's generally bad to replicate
- the common arch event support are detected by PMCEIDx, so there is need to add perf tool churn in defining per-SoC support
- potential problems in enabling replicated events

Thanks,
John

Yes, definitely want minimize duplication. If the kernel is already determing which common events are available in an AARCH64 process then should be able to eliminate any entry that is below ARMV8_PMUV3_MAX_COMMON_EVENTS (0x40) from the event maps:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/perf/arm_pmu.h#n104
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/perf_event.c#n1007

-Will Cohen

Quoted 26 lines
Quoted 24 lines

The following counter.json wouldn't be that useful.? Perf doesn't allow layout of what goes in which PMU register. It should be removed:

Quoted 6 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +0 -0
new file mode 100644
index 000000000000..6561ed58f13f

tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json line 8

Quoted 8 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +8 -0
@@ -0,0 +1,8 @@
+[
+??? {
+??????? "PublicDescription": "For odd-numbered counters, increments the count by one for each overflow of the preceding even-numbered counter. For even-numbered counters there is no increment.",
+??????? "EventCode": "0x1e",
+??????? "EventName": "CHAIN",
+??????? "BriefDescription": "Chain counter"
+??? },
+]

-Will Cohen

.

#7 lore raw

PATCH v2 1/1 perf vendor events arm64: Revise core JSON events for eMAG

Sent from my iPhone

Quoted 60 lines · William Cohen
Quoted 59 lines · John Garry
Quoted 47 lines · William Cohen
Quoted 5 lines · Sean V Kelley

Split the PMU events into meaningful functional groups. Update core pmu events based on supported ARMv8 recommended IMPLEMENTATION DEFINED events.

Quoted 40 lines

The JSON files are updated with reference to a PMU table shared here:

https://github.com/AmpereComputing/ampere-centos-kernel/blob/amp-centos-7.5-kernel/Documentation/arm64/eMAG-ARM-CoreImpDefined.pdf

Signature · 35 lines
Changes in V2:
- Provided documentation for changes - John, William
- Broke up into meaningful groups - William
-- 

Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: William Cohen <[email protected]>
Cc: John Garry <[email protected]>
Cc: linux-arm-kernel at lists.infradead.org

Signed-off-by: Sean V Kelley <[email protected]>
---
 .../arch/arm64/ampere/emag/branch.json        |  23 +++
 .../arch/arm64/ampere/emag/bus.json           |  26 +++
 .../arch/arm64/ampere/emag/cache.json         | 191 ++++++++++++++++++
 .../arch/arm64/ampere/emag/clock.json         |  20 ++
 .../arch/arm64/ampere/emag/core-imp-def.json  |  32 ---
 .../arch/arm64/ampere/emag/counter.json       |   8 +
 .../arch/arm64/ampere/emag/exception.json     |  50 +++++
 .../arch/arm64/ampere/emag/instruction.json   |  89 ++++++++
 .../arch/arm64/ampere/emag/intrinsic.json     |  14 ++
 .../arch/arm64/ampere/emag/memory.json        |  29 +++
 .../arch/arm64/ampere/emag/pipeline.json      |  50 +++++
 11 files changed, 500 insertions(+), 32 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/branch.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/bus.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/clock.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/core-imp-def.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/exception.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/intrinsic.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/memory.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/emag/pipeline.json
Quoted 4 lines

Hi,

The patch looks okay for most part. It would be good to factor out the events 0x00-0x38 from "Table D5-8 PMU common architectural and microarchitectural event numbers" in https://static.docs.arm.com/ddi0487/ca/DDI0487C_a_armv8_arm.pdf and have them in armv8-recommended.json so events like BR_MIS_PRED and BR_PRED (and anything else in the range of 0x000-0x038) just end up be ArchStdEvent like the other predefined events. Maybe do the factoring out as a follow on patch to this patch.

I know it's not ideal, but I think it would be better to only use the common arch events exposed by the pmu kernel driver, as:
- it's generally bad to replicate
- the common arch event support are detected by PMCEIDx, so there is need to add perf tool churn in defining per-SoC support
- potential problems in enabling replicated events

Quoted 4 lines
Quoted 2 lines

Thanks,
John

Yes, definitely want minimize duplication. If the kernel is already determing which common events are available in an AARCH64 process then should be able to eliminate any entry that is below ARMV8_PMUV3_MAX_COMMON_EVENTS (0x40) from the event maps:

Hi

Definitely would like to reduce duplication while providing descriptive and meaningful access to users. I can strip the sub 0x40 common events already exposed in the PMU perf driver in a v4 patch for now.

But as you say, the kernel already knows what is exposed by the core pmu driver and could eliminate the duplication.

Thanks

Sean

Quoted 32 lines

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/perf/arm_pmu.h#n104
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/perf_event.c#n1007

-Will Cohen

Quoted 26 lines

Hi

Quoted 23 lines

The following counter.json wouldn't be that useful. Perf doesn't allow layout of what goes in which PMU register. It should be removed:

Quoted 6 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +0 -0
new file mode 100644
index 000000000000..6561ed58f13f

tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json line 8

Quoted 8 lines
tools/perf/pmu-events/arch/arm64/ampere/emag/counter.json new file +8 -0
@@ -0,0 +1,8 @@
+[
+    {
+        "PublicDescription": "For odd-numbered counters, increments the count by one for each overflow of the preceding even-numbered counter. For even-numbered counters there is no increment.",
+        "EventCode": "0x1e",
+        "EventName": "CHAIN",
+        "BriefDescription": "Chain counter"
+    },
+]

-Will Cohen

.