Skip to contentSkip to conversation

perf vendor events arm64: Update N2 and V2 metrics and events using Arm telemetry repo

PATCH Applied James Clark 3 participants 24 messages Aug 11, 2023 – Aug 16, 2023

Subsystems (3)

v5 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover perf vendor events arm64: Update N2 and V2 metrics and events using Arm telemetry repo

This is a completely new approach from V3 [1], although the metrics and event descriptions are autogenerated, the topdown metrics have been manually edited to use #no_stall_errata (now directly comparing on the CPUID in v5). This removes the need to duplicate the whole set of JSONs when only the topdown metrics are different between N2 and V2.

The CPU ID comparison function still needs to change so that the new literal can compare on versions, but now no change is needed to mapfile or the PMU event generation code because we still only support one set of JSONs per CPU.

[1]: https://lore.kernel.org/lkml/[email protected]/

------

Changes since v4:
* Replace the #no_stall_errata literal with a more generic function for comparing CPU IDs. This will hopefully keep configuration out of the code and inside the JSONs

Changes since v3:
* Instead of duplicating all the metrics, add a new expression literal that can be used to share the same metrics between N2 and V2
* Move tests to arch/arm64/tests
* Remove changes from jevents.py and mapfile.csv

Changes since v2:
* version -> variant in second commit message
* Add a bit more detail about version matching in the second commit message
* Update the comments in pmu-events/arch/arm64/mapfile.csv to say that variant and revision fields are now used
* Increase the CC list

Changes since v1:
* Split last change into two so it doesn't hit the mailing list size limit

James Clark (6):
perf: cs-etm: Don't duplicate FIELD_GET()
perf arm64: Allow version comparisons of CPU IDs
perf test: Add a test for the new Arm CPU ID comparison behavior perf vendor events arm64: Update scale units and descriptions of
common topdown metrics
perf vendor events arm64: Update stall_slot workaround for N2 r0p3 perf vendor events arm64: Update N2 and V2 metrics and events using
Arm telemetry repo

 tools/perf/arch/arm64/include/arch-tests.h    |   3 +
 tools/perf/arch/arm64/tests/Build             |   1 +
 tools/perf/arch/arm64/tests/arch-tests.c      |   4 +
 tools/perf/arch/arm64/tests/cpuid-match.c     |  38 ++
 tools/perf/arch/arm64/util/header.c           |  64 ++-
 tools/perf/arch/arm64/util/pmu.c              |  18 +-
 .../arch/arm64/arm/neoverse-n2-v2/branch.json |   8 -
 .../arch/arm64/arm/neoverse-n2-v2/bus.json    |  18 +-
 .../arch/arm64/arm/neoverse-n2-v2/cache.json  | 155 --------
 .../arm64/arm/neoverse-n2-v2/exception.json   |  45 ++-
 .../arm/neoverse-n2-v2/fp_operation.json      |  22 ++
 .../arm64/arm/neoverse-n2-v2/general.json     |  10 +
 .../arm64/arm/neoverse-n2-v2/instruction.json | 143 -------
 .../arm64/arm/neoverse-n2-v2/l1d_cache.json   |  54 +++
 .../arm64/arm/neoverse-n2-v2/l1i_cache.json   |  14 +
 .../arm64/arm/neoverse-n2-v2/l2_cache.json    |  50 +++
 .../arm64/arm/neoverse-n2-v2/l3_cache.json    |  22 ++
 .../arm64/arm/neoverse-n2-v2/ll_cache.json    |  10 +
 .../arch/arm64/arm/neoverse-n2-v2/memory.json |  39 +-
 .../arm64/arm/neoverse-n2-v2/metrics.json     | 365 ++++++++++--------
 .../arm64/arm/neoverse-n2-v2/pipeline.json    |  23 --
 .../arm64/arm/neoverse-n2-v2/retired.json     |  30 ++
 .../arch/arm64/arm/neoverse-n2-v2/spe.json    |  12 +-
 .../arm/neoverse-n2-v2/spec_operation.json    | 110 ++++++
 .../arch/arm64/arm/neoverse-n2-v2/stall.json  |  30 ++
 .../arch/arm64/arm/neoverse-n2-v2/sve.json    |  50 +++
 .../arch/arm64/arm/neoverse-n2-v2/tlb.json    |  66 ++++
 .../arch/arm64/arm/neoverse-n2-v2/trace.json  |  27 +-
 tools/perf/pmu-events/arch/arm64/sbsa.json    |  24 +-
 tools/perf/pmu-events/metric.py               |  17 +-
 tools/perf/util/cs-etm.c                      |  14 +-
 tools/perf/util/expr.c                        |  18 +
 tools/perf/util/expr.h                        |   1 +
 tools/perf/util/expr.l                        |   1 +
 tools/perf/util/expr.y                        |   8 +-
 tools/perf/util/pmu.c                         |  17 +
 tools/perf/util/pmu.h                         |   1 +
 37 files changed, 923 insertions(+), 609 deletions(-)
 create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/branch.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/fp_operation.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/general.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1d_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1i_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l2_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l3_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/ll_cache.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/pipeline.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/retired.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/spec_operation.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/stall.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/sve.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/tlb.json
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/6 perf: cs-etm: Don't duplicate FIELD_GET()

linux/bitfield.h can be included as long as linux/kernel.h is included first, so change the order of the includes and drop the duplicate macro.

---
 tools/perf/util/cs-etm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
tools/perf/util/cs-etm.c +2 -12
index 1419b40dfbe8..9729d006550d 100644
@@ -6,10 +6,11 @@
  * Author: Mathieu Poirier <[email protected]>
  */
 
+#include <linux/kernel.h>
+#include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/coresight-pmu.h>
 #include <linux/err.h>
-#include <linux/kernel.h>
 #include <linux/log2.h>
 #include <linux/types.h>
 #include <linux/zalloc.h>
@@ -281,17 +282,6 @@ static int cs_etm__metadata_set_trace_id(u8 trace_chan_id, u64 *cpu_metadata)
 	return 0;
 }
 
-/*
- * FIELD_GET (linux/bitfield.h) not available outside kernel code,
- * and the header contains too many dependencies to just copy over,
- * so roll our own based on the original
- */
-#define __bf_shf(x) (__builtin_ffsll(x) - 1)
-#define FIELD_GET(_mask, _reg)						\
-	({								\
-		(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
-	})
-
 /*
  * Get a metadata for a specific cpu from an array.
  *
Signature · 1 line
2.34.1
maintainer Applied
#2 lore raw

Re: [PATCH v5 1/6] perf: cs-etm: Don't duplicate FIELD_GET()

Em Fri, Aug 11, 2023 at 03:39:18PM +0100, James Clark escreveu:

Quoted 2 lines

linux/bitfield.h can be included as long as linux/kernel.h is included first, so change the order of the includes and drop the duplicate macro.

Applied this one, to reduce the patch series size.

- Arnaldo

Quoted 44 lines
---
 tools/perf/util/cs-etm.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
tools/perf/util/cs-etm.c +2 -12
index 1419b40dfbe8..9729d006550d 100644
@@ -6,10 +6,11 @@
  * Author: Mathieu Poirier <[email protected]>
  */
 
+#include <linux/kernel.h>
+#include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/coresight-pmu.h>
 #include <linux/err.h>
-#include <linux/kernel.h>
 #include <linux/log2.h>
 #include <linux/types.h>
 #include <linux/zalloc.h>
@@ -281,17 +282,6 @@ static int cs_etm__metadata_set_trace_id(u8 trace_chan_id, u64 *cpu_metadata)
 	return 0;
 }
 
-/*
- * FIELD_GET (linux/bitfield.h) not available outside kernel code,
- * and the header contains too many dependencies to just copy over,
- * so roll our own based on the original
- */
-#define __bf_shf(x) (__builtin_ffsll(x) - 1)
-#define FIELD_GET(_mask, _reg)						\
-	({								\
-		(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
-	})
-
 /*
  * Get a metadata for a specific cpu from an array.
  *
Signature · 1 line
2.34.1
Signature · 6 lines
- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH v5 2/6 perf arm64: Allow version comparisons of CPU IDs

In reply to James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields. It also affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

---
 tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------
 1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +50 -14
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
 
 #define MIDR "/regs/identification/midr_el1"
 #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK	GENMASK(23, 20)
 
 static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
 {
 	const char *sysfs = sysfs__mountpoint();
-	u64 midr = 0;
 	int cpu;
 
 	if (!sysfs || sz < MIDR_SIZE)
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
 		}
 		fclose(file);
 
-		/* Ignore/clear Variant[23:20] and
-		 * Revision[3:0] of MIDR
-		 */
-		midr = strtoul(buf, NULL, 16);
-		midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));
-		scnprintf(buf, MIDR_SIZE, "0x%016lx", midr);
 		/* got midr break loop */
 		break;
 	}
 
 	perf_cpu_map__put(cpus);
-
-	if (!midr)
-		return EINVAL;
-
 	return 0;
 }
 
@@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu)
 
 	return buf;
 }
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.
+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)
+{
+	u64 map_id = strtoull(mapcpuid, NULL, 16);
+	char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+	char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+	u64 id = strtoull(idstr, NULL, 16);
+	char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+	char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+	u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+	/* Compare without version first */
+	if ((map_id & id_fields) != (id & id_fields))
+		return 1;
+
+	/*
+	 * ID matches, now compare version.
+	 *
+	 * Arm revisions (like r0p0) are compared here like two digit semver
+	 * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+	 * highest matching version is used.
+	 *
+	 *  r = high value = 'Variant' field in MIDR
+	 *  p = low value  = 'Revision' field in MIDR
+	 *
+	 */
+	if (id_variant > map_id_variant)
+		return 0;
+
+	if (id_variant == map_id_variant && id_revision >= map_id_revision)
+		return 0;
+
+	/*
+	 * variant is less than mapfile variant or variants are the same but
+	 * the revision doesn't match. Return no match.
+	 */
+	return 1;
+}
Signature · 1 line
2.34.1
reviewer
#4 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 7 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields.

Did you consider adding a raw version of _get_cpuid(), which returns the full MIDR just for the purpose of caller strcmp_cpuid_str()?

I can't comment on how it will be called in relation to strcmp_cpuid_str(), as I am unsure whether strcmp_cpuid_str() should be just in arch arm64 code - see comment on later patch.

It also

Quoted 63 lines

affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

---
  tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------
  1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +5 -14
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
 
  #define MIDR "/regs/identification/midr_el1"
  #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK	GENMASK(23, 20)
 
  static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  {
  	const char *sysfs = sysfs__mountpoint();
-	u64 midr = 0;
  	int cpu;
 
  	if (!sysfs || sz < MIDR_SIZE)
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  		}
  		fclose(file);
 
-		/* Ignore/clear Variant[23:20] and
-		 * Revision[3:0] of MIDR
-		 */
-		midr = strtoul(buf, NULL, 16);
-		midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));
-		scnprintf(buf, MIDR_SIZE, "0x%016lx", midr);
  		/* got midr break loop */
  		break;
  	}
 
  	perf_cpu_map__put(cpus);
-
-	if (!midr)
-		return EINVAL;
-
  	return 0;
  }
 
@@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu)
 
  	return buf;

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 101

Quoted 10 lines
tools/perf/arch/arm64/util/header.c +9 -0
  }
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.
+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)

should we check implementator and other fields as a sanity check?

Quoted 26 lines
tools/perf/arch/arm64/util/header.c +26 -0
+{
+	u64 map_id = strtoull(mapcpuid, NULL, 16);
+	char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+	char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+	u64 id = strtoull(idstr, NULL, 16);
+	char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+	char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+	u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+	/* Compare without version first */
+	if ((map_id & id_fields) != (id & id_fields))
+		return 1;
+
+	/*
+	 * ID matches, now compare version.
+	 *
+	 * Arm revisions (like r0p0) are compared here like two digit semver
+	 * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+	 * highest matching version is used.
+	 *
+	 *  r = high value = 'Variant' field in MIDR
+	 *  p = low value  = 'Revision' field in MIDR
+	 *
+	 */
+	if (id_variant > map_id_variant)
+		return 0;

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 137

Quoted 10 lines
tools/perf/arch/arm64/util/header.c +10 -0
+
+	if (id_variant == map_id_variant && id_revision >= map_id_revision)
+		return 0;
+
+	/*
+	 * variant is less than mapfile variant or variants are the same but
+	 * the revision doesn't match. Return no match.
+	 */
+	return 1;
+}

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 11 lines · John Garry
Quoted 7 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields.

