Skip to content

Commit fec9cc6

Browse files
kjain101Peter Zijlstra
authored andcommitted
perf: Add mem_hops field in perf_mem_data_src structure
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. For ex: Encodings for mem_hops fields with L2 cache: L2 - local L2 L2 | REMOTE | HOPS_0 - remote core, same node L2 Signed-off-by: Kajol Jain <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f4c6217 commit fec9cc6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

include/uapi/linux/perf_event.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,14 +1225,16 @@ union perf_mem_data_src {
12251225
mem_remote:1, /* remote */
12261226
mem_snoopx:2, /* snoop mode, ext */
12271227
mem_blk:3, /* access blocked */
1228-
mem_rsvd:21;
1228+
mem_hops:3, /* hop level */
1229+
mem_rsvd:18;
12291230
};
12301231
};
12311232
#elif defined(__BIG_ENDIAN_BITFIELD)
12321233
union perf_mem_data_src {
12331234
__u64 val;
12341235
struct {
1235-
__u64 mem_rsvd:21,
1236+
__u64 mem_rsvd:18,
1237+
mem_hops:3, /* hop level */
12361238
mem_blk:3, /* access blocked */
12371239
mem_snoopx:2, /* snoop mode, ext */
12381240
mem_remote:1, /* remote */
@@ -1328,6 +1330,11 @@ union perf_mem_data_src {
13281330
#define PERF_MEM_BLK_ADDR 0x04 /* address conflict */
13291331
#define PERF_MEM_BLK_SHIFT 40
13301332

1333+
/* hop level */
1334+
#define PERF_MEM_HOPS_0 0x01 /* remote core, same node */
1335+
/* 2-7 available */
1336+
#define PERF_MEM_HOPS_SHIFT 43
1337+
13311338
#define PERF_MEM_S(a, s) \
13321339
(((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
13331340

0 commit comments

Comments
 (0)