Skip to contentSkip to conversation

perf pmu-events AMD: Switch l2_itlb_misses to bp_l1_tlb_miss_l2_tlb_miss.all

PATCH Applied Ian Rogers 3 participants 4 messages Apr 14 – May 14 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf pmu-events AMD: Switch l2_itlb_misses to bp_l1_tlb_miss_l2_tlb_miss.all

l2_itlb_misses is a valid legacy cache event name, hence allowing it in all_events in metric.py. l2_itlb_misses was also a json event for AMD zen1, zen2 and zen3. For zen4, zen5 and zen6 the checking that metric events are within the json was skipping l2_itlb_misses as it is a valid legacy event, however, the PMU driver lacks the event mapping causing it to be a bad event when used in the metric. Add bp_l1_tlb_miss_l2_tlb_miss.all as the l2 itlb miss event (bp = branch predictor, the AMD way to say itlb), so that is used in preference to l2_itlb_misses when the event exists. Remove l2_itlb_misses from metric.py as the legacy event isn't used by any metrics and having it is error prone for newer AMD zen models.

Fixes e596f329668e ("perf jevents: Add itlb metric group for AMD")
---
 tools/perf/pmu-events/amd_metrics.py | 2 +-
 tools/perf/pmu-events/metric.py      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/pmu-events/amd_metrics.py +1 -1
index 63e5098606c4..ee5381646a8d 100755
@@ -287,7 +287,7 @@ def AmdDtlb() -> Optional[MetricGroup]:
 def AmdItlb():
     global _zen_model
     l2h = Event("bp_l1_tlb_miss_l2_tlb_hit", "bp_l1_tlb_miss_l2_hit")
-    l2m = Event("l2_itlb_misses")
+    l2m = Event("bp_l1_tlb_miss_l2_tlb_miss.all", "l2_itlb_misses",)
     l2r = l2h + l2m
 
     itlb_l1_mg = None
tools/perf/pmu-events/metric.py +0 -1
index 0c41a502cf21..c1931b2a5170 100644
@@ -25,7 +25,6 @@ def LoadEvents(directory: str) -> None:
       "cycles",
       "duration_time",
       "instructions",
-      "l2_itlb_misses",
   }
   for file in os.listdir(os.fsencode(directory)):
     filename = os.fsdecode(file)
Signature · 1 line
2.54.0.rc0.605.g598a273b03-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 37 lines · Ian Rogers

l2_itlb_misses is a valid legacy cache event name, hence allowing it in all_events in metric.py. l2_itlb_misses was also a json event for AMD zen1, zen2 and zen3. For zen4, zen5 and zen6 the checking that metric events are within the json was skipping l2_itlb_misses as it is a valid legacy event, however, the PMU driver lacks the event mapping causing it to be a bad event when used in the metric. Add bp_l1_tlb_miss_l2_tlb_miss.all as the l2 itlb miss event (bp = branch predictor, the AMD way to say itlb), so that is used in preference to l2_itlb_misses when the event exists. Remove l2_itlb_misses from metric.py as the legacy event isn't used by any metrics and having it is error prone for newer AMD zen models.

Fixes e596f329668e ("perf jevents: Add itlb metric group for AMD")
---
 tools/perf/pmu-events/amd_metrics.py | 2 +-
 tools/perf/pmu-events/metric.py      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/pmu-events/amd_metrics.py +1 -1
index 63e5098606c4..ee5381646a8d 100755
@@ -287,7 +287,7 @@ def AmdDtlb() -> Optional[MetricGroup]:
 def AmdItlb():
     global _zen_model
     l2h = Event("bp_l1_tlb_miss_l2_tlb_hit", "bp_l1_tlb_miss_l2_hit")
-    l2m = Event("l2_itlb_misses")
+    l2m = Event("bp_l1_tlb_miss_l2_tlb_miss.all", "l2_itlb_misses",)
     l2r = l2h + l2m
 
     itlb_l1_mg = None
tools/perf/pmu-events/metric.py +0 -0
index 0c41a502cf21..c1931b2a5170 100644

tools/perf/pmu-events/metric.py def LoadEvents(directory: str) -> None: · line 30

Quoted 7 lines
tools/perf/pmu-events/metric.py +0 -1
@@ -25,7 +25,6 @@ def LoadEvents(directory: str) -> None:
       "cycles",
       "duration_time",
       "instructions",
-      "l2_itlb_misses",
   }
   for file in os.listdir(os.fsencode(directory)):
     filename = os.fsdecode(file)
author reviewer
#2 lore raw
Quoted 33 lines · Sandipan Das
Quoted 31 lines · Ian Rogers

