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