Skip to contentSkip to conversation

drivers: perf: Add Marvell CN10K LLC-TAD pmu driver

PATCH Superseded Bhaskara Budiredla 2 participants 4 messages Sep 1, 2021 – Sep 7, 2021

Subsystems (2)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover drivers: perf: Add Marvell CN10K LLC-TAD pmu driver

This series introduces performance monitor driver to Last-level-cache tag-and-data (LLC-TAD) PMU which is an intergral part of Marvell CN10K SoCs. The configuration and functionality of the TAD PMU is covered in patch 1. The device tree bindings are dealt in patch 2.

v4:
- rebased on kernel v5.14-rc7
- eliminate yamllint errors (Rob Herring)

v3:
- rebased on kernel v5.14-rc5
- disable sampling events via PERF_PMU_CAP_NO_INTERRUPT (Will Deacon)
- convert tad pmu bindings to schema (Will Deacon)
- replace tighter semantics with *_relaxed() accesses (Will Deacon)
- use PMU_EVENT_ATTR_ID generic macro (Will Deacon)
- allow cleanup of allocations through devm_kcalloc() (Will Deacon)

v2:
- rebased on kernel v5.13-rc3

Bhaskara Budiredla (2):
drivers: perf: Add LLC-TAD perf counter support
dt-bindings: perf: Add YAML schemas for Marvell CN10K LLC-TAD pmu
bindings

 .../bindings/perf/marvell-cn10k-tad.yaml      |  60 +++
 drivers/perf/Kconfig                          |   7 +
 drivers/perf/Makefile                         |   1 +
 drivers/perf/marvell_cn10k_tad_pmu.c          | 429 ++++++++++++++++++
 4 files changed, 497 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml
 create mode 100644 drivers/perf/marvell_cn10k_tad_pmu.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH v4 1/2 drivers: perf: Add LLC-TAD perf counter support

This driver adds support for Last-level cache tag-and-data unit (LLC-TAD) PMU that is featured in some of the Marvell's CN10K infrastructure silicons.

The LLC is divided into 2N slices distributed across N Mesh tiles in a single-socket configuration. The driver always configures the same counter for all of the TADs. The user would end up effectively reserving one of eight counters in every TAD to look across all TADs. The occurrences of events are aggregated and presented to the user at the end of an application run. The driver does not provide a way for the user to partition TADs so that different TADs are used for different applications.

The event counters are zeroed to start event counting to avoid any rollover issues. TAD perf counters are 64-bit, so it's not currently possible to overflow event counters at current mesh and core frequencies.

To measure tad pmu events use perf tool stat command. For instance:

perf stat -e tad_dat_msh_in_dss,tad_req_msh_out_any <application> perf stat -e tad_alloc_any,tad_hit_any,tad_tag_rd <application>

---
 drivers/perf/Kconfig                 |   7 +
 drivers/perf/Makefile                |   1 +
 drivers/perf/marvell_cn10k_tad_pmu.c | 429 +++++++++++++++++++++++++++
 3 files changed, 437 insertions(+)
 create mode 100644 drivers/perf/marvell_cn10k_tad_pmu.c
drivers/perf/Kconfig +7 -0
index 77522e5efe11..73dca11f8080 100644
@@ -137,6 +137,13 @@ config ARM_DMC620_PMU
 	  Support for PMU events monitoring on the ARM DMC-620 memory
 	  controller.
 
+config MARVELL_CN10K_TAD_PMU
+	tristate "Marvell CN10K LLC-TAD PMU"
+	depends on ARM64
+	help
+	  Provides support for Last-Level cache Tag-and-data Units (LLC-TAD)
+	  performance monitors on CN10K family silicons.
+
 source "drivers/perf/hisilicon/Kconfig"
 
 endmenu
drivers/perf/Makefile +1 -0
index 5260b116c7da..2db5418d5b0a 100644
@@ -14,3 +14,4 @@ obj-$(CONFIG_THUNDERX2_PMU) += thunderx2_pmu.o
 obj-$(CONFIG_XGENE_PMU) += xgene_pmu.o
 obj-$(CONFIG_ARM_SPE_PMU) += arm_spe_pmu.o
 obj-$(CONFIG_ARM_DMC620_PMU) += arm_dmc620_pmu.o
