4 #include <linux/stddef.h> // for define __always_inline
6 #include <linux/types.h>
7 #include <linux/perf_event.h>
10 // non-UAPI kernel data structures, used in the .bpf.c BPF tool component.
12 // Just the fields used in these tools preserving the access index so that
13 // libbpf can fixup offsets with the ones used in the kernel when loading the
14 // BPF bytecode, if they differ from what is used here.
24 typedef __s64 time64_t
;
31 enum cgroup_subsys_id
{
32 perf_event_cgrp_id
= 8,
45 RCU_SOFTIRQ
, /* Preferable RCU should always be the last softirq */
52 } __attribute__((preserve_access_index
)) atomic64_t
;
54 typedef atomic64_t atomic_long_t
;
58 } __attribute__((preserve_access_index
));
60 typedef struct raw_spinlock raw_spinlock_t
;
63 struct raw_spinlock rlock
;
64 } __attribute__((preserve_access_index
)) spinlock_t
;
66 struct sighand_struct
{
68 } __attribute__((preserve_access_index
));
72 } __attribute__((preserve_access_index
));
76 } __attribute__((preserve_access_index
));
80 } __attribute__((preserve_access_index
));
83 struct kernfs_node
*kn
;
85 } __attribute__((preserve_access_index
));
87 struct cgroup_subsys_state
{
88 struct cgroup
*cgroup
;
89 } __attribute__((preserve_access_index
));
92 struct cgroup_subsys_state
*subsys
[13];
93 struct cgroup
*dfl_cgrp
;
94 } __attribute__((preserve_access_index
));
97 struct rw_semaphore mmap_lock
;
98 } __attribute__((preserve_access_index
));
102 struct mm_struct
*mm
;
106 struct sighand_struct
*sighand
;
107 struct css_set
*cgroups
;
108 } __attribute__((preserve_access_index
));
111 short unsigned int type
;
113 unsigned char preempt_count
;
115 } __attribute__((preserve_access_index
));
117 struct trace_event_raw_irq_handler_entry
{
118 struct trace_entry ent
;
122 } __attribute__((preserve_access_index
));
124 struct trace_event_raw_irq_handler_exit
{
125 struct trace_entry ent
;
129 } __attribute__((preserve_access_index
));
131 struct trace_event_raw_softirq
{
132 struct trace_entry ent
;
135 } __attribute__((preserve_access_index
));
137 struct trace_event_raw_workqueue_execute_start
{
138 struct trace_entry ent
;
142 } __attribute__((preserve_access_index
));
144 struct trace_event_raw_workqueue_execute_end
{
145 struct trace_entry ent
;
149 } __attribute__((preserve_access_index
));
151 struct trace_event_raw_workqueue_activate_work
{
152 struct trace_entry ent
;
155 } __attribute__((preserve_access_index
));
157 struct perf_sample_data
{
160 union perf_sample_weight weight
;
162 union perf_mem_data_src data_src
;
177 } __attribute__((__aligned__(64))) __attribute__((preserve_access_index
));
180 struct perf_event
*parent
;
182 } __attribute__((preserve_access_index
));
184 struct bpf_perf_event_data_kern
{
185 struct perf_sample_data
*data
;
186 struct perf_event
*event
;
187 } __attribute__((preserve_access_index
));
190 * If 'struct rq' isn't defined for lock_contention.bpf.c, for the sake of
191 * rq___old and rq___new, then the type for the 'runqueue' variable ends up
192 * being a forward declaration (BTF_KIND_FWD) while the kernel has it defined
193 * (BTF_KIND_STRUCT). The definition appears in vmlinux.h rather than
194 * lock_contention.bpf.c for consistency with a generated vmlinux.h.
198 #endif // __VMLINUX_H