File Index
Files and directories
Sign in
FILE

vmlinux.h

File preview with syntax highlighting.

linux-6.19.14/tools/perf/util/bpf_skel/vmlinux/vmlinux.h C
  1#ifndef __VMLINUX_H
  2#define __VMLINUX_H
  3
  4#include <linux/stddef.h> // for define __always_inline
  5#include <linux/bpf.h>
  6#include <linux/types.h>
  7#include <linux/perf_event.h>
  8#include <stdbool.h>
  9
 10// non-UAPI kernel data structures, used in the .bpf.c BPF tool component.
 11
 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.
 15
 16typedef __u8 u8;
 17typedef __u32 u32;
 18typedef __s32 s32;
 19typedef __u64 u64;
 20typedef __s64 s64;
 21
 22typedef int pid_t;
 23
 24typedef __s64 time64_t;
 25
 26struct timespec64 {
 27        time64_t        tv_sec;
 28        long int        tv_nsec;
 29};
 30
 31enum cgroup_subsys_id {
 32	perf_event_cgrp_id  = 8,
 33};
 34
 35enum {
 36	HI_SOFTIRQ = 0,
 37	TIMER_SOFTIRQ,
 38	NET_TX_SOFTIRQ,
 39	NET_RX_SOFTIRQ,
 40	BLOCK_SOFTIRQ,
 41	IRQ_POLL_SOFTIRQ,
 42	TASKLET_SOFTIRQ,
 43	SCHED_SOFTIRQ,
 44	HRTIMER_SOFTIRQ,
 45	RCU_SOFTIRQ,    /* Preferable RCU should always be the last softirq */
 46
 47	NR_SOFTIRQS
 48};
 49
 50typedef struct {
 51	s64	counter;
 52} __attribute__((preserve_access_index)) atomic64_t;
 53
 54typedef atomic64_t atomic_long_t;
 55
 56struct raw_spinlock {
 57	int rawlock;
 58} __attribute__((preserve_access_index));
 59
 60typedef struct raw_spinlock raw_spinlock_t;
 61
 62typedef struct {
 63	struct raw_spinlock rlock;
 64} __attribute__((preserve_access_index)) spinlock_t;
 65
 66struct sighand_struct {
 67	spinlock_t siglock;
 68} __attribute__((preserve_access_index));
 69
 70struct rw_semaphore {
 71	atomic_long_t owner;
 72} __attribute__((preserve_access_index));
 73
 74struct mutex {
 75	atomic_long_t owner;
 76} __attribute__((preserve_access_index));
 77
 78struct kernfs_node {
 79	u64 id;
 80} __attribute__((preserve_access_index));
 81
 82struct cgroup {
 83	struct kernfs_node *kn;
 84	int                level;
 85}  __attribute__((preserve_access_index));
 86
 87struct cgroup_subsys_state {
 88	struct cgroup *cgroup;
 89} __attribute__((preserve_access_index));
 90
 91struct css_set {
 92	struct cgroup_subsys_state *subsys[13];
 93	struct cgroup *dfl_cgrp;
 94} __attribute__((preserve_access_index));
 95
 96struct mm_struct {
 97	struct rw_semaphore mmap_lock;
 98} __attribute__((preserve_access_index));
 99
100struct task_struct {
101	unsigned int	      flags;
102	struct mm_struct      *mm;
103	pid_t		      pid;
104	pid_t		      tgid;
105	char		      comm[16];
106	struct sighand_struct *sighand;
107	struct css_set	      *cgroups;
108} __attribute__((preserve_access_index));
109
110struct trace_entry {
111	short unsigned int type;
112	unsigned char	   flags;
113	unsigned char	   preempt_count;
114	int		   pid;
115} __attribute__((preserve_access_index));
116
117struct trace_event_raw_irq_handler_entry {
118	struct trace_entry ent;
119	int		   irq;
120	u32		   __data_loc_name;
121	char		   __data[];
122} __attribute__((preserve_access_index));
123
124struct trace_event_raw_irq_handler_exit {
125	struct trace_entry ent;
126	int		   irq;
127	int		   ret;
128	char		   __data[];
129} __attribute__((preserve_access_index));
130
131struct trace_event_raw_softirq {
132	struct trace_entry ent;
133	unsigned int	   vec;
134	char		   __data[];
135} __attribute__((preserve_access_index));
136
137struct trace_event_raw_workqueue_execute_start {
138	struct trace_entry ent;
139	void		   *work;
140	void		   *function;
141	char		   __data[];
142} __attribute__((preserve_access_index));
143
144struct trace_event_raw_workqueue_execute_end {
145	struct trace_entry ent;
146	void		   *work;
147	void		   *function;
148	char		  __data[];
149} __attribute__((preserve_access_index));
150
151struct trace_event_raw_workqueue_activate_work {
152	struct trace_entry ent;
153	void		   *work;
154	char		   __data[];
155} __attribute__((preserve_access_index));
156
157struct perf_sample_data {
158	u64			 addr;
159	u64			 period;
160	union perf_sample_weight weight;
161	u64			 txn;
162	union perf_mem_data_src	 data_src;
163	u64			 ip;
164	struct {
165		u32		 pid;
166		u32		 tid;
167	} tid_entry;
168	u64			 time;
169	u64			 id;
170	struct {
171		u32		 cpu;
172	} cpu_entry;
173	u64			 phys_addr;
174	u64			 cgroup;
175	u64			 data_page_size;
176	u64			 code_page_size;
177} __attribute__((__aligned__(64))) __attribute__((preserve_access_index));
178
179struct perf_event {
180	struct perf_event	*parent;
181	u64			id;
182} __attribute__((preserve_access_index));
183
184struct bpf_perf_event_data_kern {
185	struct perf_sample_data *data;
186	struct perf_event	*event;
187} __attribute__((preserve_access_index));
188
189/*
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.
195 */
196struct rq {};
197
198struct kmem_cache {
199	const char *name;
200} __attribute__((preserve_access_index));
201
202struct bpf_iter__kmem_cache {
203	struct kmem_cache *s;
204} __attribute__((preserve_access_index));
205
206struct zone {
207	spinlock_t lock;
208} __attribute__((preserve_access_index));
209
210struct pglist_data {
211	struct zone node_zones[6]; /* value for all possible config */
212	int nr_zones;
213} __attribute__((preserve_access_index));
214
215#endif // __VMLINUX_H
~/ Read-only file preview.