Did you consider adding a raw version of _get_cpuid(), which returns the full MIDR just for the purpose of caller strcmp_cpuid_str()?

I did, but I thought that seeing as it would only be used in one place, and that changing the existing one didn't break anything, that it was better to not fragment the CPU ID interface. I thought it might also have repercussions for the other architectures as well. It would also mean that the MIDR that's stored in the header wouldn't have the version information, which if we're starting to do things with that could be bad.

There are already callers of strcmp_cpuid_str() so it's probably best to keep it using the same get_cpuid() string. Unless there is a reason _not_ to do it? There isn't really anything that can't be done with it accepting/returning the full unmasked MIDR. If you want the old behavior, you just set the version fields to 0, which I've also used in a later patch and is already done in mapfile.csv

Quoted 70 lines

I can't comment on how it will be called in relation to strcmp_cpuid_str(), as I am unsure whether strcmp_cpuid_str() should be just in arch arm64 code - see comment on later patch.

 It also

Quoted 64 lines

affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

---
  tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------

  1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +5 -3
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
   #include <stdio.h>
   #include <stdlib.h>
   #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
     #define MIDR "/regs/identification/midr_el1"
   #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK    GENMASK(23, 20)

    static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  {
      const char *sysfs = sysfs__mountpoint();
-    u64 midr = 0;
      int cpu;
        if (!sysfs || sz < MIDR_SIZE)

tools/perf/arch/arm64/util/header.c +0 -0
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct
 perf_cpu_map *cpus)
           }
           fclose(file);

  -        /* Ignore/clear Variant[23:20] and
-         * Revision[3:0] of MIDR
-         */
-        midr = strtoul(buf, NULL, 16);
-        midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK)); -        scnprintf(buf, MIDR_SIZE, "0x%016lx", midr); /* got midr break loop */
          break;
      }
        perf_cpu_map__put(cpus);

tools/perf/arch/arm64/util/header.c +0 -4
-
-    if (!midr)
-        return EINVAL;
-

      return 0;
  }
  @@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu) return buf;
  }

tools/perf/arch/arm64/util/header.c +4 -0
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.
Quoted 9 lines
Quoted 6 lines

+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)

should we check implementator and other fields as a sanity check?

I'm not sure what we could check them against? There are no existing sanity checks around the MIDR stuff, it just takes whatever MIDR is in mapfile.csv and from the system. Unless there is something specific to this change that would benefit from it? Otherwise it sounds like it could be a separate additional change to what's already in Perf.

Quoted 31 lines
Quoted 31 lines
tools/perf/arch/arm64/util/header.c +31 -0
+{
+    u64 map_id = strtoull(mapcpuid, NULL, 16);
+    char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+    char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+    u64 id = strtoull(idstr, NULL, 16);
+    char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+    char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+    u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+    /* Compare without version first */
+    if ((map_id & id_fields) != (id & id_fields))
+        return 1;
+
+    /*
+     * ID matches, now compare version.
+     *
+     * Arm revisions (like r0p0) are compared here like two digit semver
+     * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+     * highest matching version is used.
+     *
+     *  r = high value = 'Variant' field in MIDR
+     *  p = low value  = 'Revision' field in MIDR
+     *
+     */
+    if (id_variant > map_id_variant)
+        return 0;
+
+    if (id_variant == map_id_variant && id_revision >= map_id_revision)
+        return 0;
+
+    /*
Quoted 9 lines
Quoted 5 lines

+     * variant is less than mapfile variant or variants are the same but +     * the revision doesn't match. Return no match.
+     */
+    return 1;
+}

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#6 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 19 lines · James Clark
Quoted 10 lines · John Garry
Quoted 7 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields.

Did you consider adding a raw version of _get_cpuid(), which returns the full MIDR just for the purpose of caller strcmp_cpuid_str()?

I did, but I thought that seeing as it would only be used in one place, and that changing the existing one didn't break anything, that it was better to not fragment the CPU ID interface. I thought it might also have repercussions for the other architectures as well. It would also mean that the MIDR that's stored in the header wouldn't have the version information, which if we're starting to do things with that could be bad.

Quoted 7 lines

There are already callers of strcmp_cpuid_str() so it's probably best to keep it using the same get_cpuid() string. Unless there is a reason _not_ to do it? There isn't really anything that can't be done with it accepting/returning the full unmasked MIDR. If you want the old behavior, you just set the version fields to 0, which I've also used in a later patch and is already done in mapfile.csv

ok, fine, so we seems that we would be following x86 on this in terms of using strcmp_cpuid_str(). It would be good to mention that there is already a weak version of strcmp_cpuid_str() for !x86 in your commit message.

Let me check your code again...

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 28 lines · John Garry
Quoted 19 lines · James Clark
Quoted 10 lines · John Garry
Quoted 7 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields.

Did you consider adding a raw version of _get_cpuid(), which returns the full MIDR just for the purpose of caller strcmp_cpuid_str()?

I did, but I thought that seeing as it would only be used in one place, and that changing the existing one didn't break anything, that it was better to not fragment the CPU ID interface. I thought it might also have repercussions for the other architectures as well. It would also mean that the MIDR that's stored in the header wouldn't have the version information, which if we're starting to do things with that could be bad.

Quoted 7 lines

There are already callers of strcmp_cpuid_str() so it's probably best to keep it using the same get_cpuid() string. Unless there is a reason _not_  to do it? There isn't really anything that can't be done with it accepting/returning the full unmasked MIDR. If you want the old behavior, you just set the version fields to 0, which I've also used in a later patch and is already done in mapfile.csv

Quoted 5 lines

ok, fine, so we seems that we would be following x86 on this in terms of using strcmp_cpuid_str(). It would be good to mention that there is already a weak version of strcmp_cpuid_str() for !x86 in your commit message.

Yep I can add this.

Quoted 4 lines

Let me check your code again...

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#8 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

In reply to James Clark
Quoted 5 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

Quoted 7 lines

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields. It also affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

This looks ok apart from a couple of comments, below.

Thanks,
John

Quoted 41 lines
---
  tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------
  1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +5 -8
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
 
  #define MIDR "/regs/identification/midr_el1"
  #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK	GENMASK(23, 20)
 
  static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  {
  	const char *sysfs = sysfs__mountpoint();
-	u64 midr = 0;
  	int cpu;
 
  	if (!sysfs || sz < MIDR_SIZE)
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  		}
  		fclose(file);
 
-		/* Ignore/clear Variant[23:20] and
-		 * Revision[3:0] of MIDR
-		 */
-		midr = strtoul(buf, NULL, 16);

tools/perf/arch/arm64/util/header.c static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus) · line 60

Quoted 10 lines
tools/perf/arch/arm64/util/header.c +0 -5
-		midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));
-		scnprintf(buf, MIDR_SIZE, "0x%016lx", midr);
  		/* got midr break loop */
  		break;
  	}
 
  	perf_cpu_map__put(cpus);
-
-	if (!midr)
-		return EINVAL;

Is there a reason to drop this check?

As I see, it is still checked in perf_pmu__getcpudid() -> get_cpuid_str() -> _get_cpuid(), and we don't zero the buf allocated in _get_cpuid()

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 96

Quoted 12 lines
tools/perf/arch/arm64/util/header.c +4 -1
-
  	return 0;
  }
 
@@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu)
 
  	return buf;
  }
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.

And what other values may be returned? If just 0/1, then can we have a bool return value?

Quoted 31 lines
tools/perf/arch/arm64/util/header.c +31 -0
+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)
+{
+	u64 map_id = strtoull(mapcpuid, NULL, 16);
+	char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+	char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+	u64 id = strtoull(idstr, NULL, 16);
+	char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+	char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+	u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+	/* Compare without version first */
+	if ((map_id & id_fields) != (id & id_fields))
+		return 1;
+
+	/*
+	 * ID matches, now compare version.
+	 *
+	 * Arm revisions (like r0p0) are compared here like two digit semver
+	 * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+	 * highest matching version is used.
+	 *
+	 *  r = high value = 'Variant' field in MIDR
+	 *  p = low value  = 'Revision' field in MIDR
+	 *
+	 */
+	if (id_variant > map_id_variant)
+		return 0;

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 137

Quoted 10 lines
tools/perf/arch/arm64/util/header.c +10 -0
+
+	if (id_variant == map_id_variant && id_revision >= map_id_revision)
+		return 0;
+
+	/*
+	 * variant is less than mapfile variant or variants are the same but
+	 * the revision doesn't match. Return no match.
+	 */
+	return 1;
+}

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 71 lines · John Garry
Quoted 5 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

Quoted 7 lines

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields. It also affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

This looks ok apart from a couple of comments, below.

Thanks,
John

Quoted 41 lines

---
  tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------

  1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +5 -3
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
   #include <stdio.h>
   #include <stdlib.h>
   #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
     #define MIDR "/regs/identification/midr_el1"
   #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK    GENMASK(23, 20)

    static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)
  {
      const char *sysfs = sysfs__mountpoint();
-    u64 midr = 0;
      int cpu;
        if (!sysfs || sz < MIDR_SIZE)

tools/perf/arch/arm64/util/header.c +0 -0
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct
 perf_cpu_map *cpus)
           }
           fclose(file);

  -        /* Ignore/clear Variant[23:20] and
-         * Revision[3:0] of MIDR
-         */
-        midr = strtoul(buf, NULL, 16);
-        midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));

Quoted 8 lines

-        scnprintf(buf, MIDR_SIZE, "0x%016lx", midr); /* got midr break loop */
          break;
      }
        perf_cpu_map__put(cpus);
-
-    if (!midr)
-        return EINVAL;

Is there a reason to drop this check?

Quoted 4 lines

As I see, it is still checked in perf_pmu__getcpudid() -> get_cpuid_str() -> _get_cpuid(), and we don't zero the buf allocated in _get_cpuid()

Ah yes, now if all the files fail to open or read then buf will be uninitialized. I make it so that it will return EINVAL unless the fgets() succeeds, but I don't think we need to add the strtoul() back in?

Quoted 5 lines
Quoted 5 lines

-
      return 0;
  }
  @@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu) return buf;

Quoted 9 lines

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 96

Quoted 5 lines

  }

tools/perf/arch/arm64/util/header.c +4 -0
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.

And what other values may be returned? If just 0/1, then can we have a bool return value?

I don't think that's best for consistency. All the other CPU ID comparison functions return the strcmp style return values which is the reverse of booleans. We could change them all to bool, but it would be a big change, and they'd still have strcmp in the name which suggests -1/0/1 return values (although -1 is never used here).

I will add to the comment that 1 is returned for a comparison failure thought. That is missing.

Quoted 34 lines
Quoted 34 lines

+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */

tools/perf/arch/arm64/util/header.c +29 -0
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)
+{
+    u64 map_id = strtoull(mapcpuid, NULL, 16);
+    char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+    char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+    u64 id = strtoull(idstr, NULL, 16);
+    char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+    char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+    u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+    /* Compare without version first */
+    if ((map_id & id_fields) != (id & id_fields))
+        return 1;
+
+    /*
+     * ID matches, now compare version.
+     *
+     * Arm revisions (like r0p0) are compared here like two digit semver
+     * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+     * highest matching version is used.
+     *
+     *  r = high value = 'Variant' field in MIDR
+     *  p = low value  = 'Revision' field in MIDR
+     *
+     */
+    if (id_variant > map_id_variant)
+        return 0;
+
+    if (id_variant == map_id_variant && id_revision >= map_id_revision)
Quoted 9 lines

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 137

Quoted 8 lines

+        return 0;

tools/perf/arch/arm64/util/header.c +7 -0
+
+    /*
+     * variant is less than mapfile variant or variants are the same but
+     * the revision doesn't match. Return no match.
+     */
+    return 1;
+}

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#10 lore raw

Re: [PATCH v5 2/6] perf arm64: Allow version comparisons of CPU IDs

Quoted 74 lines · James Clark
Quoted 71 lines · John Garry
Quoted 5 lines · James Clark

Currently variant and revision fields are masked out of the MIDR so it's not possible to compare different versions of the same CPU. In a later commit a workaround will be removed just for N2 r0p3, so enable comparisons on version.

