1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM lttng_statedump
5 #if !defined(LTTNG_TRACE_LTTNG_STATEDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_LTTNG_STATEDUMP_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/nsproxy.h>
10 #include <linux/pid_namespace.h>
11 #include <linux/types.h>
12 #include <linux/version.h>
15 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
16 #define lttng_proc_inum ns.inum
18 #define lttng_proc_inum proc_inum
21 LTTNG_TRACEPOINT_EVENT(lttng_statedump_start
,
22 TP_PROTO(struct lttng_session
*session
),
27 LTTNG_TRACEPOINT_EVENT(lttng_statedump_end
,
28 TP_PROTO(struct lttng_session
*session
),
33 LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state
,
34 TP_PROTO(struct lttng_session
*session
,
35 struct task_struct
*p
,
36 int type
, int mode
, int submode
, int status
,
37 struct pid_namespace
*pid_ns
),
38 TP_ARGS(session
, p
, type
, mode
, submode
, status
, pid_ns
),
40 ctf_integer(pid_t
, tid
, p
->pid
)
41 ctf_integer(pid_t
, vtid
, pid_ns
? task_pid_nr_ns(p
, pid_ns
) : 0)
42 ctf_integer(pid_t
, pid
, p
->tgid
)
43 ctf_integer(pid_t
, vpid
, pid_ns
? task_tgid_nr_ns(p
, pid_ns
) : 0)
44 ctf_integer(pid_t
, ppid
,
49 ret
= task_tgid_nr(p
->real_parent
);
53 ctf_integer(pid_t
, vppid
,
55 struct task_struct
*parent
;
60 parent
= rcu_dereference(p
->real_parent
);
61 ret
= task_tgid_nr_ns(parent
, pid_ns
);
66 ctf_array_text(char, name
, p
->comm
, TASK_COMM_LEN
)
67 ctf_integer(int, type
, type
)
68 ctf_integer(int, mode
, mode
)
69 ctf_integer(int, submode
, submode
)
70 ctf_integer(int, status
, status
)
71 ctf_integer(int, ns_level
, pid_ns
? pid_ns
->level
: 0)
72 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
73 ctf_integer(unsigned int, ns_inum
, pid_ns
? pid_ns
->lttng_proc_inum
: 0)
75 ctf_integer(unsigned int, cpu
, task_cpu(p
))
79 LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor
,
80 TP_PROTO(struct lttng_session
*session
,
81 struct task_struct
*p
, int fd
, const char *filename
,
82 unsigned int flags
, fmode_t fmode
),
83 TP_ARGS(session
, p
, fd
, filename
, flags
, fmode
),
85 ctf_integer(pid_t
, pid
, p
->tgid
)
86 ctf_integer(int, fd
, fd
)
87 ctf_integer_oct(unsigned int, flags
, flags
)
88 ctf_integer_hex(fmode_t
, fmode
, fmode
)
89 ctf_string(filename
, filename
)
93 LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map
,
94 TP_PROTO(struct lttng_session
*session
,
95 struct task_struct
*p
, struct vm_area_struct
*map
,
97 TP_ARGS(session
, p
, map
, inode
),
99 ctf_integer(pid_t
, pid
, p
->tgid
)
100 ctf_integer_hex(unsigned long, start
, map
->vm_start
)
101 ctf_integer_hex(unsigned long, end
, map
->vm_end
)
102 ctf_integer_hex(unsigned long, flags
, map
->vm_flags
)
103 ctf_integer(unsigned long, inode
, inode
)
104 ctf_integer(unsigned long, pgoff
, map
->vm_pgoff
<< PAGE_SHIFT
)
108 LTTNG_TRACEPOINT_EVENT(lttng_statedump_network_interface
,
109 TP_PROTO(struct lttng_session
*session
,
110 struct net_device
*dev
, struct in_ifaddr
*ifa
),
111 TP_ARGS(session
, dev
, ifa
),
113 ctf_string(name
, dev
->name
)
114 ctf_integer_network_hex(uint32_t, address_ipv4
,
115 ifa
? ifa
->ifa_address
: 0U)
119 LTTNG_TRACEPOINT_EVENT(lttng_statedump_block_device
,
120 TP_PROTO(struct lttng_session
*session
,
121 dev_t dev
, const char *diskname
),
122 TP_ARGS(session
, dev
, diskname
),
124 ctf_integer(dev_t
, dev
, dev
)
125 ctf_string(diskname
, diskname
)
129 /* Called with desc->lock held */
130 LTTNG_TRACEPOINT_EVENT(lttng_statedump_interrupt
,
131 TP_PROTO(struct lttng_session
*session
,
132 unsigned int irq
, const char *chip_name
,
133 struct irqaction
*action
),
134 TP_ARGS(session
, irq
, chip_name
, action
),
136 ctf_integer(unsigned int, irq
, irq
)
137 ctf_string(name
, chip_name
)
138 ctf_string(action
, action
->name
? : "")
142 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64)
143 LTTNG_TRACEPOINT_EVENT(lttng_statedump_cpu_topology
,
144 TP_PROTO(struct lttng_session
*session
, struct cpuinfo_x86
*c
),
147 ctf_string(architecture
, "x86")
148 ctf_integer(uint16_t, cpu_id
, c
->cpu_index
)
149 ctf_string(vendor
, c
->x86_vendor_id
[0] ? c
->x86_vendor_id
: "unknown")
150 ctf_integer(uint8_t, family
, c
->x86
)
151 ctf_integer(uint8_t, model
, c
->x86_model
)
152 ctf_string(model_name
, c
->x86_model_id
[0] ? c
->x86_model_id
: "unknown")
153 ctf_integer(uint16_t, physical_id
, c
->phys_proc_id
)
154 ctf_integer(uint16_t, core_id
, c
->cpu_core_id
)
155 ctf_integer(uint16_t, cores
, c
->booted_cores
)
158 #endif /* CONFIG_X86_32 || CONFIG_X86_64 */
160 #endif /* LTTNG_TRACE_LTTNG_STATEDUMP_H */
162 /* This part must be outside protection */
163 #include <probes/define_trace.h>