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 contention_key {
7 	u32 stack_id;
8 	u32 pid;
9 	u64 lock_addr;
10 };
11 
12 #define TASK_COMM_LEN  16
13 
14 struct contention_task_data {
15 	char comm[TASK_COMM_LEN];
16 };
17 
18 /*
19  * Upper bits of the flags in the contention_data are used to identify
20  * some well-known locks which do not have symbols (non-global locks).
21  */
22 #define LCD_F_MMAP_LOCK		(1U << 31)
23 #define LCD_F_SIGHAND_LOCK	(1U << 30)
24 
25 #define LCB_F_MAX_FLAGS		(1U << 7)
26 
27 struct contention_data {
28 	u64 total_time;
29 	u64 min_time;
30 	u64 max_time;
31 	u32 count;
32 	u32 flags;
33 };
34 
35 enum lock_aggr_mode {
36 	LOCK_AGGR_ADDR = 0,
37 	LOCK_AGGR_TASK,
38 	LOCK_AGGR_CALLER,
39 };
40 
41 enum lock_class_sym {
42 	LOCK_CLASS_NONE,
43 	LOCK_CLASS_RQLOCK,
44 };
45 
46 #endif /* UTIL_BPF_SKEL_LOCK_DATA_H */
47