Quoted 7 lines

This has the side effect of changing the MIDR stored in the header of the perf.data file to no longer have masked version fields. It also affects the lookups in mapfile.csv, but as that currently only has zeroed version fields, it has no actual effect. The mapfile.csv documentation also states to zero the version fields, so unless this isn't done it will continue to have no effect.

This looks ok apart from a couple of comments, below.

Thanks,
John

Quoted 39 lines
---
   tools/perf/arch/arm64/util/header.c | 64 ++++++++++++++++++++++-------
   1 file changed, 50 insertions(+), 14 deletions(-)
tools/perf/arch/arm64/util/header.c +5 -6
index 80b9f6287fe2..8f74e801e1ab 100644
@@ -1,3 +1,6 @@
+#include <linux/kernel.h>
+#include <linux/bits.h>
+#include <linux/bitfield.h>
   #include <stdio.h>
   #include <stdlib.h>
   #include <perf/cpumap.h>
@@ -10,14 +13,12 @@
     #define MIDR "/regs/identification/midr_el1"
   #define MIDR_SIZE 19
-#define MIDR_REVISION_MASK      0xf
-#define MIDR_VARIANT_SHIFT      20
-#define MIDR_VARIANT_MASK       (0xf << MIDR_VARIANT_SHIFT)
+#define MIDR_REVISION_MASK      GENMASK(3, 0)
+#define MIDR_VARIANT_MASK    GENMASK(23, 20)
     static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map
 *cpus)
   {
       const char *sysfs = sysfs__mountpoint();
-    u64 midr = 0;
       int cpu;
         if (!sysfs || sz < MIDR_SIZE)
@@ -44,21 +45,11 @@ static int _get_cpuid(char *buf, size_t sz, struct
 perf_cpu_map *cpus)
           }
           fclose(file);
   -        /* Ignore/clear Variant[23:20] and
-         * Revision[3:0] of MIDR
-         */

tools/perf/arch/arm64/util/header.c static int _get_cpuid(char *buf, size_t sz, struct · line 59

Quoted 10 lines
tools/perf/arch/arm64/util/header.c +0 -6
-        midr = strtoul(buf, NULL, 16);
-        midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));
-        scnprintf(buf, MIDR_SIZE, "0x%016lx", midr);
           /* got midr break loop */
           break;
       }
         perf_cpu_map__put(cpus);
-
-    if (!midr)
-        return EINVAL;

Is there a reason to drop this check?

Quoted 8 lines
Quoted 4 lines

As I see, it is still checked in perf_pmu__getcpudid() -> get_cpuid_str() -> _get_cpuid(), and we don't zero the buf allocated in _get_cpuid()

Ah yes, now if all the files fail to open or read then buf will be uninitialized. I make it so that it will return EINVAL unless the fgets() succeeds, but I don't think we need to add the strtoul() back in?

Right, I don't think that the strtoul() is required.

Quoted 16 lines
Quoted 15 lines

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 96

Quoted 11 lines
tools/perf/arch/arm64/util/header.c +4 -1
-
       return 0;
   }
   @@ -99,3 +90,48 @@ char *get_cpuid_str(struct perf_pmu *pmu)
         return buf;
   }
+
+/*
+ * Return 0 if idstr is a higher or equal to version of the same part as
+ * mapcpuid.

And what other values may be returned? If just 0/1, then can we have a bool return value?

Quoted 8 lines

I don't think that's best for consistency. All the other CPU ID comparison functions return the strcmp style return values which is the reverse of booleans. We could change them all to bool, but it would be a big change, and they'd still have strcmp in the name which suggests -1/0/1 return values (although -1 is never used here).

I will add to the comment that 1 is returned for a comparison failure thought. That is missing.

ok, fine.

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines

+ *
+ * Therefore, if mapcpuid has 0 for revision and variant then any version of
+ * idstr will match as long as it's the same CPU type.
+ */

tools/perf/arch/arm64/util/header.c +30 -0
+int strcmp_cpuid_str(const char *mapcpuid, const char *idstr)
+{
+    u64 map_id = strtoull(mapcpuid, NULL, 16);
+    char map_id_variant = FIELD_GET(MIDR_VARIANT_MASK, map_id);
+    char map_id_revision = FIELD_GET(MIDR_REVISION_MASK, map_id);
+    u64 id = strtoull(idstr, NULL, 16);
+    char id_variant = FIELD_GET(MIDR_VARIANT_MASK, id);
+    char id_revision = FIELD_GET(MIDR_REVISION_MASK, id);
+    u64 id_fields = ~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK);
+
+    /* Compare without version first */
+    if ((map_id & id_fields) != (id & id_fields))
+        return 1;
+
+    /*
+     * ID matches, now compare version.
+     *
+     * Arm revisions (like r0p0) are compared here like two digit semver
+     * values eg. 1.3 < 2.0 < 2.1 < 2.2. The events json file with the
+     * highest matching version is used.
+     *
+     *  r = high value = 'Variant' field in MIDR
+     *  p = low value  = 'Revision' field in MIDR
+     *
+     */
+    if (id_variant > map_id_variant)
+        return 0;
+
+    if (id_variant == map_id_variant && id_revision >= map_id_revision)
+        return 0;
Quoted 8 lines
Quoted 8 lines

tools/perf/arch/arm64/util/header.c char *get_cpuid_str(struct perf_pmu *pmu) · line 137

Quoted 7 lines
tools/perf/arch/arm64/util/header.c +7 -0
+
+    /*
+     * variant is less than mapfile variant or variants are the same but
+     * the revision doesn't match. Return no match.
+     */
+    return 1;
+}

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw

PATCH v5 3/6 perf test: Add a test for the new Arm CPU ID comparison behavior

In reply to James Clark

Now that variant and revision fields are taken into account the behavior is slightly more complicated so add a test to ensure that this behaves as expected.

---
 tools/perf/arch/arm64/include/arch-tests.h |  3 ++
 tools/perf/arch/arm64/tests/Build          |  1 +
 tools/perf/arch/arm64/tests/arch-tests.c   |  4 +++
 tools/perf/arch/arm64/tests/cpuid-match.c  | 38 ++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c
tools/perf/arch/arm64/include/arch-tests.h +3 -0
index 452b3d904521..474d7cf5afbd 100644
@@ -2,6 +2,9 @@
 #ifndef ARCH_TESTS_H
 #define ARCH_TESTS_H
 
+struct test_suite;
+
+int test__cpuid_match(struct test_suite *test, int subtest);
 extern struct test_suite *arch_tests[];
 
 #endif
tools/perf/arch/arm64/tests/Build +1 -0
index a61c06bdb757..e337c09e7f56 100644
@@ -2,3 +2,4 @@ perf-y += regs_load.o
 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-y += arch-tests.o
+perf-y += cpuid-match.o
tools/perf/arch/arm64/tests/arch-tests.c +4 -0
index ad16b4f8f63e..74932e72c727 100644
@@ -3,9 +3,13 @@
 #include "tests/tests.h"
 #include "arch-tests.h"
 
+
+DEFINE_SUITE("arm64 CPUID matching", cpuid_match);
+
 struct test_suite *arch_tests[] = {
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	&suite__dwarf_unwind,
 #endif
+	&suite__cpuid_match,
 	NULL,
 };
tools/perf/arch/arm64/tests/cpuid-match.c new file +38 -0
new file mode 100644
index 000000000000..af0871b54ae7
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/compiler.h>
+
+#include "arch-tests.h"
+#include "tests/tests.h"
+#include "util/header.h"
+
+int test__cpuid_match(struct test_suite *test __maybe_unused,
+			     int subtest __maybe_unused)
+{
+	/* midr with no leading zeros matches */
+	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0"))
+		return -1;
+	/* Upper case matches */
+	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0"))
+		return -1;
+	/* r0p0 = r0p0 matches */
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480"))
+		return -1;
+	/* r0p1 > r0p0 matches */
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481"))
+		return -1;
+	/* r1p0 > r0p0 matches*/
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480"))
+		return -1;
+	/* r0p0 < r0p1 doesn't match */
+	if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480"))
+		return -1;
+	/* r0p0 < r1p0 doesn't match */
+	if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480"))
+		return -1;
+	/* Different CPU doesn't match */
+	if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0"))
+		return -1;
+
+	return 0;
+}
+
Signature · 1 line
2.34.1
reviewer
#12 lore raw

Re: [PATCH v5 3/6] perf test: Add a test for the new Arm CPU ID comparison behavior

Quoted 88 lines · James Clark

Now that variant and revision fields are taken into account the behavior is slightly more complicated so add a test to ensure that this behaves as expected.

---
  tools/perf/arch/arm64/include/arch-tests.h |  3 ++
  tools/perf/arch/arm64/tests/Build          |  1 +
  tools/perf/arch/arm64/tests/arch-tests.c   |  4 +++
  tools/perf/arch/arm64/tests/cpuid-match.c  | 38 ++++++++++++++++++++++
  4 files changed, 46 insertions(+)

create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c

tools/perf/arch/arm64/include/arch-tests.h +3 -0
index 452b3d904521..474d7cf5afbd 100644
@@ -2,6 +2,9 @@
  #ifndef ARCH_TESTS_H
  #define ARCH_TESTS_H
 
+struct test_suite;
+
+int test__cpuid_match(struct test_suite *test, int subtest);
  extern struct test_suite *arch_tests[];
 
  #endif
tools/perf/arch/arm64/tests/Build +1 -0
index a61c06bdb757..e337c09e7f56 100644
@@ -2,3 +2,4 @@ perf-y += regs_load.o
  perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
  perf-y += arch-tests.o
+perf-y += cpuid-match.o
tools/perf/arch/arm64/tests/arch-tests.c +4 -0
index ad16b4f8f63e..74932e72c727 100644
@@ -3,9 +3,13 @@
  #include "tests/tests.h"
  #include "arch-tests.h"
 
+
+DEFINE_SUITE("arm64 CPUID matching", cpuid_match);
+
  struct test_suite *arch_tests[] = {
  #ifdef HAVE_DWARF_UNWIND_SUPPORT
  	&suite__dwarf_unwind,
  #endif
+	&suite__cpuid_match,
  	NULL,
  };
tools/perf/arch/arm64/tests/cpuid-match.c new file +28 -0
new file mode 100644
index 000000000000..af0871b54ae7
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/compiler.h>
+
+#include "arch-tests.h"
+#include "tests/tests.h"
+#include "util/header.h"
+
+int test__cpuid_match(struct test_suite *test __maybe_unused,
+			     int subtest __maybe_unused)
+{
+	/* midr with no leading zeros matches */
+	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0"))
+		return -1;
+	/* Upper case matches */
+	if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0"))
+		return -1;
+	/* r0p0 = r0p0 matches */
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480"))
+		return -1;
+	/* r0p1 > r0p0 matches */
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481"))
+		return -1;
+	/* r1p0 > r0p0 matches*/
+	if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480"))
+		return -1;
+	/* r0p0 < r0p1 doesn't match */
+	if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480"))
+		return -1;

tools/perf/arch/arm64/tests/cpuid-match.c line 38

Quoted 10 lines
tools/perf/arch/arm64/tests/cpuid-match.c new file +10 -0
+	/* r0p0 < r1p0 doesn't match */
+	if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480"))
+		return -1;
+	/* Different CPU doesn't match */
+	if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0"))
+		return -1;
+
+	return 0;
+}
+

Would it be possible to put this in core test code, since x86 also supports strcmp_cpuid_str()?

Maybe we would have an structure per arch of cpuids and expected results, like

struct cpuid_match {
	char *cpuid1;
	char *cpuid1;
	int expected_result;
};

#ifdef ARM64

 cpuid_match_array[] = {
	{"0x410fd0c0", "0x00000000410FD0C0", -1},
	{"0x00000000410fd480", "0x00000000410fd480", -1},
	...
	{} /* sentinel */

};
#else if defined(X86)

 cpuid_match_array[] = {
	{....}
	...
	{} /* sentinel */

};
#else
/* no support */
#endif

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#13 lore raw

Re: [PATCH v5 3/6] perf test: Add a test for the new Arm CPU ID comparison behavior

Quoted 94 lines · John Garry
Quoted 93 lines · James Clark

Now that variant and revision fields are taken into account the behavior is slightly more complicated so add a test to ensure that this behaves as expected.

