Commit | Line | Data |
---|---|---|
9f36eaed | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
b87700e3 AG |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM workqueue | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_WORKQUEUE_H | |
b87700e3 | 7 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
b87700e3 | 9 | #include <linux/workqueue.h> |
b78104db | 10 | #include <lttng-kernel-version.h> |
b87700e3 | 11 | |
b78104db | 12 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,36)) |
b87700e3 AG |
13 | |
14 | #ifndef _TRACE_WORKQUEUE_DEF_ | |
15 | #define _TRACE_WORKQUEUE_DEF_ | |
16 | ||
17 | struct worker; | |
18 | struct global_cwq; | |
19 | ||
b87700e3 AG |
20 | #endif |
21 | ||
3bc29f0a | 22 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, |
b87700e3 AG |
23 | |
24 | TP_PROTO(struct work_struct *work), | |
25 | ||
26 | TP_ARGS(work), | |
27 | ||
f127e61e | 28 | TP_FIELDS( |
fa91fcac | 29 | ctf_integer_hex(void *, work, work) |
f127e61e | 30 | ) |
b87700e3 AG |
31 | ) |
32 | ||
b78104db | 33 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,37)) |
b87700e3 AG |
34 | /** |
35 | * workqueue_queue_work - called when a work gets queued | |
36 | * @req_cpu: the requested cpu | |
37 | * @cwq: pointer to struct cpu_workqueue_struct | |
38 | * @work: pointer to struct work_struct | |
39 | * | |
40 | * This event occurs when a work is queued immediately or once a | |
41 | * delayed work is actually queued on a workqueue (ie: once the delay | |
42 | * has been reached). | |
43 | */ | |
3bc29f0a | 44 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
b87700e3 | 45 | |
b78104db | 46 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
20008d8c MD |
47 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, |
48 | struct work_struct *work), | |
49 | ||
50 | TP_ARGS(req_cpu, pwq, work), | |
51 | #else | |
b87700e3 AG |
52 | TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq, |
53 | struct work_struct *work), | |
54 | ||
55 | TP_ARGS(req_cpu, cwq, work), | |
20008d8c | 56 | #endif |
b87700e3 | 57 | |
f127e61e | 58 | TP_FIELDS( |
fa91fcac MD |
59 | ctf_integer_hex(void *, work, work) |
60 | ctf_integer_hex(void *, function, work->func) | |
f127e61e MD |
61 | ctf_integer(unsigned int, req_cpu, req_cpu) |
62 | ) | |
b87700e3 AG |
63 | ) |
64 | ||
65 | /** | |
66 | * workqueue_activate_work - called when a work gets activated | |
67 | * @work: pointer to struct work_struct | |
68 | * | |
69 | * This event occurs when a queued work is put on the active queue, | |
70 | * which happens immediately after queueing unless @max_active limit | |
71 | * is reached. | |
72 | */ | |
3bc29f0a | 73 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
b87700e3 AG |
74 | |
75 | TP_PROTO(struct work_struct *work), | |
76 | ||
77 | TP_ARGS(work) | |
78 | ) | |
79 | #endif | |
80 | ||
81 | /** | |
82 | * workqueue_execute_start - called immediately before the workqueue callback | |
83 | * @work: pointer to struct work_struct | |
84 | * | |
85 | * Allows to track workqueue execution. | |
86 | */ | |
3bc29f0a | 87 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
b87700e3 AG |
88 | |
89 | TP_PROTO(struct work_struct *work), | |
90 | ||
91 | TP_ARGS(work), | |
92 | ||
f127e61e | 93 | TP_FIELDS( |
fa91fcac MD |
94 | ctf_integer_hex(void *, work, work) |
95 | ctf_integer_hex(void *, function, work->func) | |
f127e61e | 96 | ) |
b87700e3 AG |
97 | ) |
98 | ||
b78104db | 99 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
a4550c96 MJ |
100 | /** |
101 | * workqueue_execute_end - called immediately after the workqueue callback | |
102 | * @work: pointer to struct work_struct | |
103 | * @function: pointer to worker function | |
104 | * | |
105 | * Allows to track workqueue execution. | |
106 | */ | |
107 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, | |
108 | ||
109 | TP_PROTO(struct work_struct *work, work_func_t function), | |
110 | ||
111 | TP_ARGS(work, function), | |
112 | ||
113 | TP_FIELDS( | |
114 | ctf_integer_hex(void *, work, work) | |
115 | ctf_integer_hex(void *, function, function) | |
116 | ) | |
117 | ) | |
118 | #else | |
b87700e3 AG |
119 | /** |
120 | * workqueue_execute_end - called immediately after the workqueue callback | |
121 | * @work: pointer to struct work_struct | |
122 | * | |
123 | * Allows to track workqueue execution. | |
124 | */ | |
3bc29f0a | 125 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, |
b87700e3 AG |
126 | |
127 | TP_PROTO(struct work_struct *work), | |
128 | ||
129 | TP_ARGS(work) | |
130 | ) | |
a4550c96 | 131 | #endif |
b87700e3 AG |
132 | |
133 | #else | |
134 | ||
3bc29f0a | 135 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue, |
b87700e3 AG |
136 | |
137 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
138 | ||
139 | TP_ARGS(wq_thread, work), | |
140 | ||
f127e61e MD |
141 | TP_FIELDS( |
142 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
143 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
fa91fcac | 144 | ctf_integer_hex(work_func_t, func, work->func) |
f127e61e | 145 | ) |
b87700e3 AG |
146 | ) |
147 | ||
3bc29f0a | 148 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_insertion, |
b87700e3 AG |
149 | |
150 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
151 | ||
152 | TP_ARGS(wq_thread, work) | |
153 | ) | |
154 | ||
3bc29f0a | 155 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_execution, |
b87700e3 AG |
156 | |
157 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
158 | ||
159 | TP_ARGS(wq_thread, work) | |
160 | ) | |
161 | ||
162 | /* Trace the creation of one workqueue thread on a cpu */ | |
3bc29f0a | 163 | LTTNG_TRACEPOINT_EVENT(workqueue_creation, |
b87700e3 AG |
164 | |
165 | TP_PROTO(struct task_struct *wq_thread, int cpu), | |
166 | ||
167 | TP_ARGS(wq_thread, cpu), | |
168 | ||
f127e61e MD |
169 | TP_FIELDS( |
170 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
171 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
172 | ctf_integer(int, cpu, cpu) | |
173 | ) | |
b87700e3 AG |
174 | ) |
175 | ||
3bc29f0a | 176 | LTTNG_TRACEPOINT_EVENT(workqueue_destruction, |
b87700e3 AG |
177 | |
178 | TP_PROTO(struct task_struct *wq_thread), | |
179 | ||
180 | TP_ARGS(wq_thread), | |
181 | ||
f127e61e MD |
182 | TP_FIELDS( |
183 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
184 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
185 | ) | |
b87700e3 AG |
186 | ) |
187 | ||
188 | #endif | |
189 | ||
3bc29f0a | 190 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
b87700e3 AG |
191 | |
192 | /* This part must be outside protection */ | |
6ec43db8 | 193 | #include <probes/define_trace.h> |