+obj-$(CONFIG_MARVELL_CN10K_TAD_PMU) += marvell_cn10k_tad_pmu.o
drivers/perf/marvell_cn10k_tad_pmu.c new file +429 -0

429 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v4 2/2 dt-bindings: perf: Add YAML schemas for Marvell CN10K LLC-TAD pmu bindings

In reply to Bhaskara Budiredla

Add device tree bindings for Last-level-cache Tag-and-data (LLC-TAD) unit PMU for Marvell CN10K SoCs.

---
 .../bindings/perf/marvell-cn10k-tad.yaml      | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +60 -0
new file mode 100644
index 000000000000..18e9499f2df8
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/perf/marvell-cn10k-tad.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell CN10K LLC-TAD performance monitor
+
+maintainers:
+  - Bhaskara Budiredla <[email protected]>
+
+description: |
+  The Tag-and-Data units (TADs) maintain coherence and contain CN10K
+  shared on-chip last level cache (LLC). The tad pmu measures the
+  performance of last-level cache. Each tad pmu supports up to eight
+  counters.
+
+  The DT setup comprises of number of tad blocks, the sizes of pmu
+  regions, tad blocks and overall base address of the HW.
+
+properties:
+  compatible:
+    const: marvell,cn10k-tad-pmu
+
+  tad-cnt:
+    maxItems: 1
+
+  tad-page-size:
+    maxItems: 1
+
+  tad-pmu-page-size:
+    maxItems: 1
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - tad-cnt
+  - tad-page-size
+  - tad-pmu-page-size
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+
+    tad {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        tad_pmu@80000000 {
+            compatible = "marvell,cn10k-tad-pmu";
+            tad-cnt = <1>;
+            tad-page-size = <0x1000>;
+            tad-pmu-page-size = <0x1000>;
+            reg = <0x87e2 0x80000000 0x0 0x1000>;
+        };
+    };
Signature · 1 line
2.17.1
maintainer
#3 lore raw

Re: [PATCH v4 2/2] dt-bindings: perf: Add YAML schemas for Marvell CN10K LLC-TAD pmu bindings

Quoted 6 lines · Bhaskara Budiredla

Add device tree bindings for Last-level-cache Tag-and-data (LLC-TAD) unit PMU for Marvell CN10K SoCs.

---
 .../bindings/perf/marvell-cn10k-tad.yaml      | 60 +++++++++++++++++++

marvell,cn10k-tad-pmu.yaml

Quoted 32 lines
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +23 -0
new file mode 100644
index 000000000000..18e9499f2df8
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/perf/marvell-cn10k-tad.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell CN10K LLC-TAD performance monitor
+
+maintainers:
+  - Bhaskara Budiredla <[email protected]>
+
+description: |
+  The Tag-and-Data units (TADs) maintain coherence and contain CN10K
+  shared on-chip last level cache (LLC). The tad pmu measures the
+  performance of last-level cache. Each tad pmu supports up to eight
+  counters.
+
+  The DT setup comprises of number of tad blocks, the sizes of pmu
+  regions, tad blocks and overall base address of the HW.
+
+properties:
+  compatible:
+    const: marvell,cn10k-tad-pmu

Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml line 32

Quoted 10 lines
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +9 -0
+
 
+  tad-cnt:
+    maxItems: 1
+
+  tad-page-size:
+    maxItems: 1
+
+  tad-pmu-page-size:
+    maxItems: 1

These all need vendor prefix, a type, description, and any constraints.

Quoted 11 lines
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +11 -0
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - tad-cnt
+  - tad-page-size
+  - tad-pmu-page-size
+  - reg
+

Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml line 53

Quoted 10 lines
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +10 -0
+additionalProperties: false
+
+examples:
+  - |
+
+    tad {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        tad_pmu@80000000 {

pmu@...

Quoted 11 lines
Documentation/devicetree/bindings/perf/marvell-cn10k-tad.yaml new file +7 -0
+            compatible = "marvell,cn10k-tad-pmu";
+            tad-cnt = <1>;
+            tad-page-size = <0x1000>;
+            tad-pmu-page-size = <0x1000>;
+            reg = <0x87e2 0x80000000 0x0 0x1000>;
+        };
+    };
Signature · 1 line
2.17.1