---
  tools/perf/arch/arm64/include/arch-tests.h |  3 ++ tools/perf/arch/arm64/tests/Build          |  1 + tools/perf/arch/arm64/tests/arch-tests.c   |  4 +++ tools/perf/arch/arm64/tests/cpuid-match.c  | 38 ++++++++++++++++++++++

  4 files changed, 46 insertions(+)

  create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c

tools/perf/arch/arm64/include/arch-tests.h +2 -0
index 452b3d904521..474d7cf5afbd 100644
@@ -2,6 +2,9 @@
   #ifndef ARCH_TESTS_H
   #define ARCH_TESTS_H
   +struct test_suite;
+
+int test__cpuid_match(struct test_suite *test, int subtest);
   extern struct test_suite *arch_tests[];
     #endif
tools/perf/arch/arm64/tests/Build +0 -0
index a61c06bdb757..e337c09e7f56 100644
@@ -2,3 +2,4 @@ perf-y += regs_load.o

  perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
    perf-y += arch-tests.o

tools/perf/arch/arm64/tests/Build +1 -0
+perf-y += cpuid-match.o
tools/perf/arch/arm64/tests/arch-tests.c +0 -0
index ad16b4f8f63e..74932e72c727 100644
@@ -3,9 +3,13 @@
   #include "tests/tests.h"
   #include "arch-tests.h"

  +

tools/perf/arch/arm64/tests/arch-tests.c +2 -0
+DEFINE_SUITE("arm64 CPUID matching", cpuid_match);
+

  struct test_suite *arch_tests[] = {
  #ifdef HAVE_DWARF_UNWIND_SUPPORT
      &suite__dwarf_unwind,
  #endif
+    &suite__cpuid_match,
      NULL,
  };

tools/perf/arch/arm64/tests/cpuid-match.c new file +33 -0
new file mode 100644
index 000000000000..af0871b54ae7
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/compiler.h>
+
+#include "arch-tests.h"
+#include "tests/tests.h"
+#include "util/header.h"
+
+int test__cpuid_match(struct test_suite *test __maybe_unused,
+                 int subtest __maybe_unused)
+{
+    /* midr with no leading zeros matches */
+    if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0"))
+        return -1;
+    /* Upper case matches */
+    if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0"))
+        return -1;
+    /* r0p0 = r0p0 matches */
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480"))
+        return -1;
+    /* r0p1 > r0p0 matches */
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481"))
+        return -1;
+    /* r1p0 > r0p0 matches*/
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480"))
+        return -1;
+    /* r0p0 < r0p1 doesn't match */
+    if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480"))
+        return -1;
+    /* r0p0 < r1p0 doesn't match */
+    if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480"))
+        return -1;
+    /* Different CPU doesn't match */
+    if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0"))
Quoted 9 lines

tools/perf/arch/arm64/tests/cpuid-match.c line 38

Quoted 5 lines
tools/perf/arch/arm64/tests/cpuid-match.c new file +5 -0
+        return -1;
+
+    return 0;
+}
+

Would it be possible to put this in core test code, since x86 also supports strcmp_cpuid_str()?

That's how I started, but Ian suggested to move it to an arch specific folder because that's what it was testing.

We could still add test__cpuid_match() in the x86 folder rather than adding it with #ifdefs, but I don't think it needs to be done here because I haven't touched the x86 code.

Quoted 24 lines

Maybe we would have an structure per arch of cpuids and expected results, like

struct cpuid_match {
    char *cpuid1;
    char *cpuid1;
    int expected_result;
};

#ifdef ARM64
 cpuid_match_array[] = {
    {"0x410fd0c0", "0x00000000410FD0C0", -1}, {"0x00000000410fd480", "0x00000000410fd480", -1},
    ...
    {} /* sentinel */

};
#else if defined(X86)
 cpuid_match_array[] = {
    {....}
    ...
    {} /* sentinel */

Quoted 7 lines

};
#else
/* no support */
#endif

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer Reviewed-by
#14 lore raw

Re: [PATCH v5 3/6] perf test: Add a test for the new Arm CPU ID comparison behavior

Quoted 107 lines · James Clark
Quoted 94 lines · John Garry
Quoted 93 lines · James Clark

Now that variant and revision fields are taken into account the behavior is slightly more complicated so add a test to ensure that this behaves as expected.

---
   tools/perf/arch/arm64/include/arch-tests.h |  3 ++
   tools/perf/arch/arm64/tests/Build          |  1 +
   tools/perf/arch/arm64/tests/arch-tests.c   |  4 +++
   tools/perf/arch/arm64/tests/cpuid-match.c  | 38 ++++++++++++++++++++++
   4 files changed, 46 insertions(+)

  create mode 100644 tools/perf/arch/arm64/tests/cpuid-match.c

tools/perf/arch/arm64/include/arch-tests.h +2 -0
index 452b3d904521..474d7cf5afbd 100644
@@ -2,6 +2,9 @@
   #ifndef ARCH_TESTS_H
   #define ARCH_TESTS_H
   +struct test_suite;
+
+int test__cpuid_match(struct test_suite *test, int subtest);
   extern struct test_suite *arch_tests[];
     #endif
tools/perf/arch/arm64/tests/Build +1 -0
index a61c06bdb757..e337c09e7f56 100644
@@ -2,3 +2,4 @@ perf-y += regs_load.o
   perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
     perf-y += arch-tests.o
+perf-y += cpuid-match.o
tools/perf/arch/arm64/tests/arch-tests.c +3 -0
index ad16b4f8f63e..74932e72c727 100644
@@ -3,9 +3,13 @@
   #include "tests/tests.h"
   #include "arch-tests.h"
   +
+DEFINE_SUITE("arm64 CPUID matching", cpuid_match);
+
   struct test_suite *arch_tests[] = {
   #ifdef HAVE_DWARF_UNWIND_SUPPORT
       &suite__dwarf_unwind,
   #endif
+    &suite__cpuid_match,
       NULL,
   };
tools/perf/arch/arm64/tests/cpuid-match.c new file +33 -0
new file mode 100644
index 000000000000..af0871b54ae7
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/compiler.h>
+
+#include "arch-tests.h"
+#include "tests/tests.h"
+#include "util/header.h"
+
+int test__cpuid_match(struct test_suite *test __maybe_unused,
+                 int subtest __maybe_unused)
+{
+    /* midr with no leading zeros matches */
+    if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410fd0c0"))
+        return -1;
+    /* Upper case matches */
+    if (strcmp_cpuid_str("0x410fd0c0", "0x00000000410FD0C0"))
+        return -1;
+    /* r0p0 = r0p0 matches */
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd480"))
+        return -1;
+    /* r0p1 > r0p0 matches */
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000410fd481"))
+        return -1;
+    /* r1p0 > r0p0 matches*/
+    if (strcmp_cpuid_str("0x00000000410fd480", "0x00000000411fd480"))
+        return -1;
+    /* r0p0 < r0p1 doesn't match */
+    if (!strcmp_cpuid_str("0x00000000410fd481", "0x00000000410fd480"))
+        return -1;
+    /* r0p0 < r1p0 doesn't match */
+    if (!strcmp_cpuid_str("0x00000000411fd480", "0x00000000410fd480"))
+        return -1;
+    /* Different CPU doesn't match */
+    if (!strcmp_cpuid_str("0x00000000410fd4c0", "0x00000000430f0af0"))
Quoted 9 lines

tools/perf/arch/arm64/tests/cpuid-match.c line 38

Quoted 5 lines
tools/perf/arch/arm64/tests/cpuid-match.c new file +5 -0
+        return -1;
+
+    return 0;
+}
+

Would it be possible to put this in core test code, since x86 also supports strcmp_cpuid_str()?

Quoted 3 lines

That's how I started, but Ian suggested to move it to an arch specific folder because that's what it was testing.

Yeah, I see that comment now.

Quoted 2 lines

We could still add test__cpuid_match() in the x86 folder rather than adding it with #ifdefs

I was thinking to make cpuid_match_array[] exposed by the arch code and have a "weak", i.e. version for other archs.

, but I don't think it needs to be done here

Quoted 1 line

because I haven't touched the x86 code.

For the moment, I don't feel too strongly about this and it can be done as a follow-up

Quoted 25 lines
Quoted 25 lines

Maybe we would have an structure per arch of cpuids and expected results, like

struct cpuid_match {
    char *cpuid1;
    char *cpuid1;
    int expected_result;
};

#ifdef ARM64
 cpuid_match_array[] = {
    {"0x410fd0c0", "0x00000000410FD0C0", -1}, {"0x00000000410fd480", "0x00000000410fd480", -1},
    ...
    {} /* sentinel */

};
#else if defined(X86)
 cpuid_match_array[] = {
    {....}
    ...
    {} /* sentinel */

Quoted 7 lines
Quoted 7 lines

};
#else
/* no support */
#endif

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#15 lore raw

PATCH v5 4/6 perf vendor events arm64: Update scale units and descriptions of common topdown metrics

In reply to James Clark

Metrics will be published here [1] going forwards, but they have slightly different scale units. To allow autogenerated metrics to be added more easily, update the scale units to match.

The more detailed descriptions have also been taken and added to the common file.

[1]: https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/tree/main/data/pmu/cpu/

---
 tools/perf/pmu-events/arch/arm64/sbsa.json | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)
tools/perf/pmu-events/arch/arm64/sbsa.json +12 -12
index f90b338261ac..4eed79a28f6e 100644
@@ -1,34 +1,34 @@
 [
     {
-        "MetricExpr": "stall_slot_frontend / (#slots * cpu_cycles)",
-        "BriefDescription": "Frontend bound L1 topdown metric",
+        "MetricExpr": "100 * (stall_slot_frontend / (#slots * cpu_cycles))",
+        "BriefDescription": "This metric is the percentage of total slots that were stalled due to resource constraints in the frontend of the processor.",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "MetricName": "frontend_bound",
-        "ScaleUnit": "100%"
+        "ScaleUnit": "1percent of slots"
     },
     {
-        "MetricExpr": "(1 - op_retired / op_spec) * (1 - stall_slot / (#slots * cpu_cycles))",
-        "BriefDescription": "Bad speculation L1 topdown metric",
+        "MetricExpr": "100 * ((1 - op_retired / op_spec) * (1 - stall_slot / (#slots * cpu_cycles)))",
+        "BriefDescription": "This metric is the percentage of total slots that executed operations and didn't retire due to a pipeline flush.\nThis indicates cycles that were utilized but inefficiently.",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "MetricName": "bad_speculation",
-        "ScaleUnit": "100%"
+        "ScaleUnit": "1percent of slots"
     },
     {
-        "MetricExpr": "(op_retired / op_spec) * (1 - stall_slot / (#slots * cpu_cycles))",
-        "BriefDescription": "Retiring L1 topdown metric",
+        "MetricExpr": "100 * ((op_retired / op_spec) * (1 - stall_slot / (#slots * cpu_cycles)))",
+        "BriefDescription": "This metric is the percentage of total slots that retired operations, which indicates cycles that were utilized efficiently.",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "MetricName": "retiring",
-        "ScaleUnit": "100%"
+        "ScaleUnit": "1percent of slots"
     },
     {
-        "MetricExpr": "stall_slot_backend / (#slots * cpu_cycles)",
-        "BriefDescription": "Backend Bound L1 topdown metric",
+        "MetricExpr": "100 * (stall_slot_backend / (#slots * cpu_cycles))",
+        "BriefDescription": "This metric is the percentage of total slots that were stalled due to resource constraints in the backend of the processor.",
         "DefaultMetricgroupName": "TopdownL1",
         "MetricGroup": "Default;TopdownL1",
         "MetricName": "backend_bound",
-        "ScaleUnit": "100%"
+        "ScaleUnit": "1percent of slots"
     }
 ]
Signature · 1 line
2.34.1
reviewer Reviewed-by on v5 4/6
#16 lore raw

Re: [PATCH v5 4/6] perf vendor events arm64: Update scale units and descriptions of common topdown metrics

Quoted 11 lines · James Clark

Metrics will be published here [1] going forwards, but they have slightly different scale units. To allow autogenerated metrics to be added more easily, update the scale units to match.

The more detailed descriptions have also been taken and added to the common file.