l2_itlb_misses is a valid legacy cache event name, hence allowing it in all_events in metric.py. l2_itlb_misses was also a json event for AMD zen1, zen2 and zen3. For zen4, zen5 and zen6 the checking that metric events are within the json was skipping l2_itlb_misses as it is a valid legacy event, however, the PMU driver lacks the event mapping causing it to be a bad event when used in the metric. Add bp_l1_tlb_miss_l2_tlb_miss.all as the l2 itlb miss event (bp = branch predictor, the AMD way to say itlb), so that is used in preference to l2_itlb_misses when the event exists. Remove l2_itlb_misses from metric.py as the legacy event isn't used by any metrics and having it is error prone for newer AMD zen models.

Fixes e596f329668e ("perf jevents: Add itlb metric group for AMD")
---
 tools/perf/pmu-events/amd_metrics.py | 2 +-
 tools/perf/pmu-events/metric.py      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/pmu-events/amd_metrics.py +1 -1
index 63e5098606c4..ee5381646a8d 100755
@@ -287,7 +287,7 @@ def AmdDtlb() -> Optional[MetricGroup]:
 def AmdItlb():
     global _zen_model
     l2h = Event("bp_l1_tlb_miss_l2_tlb_hit", "bp_l1_tlb_miss_l2_hit")
-    l2m = Event("l2_itlb_misses")
+    l2m = Event("bp_l1_tlb_miss_l2_tlb_miss.all", "l2_itlb_misses",)
     l2r = l2h + l2m
 
Quoted 15 lines

tools/perf/pmu-events/metric.py def LoadEvents(directory: str) -> None: · line 30

Quoted 13 lines
tools/perf/pmu-events/amd_metrics.py +0 -0
     itlb_l1_mg = None
tools/perf/pmu-events/metric.py +0 -1
index 0c41a502cf21..c1931b2a5170 100644
@@ -25,7 +25,6 @@ def LoadEvents(directory: str) -> None:
       "cycles",
       "duration_time",
       "instructions",
-      "l2_itlb_misses",
   }
   for file in os.listdir(os.fsencode(directory)):
     filename = os.fsdecode(file)

Ping.

Thanks,
Ian

maintainer Applied
#3 lore raw
Quoted 50 lines · Ian Rogers
Quoted 33 lines · Sandipan Das
Quoted 31 lines · Ian Rogers

l2_itlb_misses is a valid legacy cache event name, hence allowing it in all_events in metric.py. l2_itlb_misses was also a json event for AMD zen1, zen2 and zen3. For zen4, zen5 and zen6 the checking that metric events are within the json was skipping l2_itlb_misses as it is a valid legacy event, however, the PMU driver lacks the event mapping causing it to be a bad event when used in the metric. Add bp_l1_tlb_miss_l2_tlb_miss.all as the l2 itlb miss event (bp = branch predictor, the AMD way to say itlb), so that is used in preference to l2_itlb_misses when the event exists. Remove l2_itlb_misses from metric.py as the legacy event isn't used by any metrics and having it is error prone for newer AMD zen models.

Fixes e596f329668e ("perf jevents: Add itlb metric group for AMD")
---
 tools/perf/pmu-events/amd_metrics.py | 2 +-
 tools/perf/pmu-events/metric.py      | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
tools/perf/pmu-events/amd_metrics.py +1 -1
index 63e5098606c4..ee5381646a8d 100755
@@ -287,7 +287,7 @@ def AmdDtlb() -> Optional[MetricGroup]:
 def AmdItlb():
     global _zen_model
     l2h = Event("bp_l1_tlb_miss_l2_tlb_hit", "bp_l1_tlb_miss_l2_hit")
-    l2m = Event("l2_itlb_misses")
+    l2m = Event("bp_l1_tlb_miss_l2_tlb_miss.all", "l2_itlb_misses",)
     l2r = l2h + l2m
 
Quoted 15 lines

tools/perf/pmu-events/metric.py def LoadEvents(directory: str) -> None: · line 30

Quoted 13 lines
tools/perf/pmu-events/amd_metrics.py +0 -0
     itlb_l1_mg = None
tools/perf/pmu-events/metric.py +0 -1
index 0c41a502cf21..c1931b2a5170 100644
@@ -25,7 +25,6 @@ def LoadEvents(directory: str) -> None:
       "cycles",
       "duration_time",
       "instructions",
-      "l2_itlb_misses",
   }
   for file in os.listdir(os.fsencode(directory)):
     filename = os.fsdecode(file)
Quoted 1 line

Ping.

Thanks, applied to perf-tools-next, for v7.2.

- Arnaldo