Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b87700e3 | 2 | #undef TRACE_SYSTEM |
9bbf98da | 3 | #define TRACE_SYSTEM rpc |
b87700e3 | 4 | |
9bbf98da MD |
5 | #if !defined(LTTNG_TRACE_RPC_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_RPC_H | |
b87700e3 | 7 | |
3b4aafcb | 8 | #include <lttng/tracepoint-event.h> |
b87700e3 AG |
9 | #include <linux/sunrpc/sched.h> |
10 | #include <linux/sunrpc/clnt.h> | |
b87700e3 | 11 | |
b6903d57 MD |
12 | #ifndef ONCE_LTTNG_RPC_H |
13 | #define ONCE_LTTNG_RPC_H | |
14 | ||
5f4c791e | 15 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) |
b6903d57 MD |
16 | static inline |
17 | int lttng_get_clid(const struct rpc_task *task) | |
18 | { | |
19 | struct rpc_clnt *tk_client; | |
20 | ||
21 | tk_client = task->tk_client; | |
22 | if (!tk_client) | |
23 | return -1; | |
24 | /* | |
25 | * The cl_clid field is always initialized to positive signed | |
26 | * integers. Negative signed integer values are treated as | |
27 | * errors. | |
28 | */ | |
29 | return (int) tk_client->cl_clid; | |
30 | } | |
5f4c791e | 31 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) */ |
b6903d57 MD |
32 | |
33 | #endif /* ONCE_LTTNG_RPC_H */ | |
34 | ||
5f4c791e | 35 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,0,0)) |
28fef30f MJ |
36 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, |
37 | ||
38 | TP_PROTO(const struct rpc_task *task), | |
39 | ||
40 | TP_ARGS(task), | |
41 | ||
42 | TP_FIELDS( | |
43 | ctf_integer(unsigned int, task_id, task->tk_pid) | |
b6903d57 | 44 | ctf_integer(int, client_id, lttng_get_clid(task)) |
28fef30f MJ |
45 | ctf_integer(int, status, task->tk_status) |
46 | ) | |
47 | ) | |
48 | ||
49 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status, | |
50 | TP_PROTO(const struct rpc_task *task), | |
51 | ||
52 | TP_ARGS(task) | |
53 | ) | |
54 | ||
55 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status, | |
56 | TP_PROTO(const struct rpc_task *task), | |
57 | ||
58 | TP_ARGS(task) | |
59 | ) | |
5f4c791e | 60 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) |
b9dbdfe2 MJ |
61 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, |
62 | ||
63 | TP_PROTO(struct rpc_task *task), | |
64 | ||
65 | TP_ARGS(task), | |
66 | ||
67 | TP_FIELDS( | |
68 | ctf_integer(unsigned int, task_id, task->tk_pid) | |
b6903d57 | 69 | ctf_integer(int, client_id, lttng_get_clid(task)) |
b9dbdfe2 MJ |
70 | ctf_integer(int, status, task->tk_status) |
71 | ) | |
72 | ) | |
28fef30f MJ |
73 | |
74 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status, | |
75 | TP_PROTO(struct rpc_task *task), | |
76 | ||
77 | TP_ARGS(task) | |
78 | ) | |
79 | ||
80 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status, | |
81 | TP_PROTO(struct rpc_task *task), | |
82 | ||
83 | TP_ARGS(task) | |
84 | ) | |
b9dbdfe2 | 85 | #else |
3bc29f0a | 86 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status, |
b87700e3 AG |
87 | |
88 | TP_PROTO(struct rpc_task *task), | |
89 | ||
90 | TP_ARGS(task), | |
91 | ||
f127e61e | 92 | TP_FIELDS( |
fa91fcac MD |
93 | ctf_integer_hex(const struct rpc_task *, task, task) |
94 | ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client) | |
f127e61e MD |
95 | ctf_integer(int, status, task->tk_status) |
96 | ) | |
b87700e3 AG |
97 | ) |
98 | ||
3bc29f0a | 99 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status, |
b87700e3 AG |
100 | TP_PROTO(struct rpc_task *task), |
101 | ||
102 | TP_ARGS(task) | |
103 | ) | |
104 | ||
3bc29f0a | 105 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status, |
b87700e3 AG |
106 | TP_PROTO(struct rpc_task *task), |
107 | ||
108 | TP_ARGS(task) | |
109 | ) | |
28fef30f | 110 | #endif |
b87700e3 | 111 | |
5f4c791e | 112 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,0,0)) |
28fef30f MJ |
113 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_connect_status, |
114 | TP_PROTO(const struct rpc_task *task), | |
115 | ||
116 | TP_ARGS(task) | |
117 | ) | |
5f4c791e | 118 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,17,0)) |
0f891764 MJ |
119 | LTTNG_TRACEPOINT_EVENT(rpc_connect_status, |
120 | TP_PROTO(const struct rpc_task *task), | |
121 | ||
122 | TP_ARGS(task), | |
123 | ||
124 | TP_FIELDS( | |
b9dbdfe2 | 125 | ctf_integer(unsigned int, task_id, task->tk_pid) |
b6903d57 | 126 | ctf_integer(int, client_id, lttng_get_clid(task)) |
0f891764 MJ |
127 | ctf_integer(int, status, task->tk_status) |
128 | ) | |
129 | ) | |
5f4c791e | 130 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) |
28fef30f MJ |
131 | LTTNG_TRACEPOINT_EVENT(rpc_connect_status, |
132 | TP_PROTO(struct rpc_task *task, int status), | |
133 | ||
134 | TP_ARGS(task, status), | |
135 | ||
136 | TP_FIELDS( | |
137 | ctf_integer(unsigned int, task_id, task->tk_pid) | |
b6903d57 | 138 | ctf_integer(int, client_id, lttng_get_clid(task)) |
28fef30f MJ |
139 | ctf_integer(int, status, status) |
140 | ) | |
141 | ) | |
142 | #else | |
143 | LTTNG_TRACEPOINT_EVENT(rpc_connect_status, | |
144 | TP_PROTO(struct rpc_task *task, int status), | |
145 | ||
146 | TP_ARGS(task, status), | |
147 | ||
148 | TP_FIELDS( | |
149 | ctf_integer_hex(const struct rpc_task *, task, task) | |
150 | ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client) | |
151 | ctf_integer(int, status, status) | |
152 | ) | |
153 | ) | |
154 | #endif | |
0f891764 | 155 | |
5f4c791e | 156 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,17,0)) |
0f891764 MJ |
157 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, |
158 | ||
159 | TP_PROTO(const struct rpc_task *task, const void *action), | |
160 | ||
161 | TP_ARGS(task, action), | |
162 | ||
163 | TP_FIELDS( | |
b9dbdfe2 | 164 | ctf_integer(unsigned int, task_id, task->tk_pid) |
b6903d57 | 165 | ctf_integer(int, client_id, lttng_get_clid(task)) |
0f891764 MJ |
166 | ctf_integer_hex(const void *, action, action) |
167 | ctf_integer(unsigned long, runstate, task->tk_runstate) | |
168 | ctf_integer(int, status, task->tk_status) | |
169 | ctf_integer(unsigned short, flags, task->tk_flags) | |
170 | ) | |
171 | ) | |
172 | ||
173 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin, | |
174 | ||
175 | TP_PROTO(const struct rpc_task *task, const void *action), | |
176 | ||
177 | TP_ARGS(task, action) | |
178 | ) | |
179 | ||
180 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action, | |
181 | ||
182 | TP_PROTO(const struct rpc_task *task, const void *action), | |
183 | ||
184 | TP_ARGS(task, action) | |
185 | ) | |
186 | ||
187 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete, | |
188 | ||
189 | TP_PROTO(const struct rpc_task *task, const void *action), | |
190 | ||
191 | TP_ARGS(task, action) | |
192 | ) | |
193 | ||
194 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, | |
195 | ||
196 | TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), | |
197 | ||
198 | TP_ARGS(task, q), | |
199 | ||
200 | TP_FIELDS( | |
b9dbdfe2 | 201 | ctf_integer(unsigned int, task_id, task->tk_pid) |
b6903d57 | 202 | ctf_integer(int, client_id, lttng_get_clid(task)) |
0f891764 MJ |
203 | ctf_integer(unsigned long, timeout, task->tk_timeout) |
204 | ctf_integer(unsigned long, runstate, task->tk_runstate) | |
205 | ctf_integer(int, status, task->tk_status) | |
206 | ctf_integer(unsigned short, flags, task->tk_flags) | |
207 | ctf_string(q_name, rpc_qname(q)) | |
208 | ) | |
209 | ) | |
210 | ||
211 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep, | |
212 | ||
213 | TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), | |
214 | ||
215 | TP_ARGS(task, q) | |
216 | ) | |
217 | ||
218 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup, | |
219 | ||
220 | TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), | |
221 | ||
222 | TP_ARGS(task, q) | |
223 | ) | |
224 | ||
5f4c791e | 225 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) |
b9dbdfe2 MJ |
226 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, |
227 | ||
228 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
229 | ||
230 | TP_ARGS(clnt, task, action), | |
231 | ||
232 | TP_FIELDS( | |
233 | ctf_integer(unsigned int, task_id, task->tk_pid) | |
b6903d57 | 234 | ctf_integer(int, client_id, lttng_get_clid(task)) |
b9dbdfe2 MJ |
235 | ctf_integer_hex(const void *, action, action) |
236 | ctf_integer(unsigned long, runstate, task->tk_runstate) | |
237 | ctf_integer(int, status, task->tk_status) | |
238 | ctf_integer(unsigned short, flags, task->tk_flags) | |
239 | ) | |
240 | ) | |
241 | ||
242 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin, | |
243 | ||
244 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
245 | ||
246 | TP_ARGS(clnt, task, action) | |
247 | ) | |
248 | ||
249 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action, | |
250 | ||
251 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
252 | ||
253 | TP_ARGS(clnt, task, action) | |
254 | ) | |
255 | ||
256 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete, | |
257 | ||
258 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
259 | ||
260 | TP_ARGS(clnt, task, action) | |
261 | ) | |
262 | ||
263 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, | |
264 | ||
265 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
266 | ||
267 | TP_ARGS(clnt, task, q), | |
268 | ||
269 | TP_FIELDS( | |
270 | ctf_integer(unsigned int, task_id, task->tk_pid) | |
b6903d57 | 271 | ctf_integer(int, client_id, lttng_get_clid(task)) |
b9dbdfe2 MJ |
272 | ctf_integer(unsigned long, timeout, task->tk_timeout) |
273 | ctf_integer(unsigned long, runstate, task->tk_runstate) | |
274 | ctf_integer(int, status, task->tk_status) | |
275 | ctf_integer(unsigned short, flags, task->tk_flags) | |
276 | ctf_string(q_name, rpc_qname(q)) | |
277 | ) | |
278 | ) | |
279 | ||
280 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep, | |
281 | ||
282 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
283 | ||
284 | TP_ARGS(clnt, task, q) | |
285 | ) | |
286 | ||
287 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup, | |
288 | ||
289 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
290 | ||
291 | TP_ARGS(clnt, task, q) | |
292 | ) | |
293 | ||
0f891764 | 294 | #else |
3bc29f0a | 295 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running, |
b87700e3 AG |
296 | |
297 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
298 | ||
299 | TP_ARGS(clnt, task, action), | |
300 | ||
f127e61e | 301 | TP_FIELDS( |
fa91fcac MD |
302 | ctf_integer_hex(const struct rpc_clnt *, clnt, clnt) |
303 | ctf_integer_hex(const struct rpc_task *, task, task) | |
304 | ctf_integer_hex(const void *, action, action) | |
f127e61e MD |
305 | ctf_integer(unsigned long, runstate, task->tk_runstate) |
306 | ctf_integer(int, status, task->tk_status) | |
307 | ctf_integer(unsigned short, flags, task->tk_flags) | |
308 | ) | |
b87700e3 AG |
309 | ) |
310 | ||
3bc29f0a | 311 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin, |
b87700e3 AG |
312 | |
313 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
314 | ||
315 | TP_ARGS(clnt, task, action) | |
b87700e3 AG |
316 | ) |
317 | ||
3bc29f0a | 318 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action, |
b87700e3 AG |
319 | |
320 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
321 | ||
322 | TP_ARGS(clnt, task, action) | |
b87700e3 AG |
323 | ) |
324 | ||
3bc29f0a | 325 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete, |
b87700e3 AG |
326 | |
327 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), | |
328 | ||
329 | TP_ARGS(clnt, task, action) | |
b87700e3 AG |
330 | ) |
331 | ||
3bc29f0a | 332 | LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued, |
b87700e3 AG |
333 | |
334 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
335 | ||
336 | TP_ARGS(clnt, task, q), | |
337 | ||
f127e61e | 338 | TP_FIELDS( |
fa91fcac MD |
339 | ctf_integer_hex(const struct rpc_clnt *, clnt, clnt) |
340 | ctf_integer_hex(const struct rpc_task *, task, task) | |
f127e61e MD |
341 | ctf_integer(unsigned long, timeout, task->tk_timeout) |
342 | ctf_integer(unsigned long, runstate, task->tk_runstate) | |
343 | ctf_integer(int, status, task->tk_status) | |
344 | ctf_integer(unsigned short, flags, task->tk_flags) | |
345 | ctf_string(q_name, rpc_qname(q)) | |
346 | ) | |
b87700e3 AG |
347 | ) |
348 | ||
3bc29f0a | 349 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep, |
b87700e3 AG |
350 | |
351 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
352 | ||
353 | TP_ARGS(clnt, task, q) | |
b87700e3 AG |
354 | ) |
355 | ||
3bc29f0a | 356 | LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup, |
b87700e3 AG |
357 | |
358 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), | |
359 | ||
360 | TP_ARGS(clnt, task, q) | |
b87700e3 | 361 | ) |
0f891764 | 362 | #endif |
b87700e3 | 363 | |
9bbf98da | 364 | #endif /* LTTNG_TRACE_RPC_H */ |
b87700e3 | 365 | |
3b4aafcb | 366 | #include <lttng/define_trace.h> |