[1]:https://urldefense.com/v3/__https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/tree/main/data/pmu/cpu/__;!!ACWV5N9M2RV99hQ!P1pT5PYzk0os04MQETZD2-22Rp9SCpDzrGV4g-wWDSx0667S3YYkIMArEI9wYBa2SlzR6Jnu2GKRjYJqOHnGrg$  
maintainer Applied
#17 lore raw

Re: [PATCH v5 4/6] perf vendor events arm64: Update scale units and descriptions of common topdown metrics

Em Fri, Aug 11, 2023 at 03:53:49PM +0100, John Garry escreveu:

Quoted 8 lines · James Clark
Quoted 7 lines

Metrics will be published here [1] going forwards, but they have slightly different scale units. To allow autogenerated metrics to be added more easily, update the scale units to match.

The more detailed descriptions have also been taken and added to the common file.

Quoted 6 lines
Quoted 4 lines

[1]:https://urldefense.com/v3/__https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/tree/main/data/pmu/cpu/__;!!ACWV5N9M2RV99hQ!P1pT5PYzk0os04MQETZD2-22Rp9SCpDzrGV4g-wWDSx0667S3YYkIMArEI9wYBa2SlzR6Jnu2GKRjYJqOHnGrg$

Applied as well, will wait for the others to get the review comment addressed.

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#18 lore raw

PATCH v5 5/6 perf vendor events arm64: Update stall_slot workaround for N2 r0p3

In reply to James Clark

N2 r0p3 doesn't require the workaround [1], so gating on (#slots - 5) no longer works because all N2s have 5 slots. Add a new expression builtin that allows calling strcmp_cpuid_str() and comparing CPUIDs in metric formulas.

In this case, the commented formula looks like this:

strcmp_cpuid_str(0x410fd493) # greater than or equal to N2 r0p3
| strcmp_cpuid_str(0x410fd490) ^ 1 # OR NOT any version of N2

[1]: https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/blob/main/data/pmu/cpu/neoverse/neoverse-n2-r0p3.json

---
 tools/perf/arch/arm64/util/pmu.c               | 18 +-----------------
 .../arch/arm64/arm/neoverse-n2-v2/metrics.json |  8 ++++----
 tools/perf/pmu-events/metric.py                | 17 +++++++++++++++--
 tools/perf/util/expr.c                         | 18 ++++++++++++++++++
 tools/perf/util/expr.h                         |  1 +
 tools/perf/util/expr.l                         |  1 +
 tools/perf/util/expr.y                         |  8 +++++++-
 tools/perf/util/pmu.c                          | 17 +++++++++++++++++
 tools/perf/util/pmu.h                          |  1 +
 9 files changed, 65 insertions(+), 24 deletions(-)
tools/perf/arch/arm64/util/pmu.c +1 -17
index 561de0cb6b95..3f3c6c691ea5 100644
@@ -2,28 +2,12 @@
 
 #include <internal/cpumap.h>
 #include "../../../util/cpumap.h"
+#include "../../../util/header.h"
 #include "../../../util/pmu.h"
 #include "../../../util/pmus.h"
 #include <api/fs/fs.h>
 #include <math.h>
 
