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
6struct contention_key {
7	u32 stack_id;
8	u32 pid;
9	u64 lock_addr;
10};
11
12#define TASK_COMM_LEN  16
13
14struct 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
30struct contention_data {
31	u64 total_time;
32	u64 min_time;
33	u64 max_time;
34	u32 count;
35	u32 flags;
36};
37
38enum lock_aggr_mode {
39	LOCK_AGGR_ADDR = 0,
40	LOCK_AGGR_TASK,
41	LOCK_AGGR_CALLER,
42};
43
44enum lock_class_sym {
45	LOCK_CLASS_NONE,
46	LOCK_CLASS_RQLOCK,
47};
48
49#endif /* UTIL_BPF_SKEL_LOCK_DATA_H */
50