Going forward, future generation systems can have more hierarchy within the node/package level but currently we don't have any data source encoding field in perf, which can be used to represent this level of data. Add a new field called 'mem_hops' in the perf_mem_data_src structure which can be used to represent intra-node/package or inter-node/off-package details. This field is of size 3 bits where PERF_MEM_HOPS_{NA, 0..6} value can be used to present different hop levels data. Also add corresponding macros to define mem_hop field values and shift value. Currently we define macro for HOPS_0 which corresponds to data coming from another core but same node. Add functionality to represent mem_hop field data in perf_mem__lvl_scnprintf function with the help of added string array called mem_hops. For ex: Encodings for mem_hops fields with L2 cache: L2 - local L2 L2 | REMOTE | HOPS_0 - remote core, same node L2 Since with the addition of HOPS field, now remote can be used to denote cache access from the same node but different core, a check is added in the c2c_decode_stats function to set mrem only when HOPS is zero along with set remote field.
Showing the changes to tools/include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -1210,14 +1210,16 @@ union perf_mem_data_src { · 1209 unmodified lines | ||
| 1210 | 1210 | mem_remote:1, /* remote */ |
| 1211 | 1211 | mem_snoopx:2, /* snoop mode, ext */ |
| 1212 | 1212 | mem_blk:3, /* access blocked */ |
| 1213 | − mem_rsvd:21; | |
| 1213 | + mem_hops:3, /* hop level */ | |
| 1214 | + mem_rsvd:18; | |
| 1214 | 1215 | }; |
| 1215 | 1216 | }; |
| 1216 | 1217 | #elif defined(__BIG_ENDIAN_BITFIELD) |
| 1217 | 1218 | union perf_mem_data_src { |
| 1218 | 1219 | __u64 val; |
| 1219 | 1220 | struct { |
| 1220 | − __u64 mem_rsvd:21, | |
| 1221 | + __u64 mem_rsvd:18, | |
| 1222 | + mem_hops:3, /* hop level */ | |
| 1221 | 1223 | mem_blk:3, /* access blocked */ |
| 1222 | 1224 | mem_snoopx:2, /* snoop mode, ext */ |
| 1223 | 1225 | mem_remote:1, /* remote */ |
| @@ -1313,6 +1315,11 @@ union perf_mem_data_src { · 89 unmodified lines | ||
| 1313 | 1315 | #define PERF_MEM_BLK_ADDR 0x04 /* address conflict */ |
| 1314 | 1316 | #define PERF_MEM_BLK_SHIFT 40 |
| 1315 | 1317 | |
| 1318 | +/* hop level */ | |
| 1319 | +#define PERF_MEM_HOPS_0 0x01 /* remote core, same node */ | |
| 1320 | +/* 2-7 available */ | |
| 1321 | +#define PERF_MEM_HOPS_SHIFT 43 | |
| 1322 | + | |
| 1316 | 1323 | #define PERF_MEM_S(a, s) \ |
| 1317 | 1324 | (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) |
| 1318 | 1325 | |