-static struct perf_pmu *pmu__find_core_pmu(void)
-{
-	struct perf_pmu *pmu = NULL;
-
-	while ((pmu = perf_pmus__scan_core(pmu))) {
-		/*
-		 * The cpumap should cover all CPUs. Otherwise, some CPUs may
-		 * not support some events or have different event IDs.
-		 */
-		if (RC_CHK_ACCESS(pmu->cpus)->nr != cpu__max_cpu().cpu)
-			return NULL;
-
-		return pmu;
-	}
-	return NULL;
-}
-
 const struct pmu_metrics_table *pmu_metrics_table__find(void)
 {
 	struct perf_pmu *pmu = pmu__find_core_pmu();
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/metrics.json +4 -4
index 8ad15b726dca..9757cc178bdf 100644
@@ -1,15 +1,15 @@
 [
     {
         "ArchStdEvent": "FRONTEND_BOUND",
-        "MetricExpr": "((stall_slot_frontend) if (#slots - 5) else (stall_slot_frontend - cpu_cycles)) / (#slots * cpu_cycles)"
+        "MetricExpr": "((stall_slot_frontend) if (strcmp_cpuid_str(0x410fd493) | strcmp_cpuid_str(0x410fd490) ^ 1) else (stall_slot_frontend - cpu_cycles)) / (#slots * cpu_cycles)"
     },
     {
         "ArchStdEvent": "BAD_SPECULATION",
-        "MetricExpr": "(1 - op_retired / op_spec) * (1 - (stall_slot if (#slots - 5) else (stall_slot - cpu_cycles)) / (#slots * cpu_cycles))"
+        "MetricExpr": "(1 - op_retired / op_spec) * (1 - (stall_slot if (strcmp_cpuid_str(0x410fd493) | strcmp_cpuid_str(0x410fd490) ^ 1) else (stall_slot - cpu_cycles)) / (#slots * cpu_cycles))"
     },
     {
         "ArchStdEvent": "RETIRING",
-        "MetricExpr": "(op_retired / op_spec) * (1 - (stall_slot if (#slots - 5) else (stall_slot - cpu_cycles)) / (#slots * cpu_cycles))"
+        "MetricExpr": "(op_retired / op_spec) * (1 - (stall_slot if (strcmp_cpuid_str(0x410fd493) | strcmp_cpuid_str(0x410fd490) ^ 1) else (stall_slot - cpu_cycles)) / (#slots * cpu_cycles))"
     },
     {
         "ArchStdEvent": "BACKEND_BOUND"
@@ -201,7 +201,7 @@
         "ScaleUnit": "100%"
     },
     {
-        "MetricExpr": "OP_RETIRED / OP_SPEC * (1 - (STALL_SLOT if (#slots - 5) else (STALL_SLOT - CPU_CYCLES)) / (#slots * CPU_CYCLES))",
+        "MetricExpr": "OP_RETIRED / OP_SPEC * (1 - (STALL_SLOT if (strcmp_cpuid_str(0x410fd493) | strcmp_cpuid_str(0x410fd490) ^ 1) else (STALL_SLOT - CPU_CYCLES)) / (#slots * CPU_CYCLES))",
         "BriefDescription": "The truly effective ratio of micro-operations executed by the CPU, which means that misprediction and stall are not included",
         "MetricGroup": "PEutilization",
         "MetricName": "cpu_utilization",
tools/perf/pmu-events/metric.py +15 -2
index 85a3545f5b6a..0e9ec65d92ae 100644
@@ -413,6 +413,10 @@ def has_event(event: Event) -> Function:
   # pylint: disable=invalid-name
   return Function('has_event', event)
 
+def strcmp_cpuid_str(event: str) -> Function:
+  # pylint: disable=redefined-builtin
+  # pylint: disable=invalid-name
+  return Function('strcmp_cpuid_str', event)
 
 class Metric:
   """An individual metric that will specifiable on the perf command line."""
@@ -541,14 +545,23 @@ def ParsePerfJson(orig: str) -> Expression:
   """
   # pylint: disable=eval-used
   py = orig.strip()
+  # First try to convert everything that looks like a string (event name) into Event(r"EVENT_NAME").
+  # This isn't very selective so is followed up by converting some unwanted conversions back again
   py = re.sub(r'([a-zA-Z][^-+/\* \\\(\),]*(?:\\.[^-+/\* \\\(\),]*)*)',
               r'Event(r"\1")', py)
+  # If it started with a # it should have been a literal, rather than an event name
   py = re.sub(r'#Event\(r"([^"]*)"\)', r'Literal("#\1")', py)
+  # Convert accidentally converted hex constants ("0Event(r"xDEADBEEF)"") back to a constant,
+  # but keep it wrapped in Event(), otherwise Python drops the 0x prefix and it gets interpreted as
+  # a double by the Bison parser
+  py = re.sub(r'0Event\(r"[xX]([0-9a-fA-F]*)"\)', r'Event("0x\1")', py)
+  # Convert accidentally converted scientific notation constants back
   py = re.sub(r'([0-9]+)Event\(r"(e[0-9]+)"\)', r'\1\2', py)
-  keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event']
+  # Convert all the known keywords back from events to just the keyword
+  keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event', 'strcmp_cpuid_str',
+              'cpuid_not_more_than']
   for kw in keywords:
     py = re.sub(rf'Event\(r"{kw}"\)', kw, py)
-
   try:
     parsed = ast.parse(py, mode='eval')
   except SyntaxError as e:
tools/perf/util/expr.c +18 -0
index 7410a165f68b..0985a3cbc6f9 100644
@@ -13,6 +13,8 @@
 #include <util/expr-bison.h>
 #include <util/expr-flex.h>
 #include "util/hashmap.h"
+#include "util/header.h"
+#include "util/pmu.h"
 #include "smt.h"
 #include "tsc.h"
 #include <api/fs/fs.h>
@@ -495,3 +497,19 @@ double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const
 	evlist__delete(tmp);
 	return ret;
 }
+
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx __maybe_unused,
+		       bool compute_ids __maybe_unused, const char *test_id)
+{
+	double ret;
+	struct perf_pmu *pmu = pmu__find_core_pmu();
+	char *cpuid = perf_pmu__getcpuid(pmu);
+
+	if (!cpuid)
+		return NAN;
+
+	ret = !strcmp_cpuid_str(test_id, cpuid);
+
+	free(cpuid);
+	return ret;
+}
tools/perf/util/expr.h +1 -0
index 3c1e49b3e35d..c0cec29ddc29 100644
@@ -55,5 +55,6 @@ double expr_id_data__value(const struct expr_id_data *data);
 double expr_id_data__source_count(const struct expr_id_data *data);
 double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx);
 double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
 
 #endif
tools/perf/util/expr.l +1 -0
index dbb117414710..0feef0726c48 100644
@@ -114,6 +114,7 @@ if		{ return IF; }
 else		{ return ELSE; }
 source_count	{ return SOURCE_COUNT; }
 has_event	{ return HAS_EVENT; }
+strcmp_cpuid_str	{ return STRCMP_CPUID_STR; }
 {literal}	{ return literal(yyscanner, sctx); }
 {number}	{ return value(yyscanner); }
 {symbol}	{ return str(yyscanner, ID, sctx->runtime); }
tools/perf/util/expr.y +7 -1
index 65d54a6f29ad..6c93b358cc2d 100644
@@ -39,7 +39,7 @@ int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
 	} ids;
 }
 
-%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT EXPR_ERROR
+%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT STRCMP_CPUID_STR EXPR_ERROR
 %left MIN MAX IF
 %left '|'
 %left '^'
@@ -207,6 +207,12 @@ expr: NUMBER
 	$$.ids = NULL;
 	free($3);
 }
+| STRCMP_CPUID_STR '(' ID ')'
+{
+	$$.val = expr__strcmp_cpuid_str(ctx, compute_ids, $3);
+	$$.ids = NULL;
+	free($3);
+}
 | expr '|' expr
 {
 	if (is_const($1.val) && is_const($3.val)) {
tools/perf/util/pmu.c +17 -0
index b6654b9f55d2..b6948021fe29 100644
@@ -1779,3 +1779,20 @@ void perf_pmu__delete(struct perf_pmu *pmu)
 	zfree(&pmu->alias_name);
 	free(pmu);
 }
+
+struct perf_pmu *pmu__find_core_pmu(void)
+{
+	struct perf_pmu *pmu = NULL;
+
+	while ((pmu = perf_pmus__scan_core(pmu))) {
+		/*
+		 * The cpumap should cover all CPUs. Otherwise, some CPUs may
+		 * not support some events or have different event IDs.
+		 */
+		if (RC_CHK_ACCESS(pmu->cpus)->nr != cpu__max_cpu().cpu)
+			return NULL;
+
+		return pmu;
+	}
+	return NULL;
+}
tools/perf/util/pmu.h +1 -0
index 203b92860e3c..580b8d65bd65 100644
@@ -288,5 +288,6 @@ int perf_pmu__pathname_fd(int dirfd, const char *pmu_name, const char *filename,
 struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *lookup_name);
 struct perf_pmu *perf_pmu__create_placeholder_core_pmu(struct list_head *core_pmus);
 void perf_pmu__delete(struct perf_pmu *pmu);
+struct perf_pmu *pmu__find_core_pmu(void);
 
 #endif /* __PMU_H */
Signature · 1 line
2.34.1
reviewer
#19 lore raw

Re: [PATCH v5 5/6] perf vendor events arm64: Update stall_slot workaround for N2 r0p3

Quoted 23 lines

try:
parsed = ast.parse(py, mode='eval')
except SyntaxError as e:

tools/perf/util/expr.c +4 -0
index 7410a165f68b..0985a3cbc6f9 100644
@@ -13,6 +13,8 @@
  #include <util/expr-bison.h>
  #include <util/expr-flex.h>
  #include "util/hashmap.h"
+#include "util/header.h"
+#include "util/pmu.h"
  #include "smt.h"
  #include "tsc.h"
  #include <api/fs/fs.h>
@@ -495,3 +497,19 @@ double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const
  	evlist__delete(tmp);
  	return ret;
  }
+
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx __maybe_unused,

tools/perf/util/expr.c double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const · line 511

Quoted 10 lines
tools/perf/util/expr.c +10 -0
+		       bool compute_ids __maybe_unused, const char *test_id)
+{
+	double ret;
+	struct perf_pmu *pmu = pmu__find_core_pmu();
+	char *cpuid = perf_pmu__getcpuid(pmu);
+
+	if (!cpuid)
+		return NAN;
+
+	ret = !strcmp_cpuid_str(test_id, cpuid);

It seems that strcmp_cpuid_str() is only added in arm64 arch code - should there be a weak version for other archs?

Quoted 58 lines
tools/perf/util/expr.c +4 -0
+
+	free(cpuid);
+	return ret;
+}
tools/perf/util/expr.h +1 -0
index 3c1e49b3e35d..c0cec29ddc29 100644
@@ -55,5 +55,6 @@ double expr_id_data__value(const struct expr_id_data *data);
  double expr_id_data__source_count(const struct expr_id_data *data);
  double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx);
  double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
 
  #endif
tools/perf/util/expr.l +1 -0
index dbb117414710..0feef0726c48 100644
@@ -114,6 +114,7 @@ if		{ return IF; }
  else		{ return ELSE; }
  source_count	{ return SOURCE_COUNT; }
  has_event	{ return HAS_EVENT; }
+strcmp_cpuid_str	{ return STRCMP_CPUID_STR; }
  {literal}	{ return literal(yyscanner, sctx); }
  {number}	{ return value(yyscanner); }
  {symbol}	{ return str(yyscanner, ID, sctx->runtime); }
tools/perf/util/expr.y +7 -1
index 65d54a6f29ad..6c93b358cc2d 100644
@@ -39,7 +39,7 @@ int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
  	} ids;
  }
 
-%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT EXPR_ERROR
+%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT STRCMP_CPUID_STR EXPR_ERROR
  %left MIN MAX IF
  %left '|'
  %left '^'
@@ -207,6 +207,12 @@ expr: NUMBER
  	$$.ids = NULL;
  	free($3);
  }
+| STRCMP_CPUID_STR '(' ID ')'
+{
+	$$.val = expr__strcmp_cpuid_str(ctx, compute_ids, $3);
+	$$.ids = NULL;
+	free($3);
+}
  | expr '|' expr
  {
  	if (is_const($1.val) && is_const($3.val)) {
tools/perf/util/pmu.c +0 -0
index b6654b9f55d2..b6948021fe29 100644

tools/perf/util/pmu.c void perf_pmu__delete(struct perf_pmu *pmu) · line 1783

Quoted 5 lines
tools/perf/util/pmu.c +2 -0
@@ -1779,3 +1779,20 @@ void perf_pmu__delete(struct perf_pmu *pmu)
  	zfree(&pmu->alias_name);
  	free(pmu);
  }
+
+struct perf_pmu *pmu__find_core_pmu(void)

Why was this relocated? I don't see anywhere changed which referenced pmu__find_core_pmu() in this patch

Quoted 20 lines
tools/perf/util/pmu.c +15 -0
+{
+	struct perf_pmu *pmu = NULL;
+
+	while ((pmu = perf_pmus__scan_core(pmu))) {
+		/*
+		 * The cpumap should cover all CPUs. Otherwise, some CPUs may
+		 * not support some events or have different event IDs.
+		 */
+		if (RC_CHK_ACCESS(pmu->cpus)->nr != cpu__max_cpu().cpu)
+			return NULL;
+
+		return pmu;
+	}
+	return NULL;
+}
tools/perf/util/pmu.h +0 -0
index 203b92860e3c..580b8d65bd65 100644

tools/perf/util/pmu.h int perf_pmu__pathname_fd(int dirfd, const char *pmu_name, const char *filename, · line 293

Quoted 6 lines
tools/perf/util/pmu.h +1 -0
@@ -288,5 +288,6 @@ int perf_pmu__pathname_fd(int dirfd, const char *pmu_name, const char *filename,
  struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char *lookup_name);
  struct perf_pmu *perf_pmu__create_placeholder_core_pmu(struct list_head *core_pmus);
  void perf_pmu__delete(struct perf_pmu *pmu);
+struct perf_pmu *pmu__find_core_pmu(void);
 
  #endif /* __PMU_H */

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#20 lore raw

Re: [PATCH v5 5/6] perf vendor events arm64: Update stall_slot workaround for N2 r0p3

Quoted 30 lines · John Garry
Quoted 30 lines

    try:
      parsed = ast.parse(py, mode='eval')
    except SyntaxError as e:

tools/perf/util/expr.c +2 -0
index 7410a165f68b..0985a3cbc6f9 100644
@@ -13,6 +13,8 @@
   #include <util/expr-bison.h>
   #include <util/expr-flex.h>
   #include "util/hashmap.h"
+#include "util/header.h"
+#include "util/pmu.h"
   #include "smt.h"
   #include "tsc.h"
   #include <api/fs/fs.h>
@@ -495,3 +497,19 @@ double expr__has_event(const struct

expr_parse_ctx *ctx, bool compute_ids, const
      evlist__delete(tmp);
      return ret;
  }

tools/perf/util/expr.c +2 -0
+
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx

__maybe_unused,
+               bool compute_ids __maybe_unused, const char *test_id) +{
+    double ret;
+    struct perf_pmu *pmu = pmu__find_core_pmu();
+    char *cpuid = perf_pmu__getcpuid(pmu);

Quoted 8 lines

tools/perf/util/expr.c double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const · line 511

Quoted 5 lines
tools/perf/util/expr.c +5 -0
+
+    if (!cpuid)
+        return NAN;
+
+    ret = !strcmp_cpuid_str(test_id, cpuid);

It seems that strcmp_cpuid_str() is only added in arm64 arch code - should there be a weak version for other archs?

I think there is one in tools/perf/util/header.c. I tested the build on x86 as well as arm so it should be working.

Quoted 63 lines
Quoted 63 lines
tools/perf/util/expr.c +4 -0
+
+    free(cpuid);
+    return ret;
+}
tools/perf/util/expr.h +0 -0
index 3c1e49b3e35d..c0cec29ddc29 100644
@@ -55,5 +55,6 @@ double expr_id_data__value(const struct expr_id_data
 *data);
   double expr_id_data__source_count(const struct expr_id_data *data);

  double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx);
  double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
+double expr__strcmp_cpuid_str(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id);
    #endif

tools/perf/util/expr.l +1 -0
index dbb117414710..0feef0726c48 100644
@@ -114,6 +114,7 @@ if        { return IF; }
   else        { return ELSE; }
   source_count    { return SOURCE_COUNT; }
   has_event    { return HAS_EVENT; }
+strcmp_cpuid_str    { return STRCMP_CPUID_STR; }
   {literal}    { return literal(yyscanner, sctx); }
   {number}    { return value(yyscanner); }
   {symbol}    { return str(yyscanner, ID, sctx->runtime); }
tools/perf/util/expr.y +0 -0
index 65d54a6f29ad..6c93b358cc2d 100644
@@ -39,7 +39,7 @@ int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
       } ids;
   }

  -%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT EXPR_ERROR
+%token ID NUMBER MIN MAX IF ELSE LITERAL D_RATIO SOURCE_COUNT HAS_EVENT STRCMP_CPUID_STR EXPR_ERROR
  %left MIN MAX IF
  %left '|'
  %left '^'

tools/perf/util/expr.y +6 -0
@@ -207,6 +207,12 @@ expr: NUMBER
       $$.ids = NULL;
       free($3);
   }
+| STRCMP_CPUID_STR '(' ID ')'
+{
+    $$.val = expr__strcmp_cpuid_str(ctx, compute_ids, $3);
+    $$.ids = NULL;
+    free($3);
+}

  | expr '|' expr
  {
      if (is_const($1.val) && is_const($3.val)) {

tools/perf/util/pmu.c +0 -0
index b6654b9f55d2..b6948021fe29 100644
@@ -1779,3 +1779,20 @@ void perf_pmu__delete(struct perf_pmu *pmu)
Quoted 9 lines

tools/perf/util/pmu.c void perf_pmu__delete(struct perf_pmu *pmu) · line 1783

Quoted 5 lines
tools/perf/util/pmu.c +2 -0
       zfree(&pmu->alias_name);
       free(pmu);
   }
+
+struct perf_pmu *pmu__find_core_pmu(void)

Why was this relocated? I don't see anywhere changed which referenced pmu__find_core_pmu() in this patch

It's in expr__strcmp_cpuid_str(), I added a new call to it.

Quoted 20 lines
Quoted 20 lines
tools/perf/util/pmu.c +15 -0
+{
+    struct perf_pmu *pmu = NULL;
+
+    while ((pmu = perf_pmus__scan_core(pmu))) {
+        /*
+         * The cpumap should cover all CPUs. Otherwise, some CPUs may
+         * not support some events or have different event IDs.
+         */
+        if (RC_CHK_ACCESS(pmu->cpus)->nr != cpu__max_cpu().cpu)
+            return NULL;
+
+        return pmu;
+    }
+    return NULL;
+}
tools/perf/util/pmu.h +0 -0
index 203b92860e3c..580b8d65bd65 100644
@@ -288,5 +288,6 @@ int perf_pmu__pathname_fd(int dirfd, const char
Quoted 9 lines
Quoted 8 lines
tools/perf/util/pmu.h +0 -0
 *pmu_name, const char *filename,
   struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd,
 const char *lookup_name);

  struct perf_pmu *perf_pmu__create_placeholder_core_pmu(struct list_head *core_pmus);
  void perf_pmu__delete(struct perf_pmu *pmu); +struct perf_pmu *pmu__find_core_pmu(void);
    #endif /* __PMU_H */

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

reviewer
#21 lore raw

Re: [PATCH v5 5/6] perf vendor events arm64: Update stall_slot workaround for N2 r0p3

In reply to James Clark
Quoted 10 lines · James Clark

N2 r0p3 doesn't require the workaround [1], so gating on (#slots - 5) no longer works because all N2s have 5 slots. Add a new expression builtin that allows calling strcmp_cpuid_str() and comparing CPUIDs in metric formulas.

In this case, the commented formula looks like this:

   strcmp_cpuid_str(0x410fd493)        # greater than or equal to N2 r0p3
   | strcmp_cpuid_str(0x410fd490) ^ 1  # OR NOT any version of N2
Quoted 12 lines
[1]:https://urldefense.com/v3/__https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/blob/main/data/pmu/cpu/neoverse/neoverse-n2-r0p3.json__;!!ACWV5N9M2RV99hQ!MaXDALyhn3HmfLdPUZRKTItKxg73C-qP4aTNAAdFwzjW5cFEBTHtD-VyqBzUTFbXMvABB-daDD01AfI7um_BtA$  Signed-off-by: James Clark<[email protected]>
---
  tools/perf/arch/arm64/util/pmu.c               | 18 +-----------------
  .../arch/arm64/arm/neoverse-n2-v2/metrics.json |  8 ++++----
  tools/perf/pmu-events/metric.py                | 17 +++++++++++++++--
  tools/perf/util/expr.c                         | 18 ++++++++++++++++++
  tools/perf/util/expr.h                         |  1 +
  tools/perf/util/expr.l                         |  1 +
  tools/perf/util/expr.y                         |  8 +++++++-
  tools/perf/util/pmu.c                          | 17 +++++++++++++++++
  tools/perf/util/pmu.h                          |  1 +
  9 files changed, 65 insertions(+), 24 deletions(-)

This patch looks ok, but I think that it would be better to separate out the metrics.json change into a separate patch.

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#22 lore raw

Re: [PATCH v5 5/6] perf vendor events arm64: Update stall_slot workaround for N2 r0p3

Quoted 24 lines · John Garry
Quoted 15 lines · James Clark

N2 r0p3 doesn't require the workaround [1], so gating on (#slots - 5) no longer works because all N2s have 5 slots. Add a new expression builtin that allows calling strcmp_cpuid_str() and comparing CPUIDs in metric formulas.

In this case, the commented formula looks like this:

   strcmp_cpuid_str(0x410fd493)        # greater than or equal to N2 r0p3 | strcmp_cpuid_str(0x410fd490) ^ 1  # OR NOT any version of N2

[1]:https://urldefense.com/v3/__https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/blob/main/data/pmu/cpu/neoverse/neoverse-n2-r0p3.json__;!!ACWV5N9M2RV99hQ!MaXDALyhn3HmfLdPUZRKTItKxg73C-qP4aTNAAdFwzjW5cFEBTHtD-VyqBzUTFbXMvABB-daDD01AfI7um_BtA$  Signed-off-by: James Clark<[email protected]>
---
  tools/perf/arch/arm64/util/pmu.c               | 18 +-----------------
  .../arch/arm64/arm/neoverse-n2-v2/metrics.json |  8 ++++----
  tools/perf/pmu-events/metric.py                | 17 +++++++++++++++--

Quoted 7 lines
  tools/perf/util/expr.c                         | 18 ++++++++++++++++++
  tools/perf/util/expr.h                         |  1 +
  tools/perf/util/expr.l                         |  1 +
  tools/perf/util/expr.y                         |  8 +++++++-
  tools/perf/util/pmu.c                          | 17 +++++++++++++++++
  tools/perf/util/pmu.h                          |  1 +
  9 files changed, 65 insertions(+), 24 deletions(-)
Quoted 3 lines

This patch looks ok, but I think that it would be better to separate out the metrics.json change into a separate patch.

Yep I thought about doing that, I can change it in the next version.

Quoted 2 lines

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#23 lore raw

PATCH v5 6/6 perf vendor events arm64: Update N2 and V2 metrics and events using Arm telemetry repo

In reply to James Clark

Apart from some slight naming and grouping differences, the new metrics are functionally the same as the existing ones. Any missing metrics were manually appended to the end of the auto generated file.

For the events, the new data includes descriptions that may have product specific details and new groupings that will be consistent with other products.

After generating the metrics from the telemetry repo [1], the following manual steps were performed:

* Change the topdown expressions to compare on CPUID and use #slots so that the same data can be shared between N2 and V2. Apart from these modifications, the expressions now match more closely with the Arm telemetry data which will hopefully make future updates easier.

* Append some metrics from the old N2/V2 data that aren't present in the telemetry data. These will possibly be added to the telemetry-solution repo at a later time:

l3d_cache_mpki, l3d_cache_miss_rate, branch_pki, ipc_rate, spec_ipc, retired_rate, wasted_rate, branch_immed_spec_rate, branch_return_spec_rate, branch_indirect_spec_rate

[1]: https://gitlab.arm.com/telemetry-solution/telemetry-solution/-/blob/main/data/pmu/cpu/neoverse/neoverse-n2.json

---
 .../arch/arm64/arm/neoverse-n2-v2/branch.json |   8 -
 .../arch/arm64/arm/neoverse-n2-v2/bus.json    |  18 +-
 .../arch/arm64/arm/neoverse-n2-v2/cache.json  | 155 --------
 .../arm64/arm/neoverse-n2-v2/exception.json   |  45 ++-
 .../arm/neoverse-n2-v2/fp_operation.json      |  22 ++
 .../arm64/arm/neoverse-n2-v2/general.json     |  10 +
 .../arm64/arm/neoverse-n2-v2/instruction.json | 143 -------
 .../arm64/arm/neoverse-n2-v2/l1d_cache.json   |  54 +++
 .../arm64/arm/neoverse-n2-v2/l1i_cache.json   |  14 +
 .../arm64/arm/neoverse-n2-v2/l2_cache.json    |  50 +++
 .../arm64/arm/neoverse-n2-v2/l3_cache.json    |  22 ++
 .../arm64/arm/neoverse-n2-v2/ll_cache.json    |  10 +
 .../arch/arm64/arm/neoverse-n2-v2/memory.json |  39 +-
 .../arm64/arm/neoverse-n2-v2/metrics.json     | 365 ++++++++++--------
 .../arm64/arm/neoverse-n2-v2/pipeline.json    |  23 --
 .../arm64/arm/neoverse-n2-v2/retired.json     |  30 ++
 .../arch/arm64/arm/neoverse-n2-v2/spe.json    |  12 +-
 .../arm/neoverse-n2-v2/spec_operation.json    | 110 ++++++
 .../arch/arm64/arm/neoverse-n2-v2/stall.json  |  30 ++
 .../arch/arm64/arm/neoverse-n2-v2/sve.json    |  50 +++
 .../arch/arm64/arm/neoverse-n2-v2/tlb.json    |  66 ++++
 .../arch/arm64/arm/neoverse-n2-v2/trace.json  |  27 +-
 22 files changed, 752 insertions(+), 551 deletions(-)
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/branch.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/fp_operation.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/general.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/instruction.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1d_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1i_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l2_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l3_cache.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/ll_cache.json
 delete mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/pipeline.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/retired.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/spec_operation.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/stall.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/sve.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/tlb.json
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/branch.json deleted +0 -8
deleted file mode 100644
index 79f2016c53b0..000000000000
@@ -1,8 +0,0 @@
-[
-    {
-        "ArchStdEvent": "BR_MIS_PRED"
-    },
-    {
-        "ArchStdEvent": "BR_PRED"
-    }
-]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/bus.json +8 -10
index 579c1c993d17..2e11a8c4a484 100644
@@ -1,20 +1,18 @@
 [
     {
-        "ArchStdEvent": "CPU_CYCLES"
+        "ArchStdEvent": "BUS_ACCESS",
+        "PublicDescription": "Counts memory transactions issued by the CPU to the external bus, including snoop requests and snoop responses. Each beat of data is counted individually."
     },
     {
-        "ArchStdEvent": "BUS_ACCESS"
+        "ArchStdEvent": "BUS_CYCLES",
+        "PublicDescription": "Counts bus cycles in the CPU. Bus cycles represent a clock cycle in which a transaction could be sent or received on the interface from the CPU to the external bus. Since that interface is driven at the same clock speed as the CPU, this event is a duplicate of CPU_CYCLES."
     },
     {
-        "ArchStdEvent": "BUS_CYCLES"
+        "ArchStdEvent": "BUS_ACCESS_RD",
+        "PublicDescription": "Counts memory read transactions seen on the external bus. Each beat of data is counted individually."
     },
     {
-        "ArchStdEvent": "BUS_ACCESS_RD"
-    },
-    {
-        "ArchStdEvent": "BUS_ACCESS_WR"
-    },
-    {
-        "ArchStdEvent": "CNT_CYCLES"
+        "ArchStdEvent": "BUS_ACCESS_WR",
+        "PublicDescription": "Counts memory write transactions seen on the external bus. Each beat of data is counted individually."
     }
 ]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/cache.json deleted +0 -155

155 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/exception.json +30 -15

77 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/fp_operation.json new file +22 -0
new file mode 100644
index 000000000000..cec3435ac766
@@ -0,0 +1,22 @@
+[
+    {
+        "ArchStdEvent": "FP_HP_SPEC",
+        "PublicDescription": "Counts speculatively executed half precision floating point operations."
+    },
+    {
+        "ArchStdEvent": "FP_SP_SPEC",
+        "PublicDescription": "Counts speculatively executed single precision floating point operations."
+    },
+    {
+        "ArchStdEvent": "FP_DP_SPEC",
+        "PublicDescription": "Counts speculatively executed double precision floating point operations."
+    },
+    {
+        "ArchStdEvent": "FP_SCALE_OPS_SPEC",
+        "PublicDescription": "Counts speculatively executed scalable single precision floating point operations."
+    },
+    {
+        "ArchStdEvent": "FP_FIXED_OPS_SPEC",
+        "PublicDescription": "Counts speculatively executed non-scalable single precision floating point operations."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/general.json new file +10 -0
new file mode 100644
index 000000000000..428810f855b8
@@ -0,0 +1,10 @@
+[
+    {
+        "ArchStdEvent": "CPU_CYCLES",
+        "PublicDescription": "Counts CPU clock cycles (not timer cycles). The clock measured by this event is defined as the physical clock driving the CPU logic."
+    },
+    {
+        "ArchStdEvent": "CNT_CYCLES",
+        "PublicDescription": "Counts constant frequency cycles"
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/instruction.json deleted +0 -143

143 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1d_cache.json new file +54 -0

54 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l1i_cache.json new file +14 -0
new file mode 100644
index 000000000000..633f1030359d
@@ -0,0 +1,14 @@
+[
+    {
+        "ArchStdEvent": "L1I_CACHE_REFILL",
+        "PublicDescription": "Counts cache line refills in the level 1 instruction cache caused by a missed instruction fetch. Instruction fetches may include accessing multiple instructions, but the single cache line allocation is counted once."
+    },
+    {
+        "ArchStdEvent": "L1I_CACHE",
+        "PublicDescription": "Counts instruction fetches which access the level 1 instruction cache. Instruction cache accesses caused by cache maintenance operations are not counted."
+    },
+    {
+        "ArchStdEvent": "L1I_CACHE_LMISS",
+        "PublicDescription": "Counts cache line refills into the level 1 instruction cache, that incurred additional latency."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l2_cache.json new file +50 -0

50 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/l3_cache.json new file +22 -0
new file mode 100644
index 000000000000..45bfba532df7
@@ -0,0 +1,22 @@
+[
+    {
+        "ArchStdEvent": "L3D_CACHE_ALLOCATE",
+        "PublicDescription": "Counts level 3 cache line allocates that do not fetch data from outside the level 3 data or unified cache. For example, allocates due to streaming stores."
+    },
+    {
+        "ArchStdEvent": "L3D_CACHE_REFILL",
+        "PublicDescription": "Counts level 3 accesses that receive data from outside the L3 cache."
+    },
+    {
+        "ArchStdEvent": "L3D_CACHE",
+        "PublicDescription": "Counts level 3 cache accesses. level 3 cache is a unified cache for data and instruction accesses. Accesses are for misses in the lower level caches or translation resolutions due to accesses."
+    },
+    {
+        "ArchStdEvent": "L3D_CACHE_RD",
+        "PublicDescription": "TBD"
+    },
+    {
+        "ArchStdEvent": "L3D_CACHE_LMISS_RD",
+        "PublicDescription": "Counts any cache line refill into the level 3 cache from memory read operations that incurred additional latency."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/ll_cache.json new file +10 -0
new file mode 100644
index 000000000000..bb712d57d58a
@@ -0,0 +1,10 @@
+[
+    {
+        "ArchStdEvent": "LL_CACHE_RD",
+        "PublicDescription": "Counts read transactions that were returned from outside the core cluster. This event counts when the system register CPUECTLR.EXTLLC bit is set. This event counts read transactions returned from outside the core if those transactions are either hit in the system level cache or missed in the SLC and are returned from any other external sources."
+    },
+    {
+        "ArchStdEvent": "LL_CACHE_MISS_RD",
+        "PublicDescription": "Counts read transactions that were returned from outside the core cluster but missed in the system level cache. This event counts when the system register CPUECTLR.EXTLLC bit is set. This event counts read transactions returned from outside the core if those transactions are missed in the System level Cache. The data source of the transaction is indicated by a field in the CHI transaction returning to the CPU. This event does not count reads caused by cache maintenance operations."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/memory.json +22 -17
index 7b2b21ac150f..106a97f8b2e7 100644
@@ -1,41 +1,46 @@
 [
     {
-        "ArchStdEvent": "MEM_ACCESS"
+        "ArchStdEvent": "MEM_ACCESS",
+        "PublicDescription": "Counts memory accesses issued by the CPU load store unit, where those accesses are issued due to load or store operations. This event counts memory accesses no matter whether the data is received from any level of cache hierarchy or external memory. If memory accesses are broken up into smaller transactions than what were specified in the load or store instructions, then the event counts those smaller memory transactions."
     },
     {
-        "ArchStdEvent": "REMOTE_ACCESS"
+        "ArchStdEvent": "MEMORY_ERROR",
+        "PublicDescription": "Counts any detected correctable or uncorrectable physical memory errors (ECC or parity) in protected CPUs RAMs. On the core, this event counts errors in the caches (including data and tag rams). Any detected memory error (from either a speculative and abandoned access, or an architecturally executed access) is counted. Note that errors are only detected when the actual protected memory is accessed by an operation."
     },
     {
-        "ArchStdEvent": "MEM_ACCESS_RD"
+        "ArchStdEvent": "REMOTE_ACCESS",
+        "PublicDescription": "Counts accesses to another chip, which is implemented as a different CMN mesh in the system. If the CHI bus response back to the core indicates that the data source is from another chip (mesh), then the counter is updated. If no data is returned, even if the system snoops another chip/mesh, then the counter is not updated."
     },
     {
-        "ArchStdEvent": "MEM_ACCESS_WR"
+        "ArchStdEvent": "MEM_ACCESS_RD",
+        "PublicDescription": "Counts memory accesses issued by the CPU due to load operations. The event counts any memory load access, no matter whether the data is received from any level of cache hierarchy or external memory. The event also counts atomic load operations. If memory accesses are broken up by the load/store unit into smaller transactions that are issued by the bus interface, then the event counts those smaller transactions."
     },
     {
-        "ArchStdEvent": "UNALIGNED_LD_SPEC"
+        "ArchStdEvent": "MEM_ACCESS_WR",
+        "PublicDescription": "Counts memory accesses issued by the CPU due to store operations. The event counts any memory store access, no matter whether the data is located in any level of cache or external memory. The event also counts atomic load and store operations. If memory accesses are broken up by the load/store unit into smaller transactions that are issued by the bus interface, then the event counts those smaller transactions."
     },
     {
-        "ArchStdEvent": "UNALIGNED_ST_SPEC"
+        "ArchStdEvent": "LDST_ALIGN_LAT",
+        "PublicDescription": "Counts the number of memory read and write accesses in a cycle that incurred additional latency, due to the alignment of the address and the size of data being accessed, which results in store crossing a single cache line."
     },
     {
-        "ArchStdEvent": "UNALIGNED_LDST_SPEC"
+        "ArchStdEvent": "LD_ALIGN_LAT",
+        "PublicDescription": "Counts the number of memory read accesses in a cycle that incurred additional latency, due to the alignment of the address and size of data being accessed, which results in load crossing a single cache line."
     },
     {
-        "ArchStdEvent": "LDST_ALIGN_LAT"
+        "ArchStdEvent": "ST_ALIGN_LAT",
+        "PublicDescription": "Counts the number of memory write access in a cycle that incurred additional latency, due to the alignment of the address and size of data being accessed incurred additional latency."
     },
     {
-        "ArchStdEvent": "LD_ALIGN_LAT"
+        "ArchStdEvent": "MEM_ACCESS_CHECKED",
+        "PublicDescription": "Counts the number of memory read and write accesses in a cycle that are tag checked by the Memory Tagging Extension (MTE)."
     },
     {
-        "ArchStdEvent": "ST_ALIGN_LAT"
+        "ArchStdEvent": "MEM_ACCESS_CHECKED_RD",
+        "PublicDescription": "Counts the number of memory read accesses in a cycle that are tag checked by the Memory Tagging Extension (MTE)."
     },
     {
-        "ArchStdEvent": "MEM_ACCESS_CHECKED"
-    },
-    {
-        "ArchStdEvent": "MEM_ACCESS_CHECKED_RD"
-    },
-    {
-        "ArchStdEvent": "MEM_ACCESS_CHECKED_WR"
+        "ArchStdEvent": "MEM_ACCESS_CHECKED_WR",
+        "PublicDescription": "Counts the number of memory write accesses in a cycle that is tag checked by the Memory Tagging Extension (MTE)."
     }
 ]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/metrics.json +198 -167

470 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/pipeline.json deleted +0 -23
deleted file mode 100644
index f9fae15f7555..000000000000
@@ -1,23 +0,0 @@
-[
-    {
-        "ArchStdEvent": "STALL_FRONTEND"
-    },
-    {
-        "ArchStdEvent": "STALL_BACKEND"
-    },
-    {
-        "ArchStdEvent": "STALL"
-    },
-    {
-        "ArchStdEvent": "STALL_SLOT_BACKEND"
-    },
-    {
-        "ArchStdEvent": "STALL_SLOT_FRONTEND"
-    },
-    {
-        "ArchStdEvent": "STALL_SLOT"
-    },
-    {
-        "ArchStdEvent": "STALL_BACKEND_MEM"
-    }
-]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/retired.json new file +30 -0
new file mode 100644
index 000000000000..f297b049b62f
@@ -0,0 +1,30 @@
+[
+    {
+        "ArchStdEvent": "SW_INCR",
+        "PublicDescription": "Counts software writes to the PMSWINC_EL0 (software PMU increment) register. The PMSWINC_EL0 register is a manually updated counter for use by application software.\n\nThis event could be used to measure any user program event, such as accesses to a particular data structure (by writing to the PMSWINC_EL0 register each time the data structure is accessed).\n\nTo use the PMSWINC_EL0 register and event, developers must insert instructions that write to the PMSWINC_EL0 register into the source code.\n\nSince the SW_INCR event records writes to the PMSWINC_EL0 register, there is no need to do a read/increment/write sequence to the PMSWINC_EL0 register."
+    },
+    {
+        "ArchStdEvent": "INST_RETIRED",
+        "PublicDescription": "Counts instructions that have been architecturally executed."
+    },
+    {
+        "ArchStdEvent": "CID_WRITE_RETIRED",
+        "PublicDescription": "Counts architecturally executed writes to the CONTEXTIDR register, which usually contain the kernel PID and can be output with hardware trace."
+    },
+    {
+        "ArchStdEvent": "TTBR_WRITE_RETIRED",
+        "PublicDescription": "Counts architectural writes to TTBR0/1_EL1. If virtualization host extensions are enabled (by setting the HCR_EL2.E2H bit to 1), then accesses to TTBR0/1_EL1 that are redirected to TTBR0/1_EL2, or accesses to TTBR0/1_EL12, are counted. TTBRn registers are typically updated when the kernel is swapping user-space threads or applications."
+    },
+    {
+        "ArchStdEvent": "BR_RETIRED",
+        "PublicDescription": "Counts architecturally executed branches, whether the branch is taken or not. Instructions that explicitly write to the PC are also counted."
+    },
+    {
+        "ArchStdEvent": "BR_MIS_PRED_RETIRED",
+        "PublicDescription": "Counts branches counted by BR_RETIRED which were mispredicted and caused a pipeline flush."
+    },
+    {
+        "ArchStdEvent": "OP_RETIRED",
+        "PublicDescription": "Counts micro-operations that are architecturally executed. This is a count of number of micro-operations retired from the commit queue in a single cycle."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/spe.json +8 -4
index 20f2165c85fe..5de8b0f3a440 100644
@@ -1,14 +1,18 @@
 [
     {
-        "ArchStdEvent": "SAMPLE_POP"
+        "ArchStdEvent": "SAMPLE_POP",
+        "PublicDescription": "Counts statistical profiling sample population, the count of all operations that could be sampled but may or may not be chosen for sampling."
     },
     {
-        "ArchStdEvent": "SAMPLE_FEED"
+        "ArchStdEvent": "SAMPLE_FEED",
+        "PublicDescription": "Counts statistical profiling samples taken for sampling."
     },
     {
-        "ArchStdEvent": "SAMPLE_FILTRATE"
+        "ArchStdEvent": "SAMPLE_FILTRATE",
+        "PublicDescription": "Counts statistical profiling samples taken which are not removed by filtering."
     },
     {
-        "ArchStdEvent": "SAMPLE_COLLISION"
+        "ArchStdEvent": "SAMPLE_COLLISION",
+        "PublicDescription": "Counts statistical profiling samples that have collided with a previous sample and so therefore not taken."
     }
 ]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/spec_operation.json new file +110 -0

110 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/stall.json new file +30 -0
new file mode 100644
index 000000000000..bbbebc805034
@@ -0,0 +1,30 @@
+[
+    {
+        "ArchStdEvent": "STALL_FRONTEND",
+        "PublicDescription": "Counts cycles when frontend could not send any micro-operations to the rename stage because of frontend resource stalls caused by fetch memory latency or branch prediction flow stalls. All the frontend slots were empty during the cycle when this event counts."
+    },
+    {
+        "ArchStdEvent": "STALL_BACKEND",
+        "PublicDescription": "Counts cycles whenever the rename unit is unable to send any micro-operations to the backend of the pipeline because of backend resource constraints. Backend resource constraints can include issue stage fullness, execution stage fullness, or other internal pipeline resource fullness. All the backend slots were empty during the cycle when this event counts."
+    },
+    {
+        "ArchStdEvent": "STALL",
+        "PublicDescription": "Counts cycles when no operations are sent to the rename unit from the frontend or from the rename unit to the backend for any reason (either frontend or backend stall)."
+    },
+    {
+        "ArchStdEvent": "STALL_SLOT_BACKEND",
+        "PublicDescription": "Counts slots per cycle in which no operations are sent from the rename unit to the backend due to backend resource constraints."
+    },
+    {
+        "ArchStdEvent": "STALL_SLOT_FRONTEND",
+        "PublicDescription": "Counts slots per cycle in which no operations are sent to the rename unit from the frontend due to frontend resource constraints."
+    },
+    {
+        "ArchStdEvent": "STALL_SLOT",
+        "PublicDescription": "Counts slots per cycle in which no operations are sent to the rename unit from the frontend or from the rename unit to the backend for any reason (either frontend or backend stall)."
+    },
+    {
+        "ArchStdEvent": "STALL_BACKEND_MEM",
+        "PublicDescription": "Counts cycles when the backend is stalled because there is a pending demand load request in progress in the last level core cache."
+    }
+]
tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/sve.json new file +50 -0

50 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/tlb.json new file +66 -0

66 lines not on this page · raw message

tools/perf/pmu-events/arch/arm64/arm/neoverse-n2-v2/trace.json +18 -9
index 3116135c59e2..98f6fabfebc7 100644
@@ -1,29 +1,38 @@
 [
     {
-        "ArchStdEvent": "TRB_WRAP"
+        "ArchStdEvent": "TRB_WRAP",
+        "PublicDescription": "This event is generated each time the current write pointer is wrapped to the base pointer."
     },
     {
-        "ArchStdEvent": "TRCEXTOUT0"
+        "ArchStdEvent": "TRCEXTOUT0",
+        "PublicDescription": "This event is generated each time an event is signaled by ETE external event 0."
     },
     {
-        "ArchStdEvent": "TRCEXTOUT1"
+        "ArchStdEvent": "TRCEXTOUT1",
+        "PublicDescription": "This event is generated each time an event is signaled by ETE external event 1."
     },
     {
-        "ArchStdEvent": "TRCEXTOUT2"
+        "ArchStdEvent": "TRCEXTOUT2",
+        "PublicDescription": "This event is generated each time an event is signaled by ETE external event 2."
     },
     {
-        "ArchStdEvent": "TRCEXTOUT3"
+        "ArchStdEvent": "TRCEXTOUT3",
+        "PublicDescription": "This event is generated each time an event is signaled by ETE external event 3."
     },
     {
-        "ArchStdEvent": "CTI_TRIGOUT4"
+        "ArchStdEvent": "CTI_TRIGOUT4",
+        "PublicDescription": "This event is generated each time an event is signaled on CTI output trigger 4."
     },
     {
-        "ArchStdEvent": "CTI_TRIGOUT5"
+        "ArchStdEvent": "CTI_TRIGOUT5",
+        "PublicDescription": "This event is generated each time an event is signaled on CTI output trigger 5."
     },
     {
-        "ArchStdEvent": "CTI_TRIGOUT6"
+        "ArchStdEvent": "CTI_TRIGOUT6",
+        "PublicDescription": "This event is generated each time an event is signaled on CTI output trigger 6."
     },
     {
-        "ArchStdEvent": "CTI_TRIGOUT7"
+        "ArchStdEvent": "CTI_TRIGOUT7",
+        "PublicDescription": "This event is generated each time an event is signaled on CTI output trigger 7."
     }
 ]
Signature · 1 line
2.34.1