aarch64: blacklist gcc prior to 5.1
[lttng-modules.git] / include / instrumentation / events / lttng-statedump.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: GPL-2.0-only */
c337ddc2
MD
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM lttng_statedump
4
3bc29f0a
MD
5#if !defined(LTTNG_TRACE_LTTNG_STATEDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
6#define LTTNG_TRACE_LTTNG_STATEDUMP_H
c337ddc2 7
3b4aafcb 8#include <lttng/tracepoint-event.h>
90fffd13 9#include <linux/nsproxy.h>
1965e6b4
MJ
10#include <linux/cgroup.h>
11#include <linux/ipc_namespace.h>
12#include <net/net_namespace.h>
73e8ba37 13#include <linux/pid_namespace.h>
1965e6b4
MJ
14#include <linux/user_namespace.h>
15#include <linux/utsname.h>
f0dbdefb 16#include <linux/types.h>
7bbf55ea 17#include <linux/version.h>
1965e6b4
MJ
18#include <wrapper/namespace.h>
19#include <wrapper/user_namespace.h>
876e2e92
MJ
20#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
21#include <linux/time_namespace.h>
22#endif
7bbf55ea 23
1965e6b4
MJ
24#ifndef LTTNG_MNT_NS_MISSING_HEADER
25# ifndef ONCE_LTTNG_FS_MOUNT_H
26# define ONCE_LTTNG_FS_MOUNT_H
27# include <../fs/mount.h>
28# endif
7bbf55ea 29#endif
c337ddc2 30
3bc29f0a 31LTTNG_TRACEPOINT_EVENT(lttng_statedump_start,
c337ddc2
MD
32 TP_PROTO(struct lttng_session *session),
33 TP_ARGS(session),
f127e61e 34 TP_FIELDS()
c337ddc2
MD
35)
36
3bc29f0a 37LTTNG_TRACEPOINT_EVENT(lttng_statedump_end,
c337ddc2
MD
38 TP_PROTO(struct lttng_session *session),
39 TP_ARGS(session),
f127e61e 40 TP_FIELDS()
c337ddc2
MD
41)
42
3bc29f0a 43LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state,
c337ddc2
MD
44 TP_PROTO(struct lttng_session *session,
45 struct task_struct *p,
e7a0ca72
MD
46 int type, int mode, int submode, int status,
47 struct files_struct *files),
48 TP_ARGS(session, p, type, mode, submode, status, files),
f127e61e
MD
49 TP_FIELDS(
50 ctf_integer(pid_t, tid, p->pid)
f127e61e 51 ctf_integer(pid_t, pid, p->tgid)
f127e61e 52 ctf_integer(pid_t, ppid,
c337ddc2
MD
53 ({
54 pid_t ret;
55
56 rcu_read_lock();
57 ret = task_tgid_nr(p->real_parent);
58 rcu_read_unlock();
59 ret;
60 }))
f127e61e
MD
61 ctf_array_text(char, name, p->comm, TASK_COMM_LEN)
62 ctf_integer(int, type, type)
63 ctf_integer(int, mode, mode)
64 ctf_integer(int, submode, submode)
65 ctf_integer(int, status, status)
7a479375 66 ctf_integer(unsigned int, cpu, task_cpu(p))
e7a0ca72 67 ctf_integer_hex(struct files_struct *, file_table_address, files)
f127e61e 68 )
c337ddc2
MD
69)
70
1965e6b4
MJ
71#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
72LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_cgroup_ns,
73 TP_PROTO(struct lttng_session *session,
74 struct task_struct *p,
75 struct cgroup_namespace *cgroup_ns),
76 TP_ARGS(session, p, cgroup_ns),
77 TP_FIELDS(
78 ctf_integer(pid_t, tid, p->pid)
79 ctf_integer(unsigned int, ns_inum, cgroup_ns ? cgroup_ns->lttng_ns_inum : 0)
80 )
81)
82#endif
83
84LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_ipc_ns,
85 TP_PROTO(struct lttng_session *session,
86 struct task_struct *p,
87 struct ipc_namespace *ipc_ns),
88 TP_ARGS(session, p, ipc_ns),
89 TP_FIELDS(
90 ctf_integer(pid_t, tid, p->pid)
91#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
92 ctf_integer(unsigned int, ns_inum, ipc_ns ? ipc_ns->lttng_ns_inum : 0)
93#endif
94 )
95)
96
97#if !defined(LTTNG_MNT_NS_MISSING_HEADER)
98LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_mnt_ns,
99 TP_PROTO(struct lttng_session *session,
100 struct task_struct *p,
101 struct mnt_namespace *mnt_ns),
102 TP_ARGS(session, p, mnt_ns),
103 TP_FIELDS(
104 ctf_integer(pid_t, tid, p->pid)
105#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
106 ctf_integer(unsigned int, ns_inum, mnt_ns ? mnt_ns->lttng_ns_inum : 0)
107#endif
108 )
109)
110#endif
111
112LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_net_ns,
113 TP_PROTO(struct lttng_session *session,
114 struct task_struct *p,
115 struct net *net_ns),
116 TP_ARGS(session, p, net_ns),
117 TP_FIELDS(
118 ctf_integer(pid_t, tid, p->pid)
119#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
120 ctf_integer(unsigned int, ns_inum, net_ns ? net_ns->lttng_ns_inum : 0)
121#endif
122 )
123)
124
125LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_pid_ns,
126 TP_PROTO(struct lttng_session *session,
127 struct task_struct *p,
128 struct pid_namespace *pid_ns),
129 TP_ARGS(session, p, pid_ns),
130 TP_FIELDS(
131 ctf_integer(pid_t, tid, p->pid)
132 ctf_integer(pid_t, vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0)
133 ctf_integer(pid_t, vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0)
134 ctf_integer(pid_t, vppid,
135 ({
136 struct task_struct *parent;
137 pid_t ret = 0;
138
139 if (pid_ns) {
140 rcu_read_lock();
141 parent = rcu_dereference(p->real_parent);
142 ret = task_tgid_nr_ns(parent, pid_ns);
143 rcu_read_unlock();
144 }
145 ret;
146 }))
147 ctf_integer(int, ns_level, pid_ns ? pid_ns->level : 0)
148#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
149 ctf_integer(unsigned int, ns_inum, pid_ns ? pid_ns->lttng_ns_inum : 0)
150#endif
151 )
152)
153
154LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_user_ns,
155 TP_PROTO(struct lttng_session *session,
156 struct task_struct *p,
157 struct user_namespace *user_ns),
158 TP_ARGS(session, p, user_ns),
159 TP_FIELDS(
160 ctf_integer(pid_t, tid, p->pid)
161 ctf_integer(uid_t, vuid, user_ns ? lttng_task_vuid(p, user_ns) : 0)
162 ctf_integer(gid_t, vgid, user_ns ? lttng_task_vgid(p, user_ns) : 0)
163#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
164 ctf_integer(int, ns_level, user_ns ? user_ns->level : 0)
165#endif
166#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
167 ctf_integer(unsigned int, ns_inum, user_ns ? user_ns->lttng_ns_inum : 0)
168#endif
169 )
170)
171
172LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_uts_ns,
173 TP_PROTO(struct lttng_session *session,
174 struct task_struct *p,
175 struct uts_namespace *uts_ns),
176 TP_ARGS(session, p, uts_ns),
177 TP_FIELDS(
178 ctf_integer(pid_t, tid, p->pid)
179#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
180 ctf_integer(unsigned int, ns_inum, uts_ns ? uts_ns->lttng_ns_inum : 0)
181#endif
182 )
183)
184
876e2e92
MJ
185#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
186LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_time_ns,
187 TP_PROTO(struct lttng_session *session,
188 struct task_struct *p,
189 struct time_namespace *time_ns),
190 TP_ARGS(session, p, time_ns),
191 TP_FIELDS(
192 ctf_integer(pid_t, tid, p->pid)
193 ctf_integer(unsigned int, ns_inum, time_ns ? time_ns->lttng_ns_inum : 0)
194 )
195)
196#endif
197
3bc29f0a 198LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor,
c337ddc2 199 TP_PROTO(struct lttng_session *session,
e7a0ca72
MD
200 struct files_struct *files,
201 int fd, const char *filename,
29021503 202 unsigned int flags, fmode_t fmode),
e7a0ca72 203 TP_ARGS(session, files, fd, filename, flags, fmode),
f127e61e 204 TP_FIELDS(
e7a0ca72 205 ctf_integer_hex(struct files_struct *, file_table_address, files)
f127e61e
MD
206 ctf_integer(int, fd, fd)
207 ctf_integer_oct(unsigned int, flags, flags)
208 ctf_integer_hex(fmode_t, fmode, fmode)
209 ctf_string(filename, filename)
210 )
c337ddc2
MD
211)
212
3bc29f0a 213LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map,
c337ddc2
MD
214 TP_PROTO(struct lttng_session *session,
215 struct task_struct *p, struct vm_area_struct *map,
216 unsigned long inode),
217 TP_ARGS(session, p, map, inode),
f127e61e
MD
218 TP_FIELDS(
219 ctf_integer(pid_t, pid, p->tgid)
220 ctf_integer_hex(unsigned long, start, map->vm_start)
221 ctf_integer_hex(unsigned long, end, map->vm_end)
222 ctf_integer_hex(unsigned long, flags, map->vm_flags)
223 ctf_integer(unsigned long, inode, inode)
224 ctf_integer(unsigned long, pgoff, map->vm_pgoff << PAGE_SHIFT)
225 )
c337ddc2
MD
226)
227
3bc29f0a 228LTTNG_TRACEPOINT_EVENT(lttng_statedump_network_interface,
c337ddc2
MD
229 TP_PROTO(struct lttng_session *session,
230 struct net_device *dev, struct in_ifaddr *ifa),
231 TP_ARGS(session, dev, ifa),
f127e61e
MD
232 TP_FIELDS(
233 ctf_string(name, dev->name)
234 ctf_integer_network_hex(uint32_t, address_ipv4,
235 ifa ? ifa->ifa_address : 0U)
236 )
c337ddc2
MD
237)
238
3bc29f0a 239LTTNG_TRACEPOINT_EVENT(lttng_statedump_block_device,
f0dbdefb
HD
240 TP_PROTO(struct lttng_session *session,
241 dev_t dev, const char *diskname),
242 TP_ARGS(session, dev, diskname),
f127e61e
MD
243 TP_FIELDS(
244 ctf_integer(dev_t, dev, dev)
245 ctf_string(diskname, diskname)
246 )
f0dbdefb
HD
247)
248
c337ddc2 249/* Called with desc->lock held */
3bc29f0a 250LTTNG_TRACEPOINT_EVENT(lttng_statedump_interrupt,
c337ddc2
MD
251 TP_PROTO(struct lttng_session *session,
252 unsigned int irq, const char *chip_name,
253 struct irqaction *action),
254 TP_ARGS(session, irq, chip_name, action),
f127e61e
MD
255 TP_FIELDS(
256 ctf_integer(unsigned int, irq, irq)
257 ctf_string(name, chip_name)
258 ctf_string(action, action->name ? : "")
afded8f5 259 ctf_integer(pid_t, tid, action->thread ? action->thread->pid : 0)
f127e61e 260 )
c337ddc2
MD
261)
262
502e4132 263#if defined(CONFIG_X86_32) || defined(CONFIG_X86_64)
d0b55e4c
MD
264
265#define LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
266
502e4132
JD
267LTTNG_TRACEPOINT_EVENT(lttng_statedump_cpu_topology,
268 TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c),
269 TP_ARGS(session, c),
270 TP_FIELDS(
271 ctf_string(architecture, "x86")
272 ctf_integer(uint16_t, cpu_id, c->cpu_index)
273 ctf_string(vendor, c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown")
274 ctf_integer(uint8_t, family, c->x86)
275 ctf_integer(uint8_t, model, c->x86_model)
276 ctf_string(model_name, c->x86_model_id[0] ? c->x86_model_id : "unknown")
277 ctf_integer(uint16_t, physical_id, c->phys_proc_id)
278 ctf_integer(uint16_t, core_id, c->cpu_core_id)
279 ctf_integer(uint16_t, cores, c->booted_cores)
280 )
281)
282#endif /* CONFIG_X86_32 || CONFIG_X86_64 */
283
3bc29f0a 284#endif /* LTTNG_TRACE_LTTNG_STATEDUMP_H */
c337ddc2
MD
285
286/* This part must be outside protection */
3b4aafcb 287#include <lttng/define_trace.h>
This page took 0.056403 seconds and 4 git commands to generate.