On 11/10/26 7:17 AM, Matt Turner wrote:
The L1D row of the cache event table has load and store misses but no
accesses, and nothing for prefetches, so L1-dcache-loads,
L1-dcache-stores and L1-dcache-prefetch-misses are not supported.

The MPC7450 has no L1 data cache access event, so approximate the
accesses with PMC2 select 26 (load instructions completed) and select
20 (store instructions completed, PMC1 or PMC2).  These also count
cache-inhibited accesses.  PMC2 select 38 counts dcbt, dcbtst and dst
line fetches that miss in the L1 data cache.

On a 7448, a loop with one store in every 32 instructions counted
645840841 instructions and 19773839 L1-dcache-stores, about one store
per 33 instructions.

Loads and load misses are both PMC2-only events, so perf multiplexes
L1-dcache-loads and L1-dcache-load-misses when both are requested, and
refuses them in one group.

Signed-off-by: Matt Turner <[email protected]>
Hi Matt,

I checked the new L1D entries against MPC7450UM Rev. 5:

  0x21a  PMC2 select 26 (Table 11-10), "Load instructions completed"
  0x014  select 20 (Tables 11-9 and 11-10), "Store instructions
         completed", valid on PMC1 or PMC2
  0x226  PMC2 select 38 (Table 11-10), "L1 data touch miss"

The codes match the descriptions in the commit message. 0x014 falls
in the "PMC1 or PMC2" class in mpc7450_classify_event(), and 0x21a and
0x226 are PMC2-only, which agrees with your note that perf can't put
L1-dcache-loads and L1-dcache-load-misses in one group.

Using completed load/store instructions for the L1D access slots is an
approximation, but I think it's reasonable given there is no L1D access
event, and x86 does something similar. I'll leave it to the maintainers
if they feel differently.

If you have a quick load-only run for 0x21a,
it would be nice to see the numbers, but that's not a blocker.

Reviewed-by: Tanushree Shah <[email protected]>


Thanks
Tanushree Shah
---
  arch/powerpc/perf/mpc7450-pmu.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/perf/mpc7450-pmu.c b/arch/powerpc/perf/mpc7450-pmu.c
index 9890c87c58ef..27337a03ebde 100644
--- a/arch/powerpc/perf/mpc7450-pmu.c
+++ b/arch/powerpc/perf/mpc7450-pmu.c
@@ -362,9 +362,9 @@ static int mpc7450_generic_events[] = {
   */
  static u64 mpc7450_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
        [C(L1D)] = {            /*      RESULT_ACCESS   RESULT_MISS */
-               [C(OP_READ)] = {        0,              0x225   },
-               [C(OP_WRITE)] = {       0,              0x227   },
-               [C(OP_PREFETCH)] = {    0,              0       },
+               [C(OP_READ)] = {        0x21a,          0x225   },
+               [C(OP_WRITE)] = {       0x014,          0x227   },
+               [C(OP_PREFETCH)] = {    0,              0x226   },
        },
        [C(L1I)] = {            /*      RESULT_ACCESS   RESULT_MISS */
                [C(OP_READ)] = {        0x129,          0x115   },


Reply via email to