xref: /linux/tools/perf/util/bpf_skel/lock_data.h (revision da5b2ad1c2f18834cb1ce429e2e5a5cf5cbdf21b)
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Data structures shared between BPF and tools. */
3 #ifndef UTIL_BPF_SKEL_LOCK_DATA_H
4 #define UTIL_BPF_SKEL_LOCK_DATA_H
5 
6 struct tstamp_data {
7 	u64 timestamp;
8 	u64 lock;
9 	u32 flags;
10 	u32 stack_id;
11 };
12 
13 struct contention_key {
14 	u32 stack_id;
15 	u32 pid;
16 	u64 lock_addr_or_cgroup;
17 };
18 
19 #define TASK_COMM_LEN  16
20 
21 struct contention_task_data {
22 	char comm[TASK_COMM_LEN];
23 };
24 
25 /* default buffer size */
26 #define MAX_ENTRIES  16384
27 
28 /*
29  * Upper bits of the flags in the contention_data are used to identify
30  * some well-known locks which do not have symbols (non-global locks).
31  */
32 #define LCD_F_MMAP_LOCK		(1U << 31)
33 #define LCD_F_SIGHAND_LOCK	(1U << 30)
34 
35 #define LCB_F_MAX_FLAGS		(1U << 7)
36 
37 struct contention_data {
38 	u64 total_time;
39 	u64 min_time;
40 	u64 max_time;
41 	u32 count;
42 	u32 flags;
43 };
44 
45 enum lock_aggr_mode {
46 	LOCK_AGGR_ADDR = 0,
47 	LOCK_AGGR_TASK,
48 	LOCK_AGGR_CALLER,
49 	LOCK_AGGR_CGROUP,
50 };
51 
52 enum lock_class_sym {
53 	LOCK_CLASS_NONE,
54 	LOCK_CLASS_RQLOCK,
55 };
56 
57 #endif /* UTIL_BPF_SKEL_LOCK_DATA_H */
58