Fix: SUNRPC: Fix oops when trace sunrpc_task events in nfs client
[lttng-modules.git] / instrumentation / events / lttng-module / rpc.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM rpc
4
5 #if !defined(LTTNG_TRACE_RPC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_RPC_H
7
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/sunrpc/sched.h>
10 #include <linux/sunrpc/clnt.h>
11
12 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
13 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
14
15 TP_PROTO(const struct rpc_task *task),
16
17 TP_ARGS(task),
18
19 TP_FIELDS(
20 ctf_integer(unsigned int, task_id, task->tk_pid)
21 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
22 ctf_integer(int, status, task->tk_status)
23 )
24 )
25
26 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
27 TP_PROTO(const struct rpc_task *task),
28
29 TP_ARGS(task)
30 )
31
32 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
33 TP_PROTO(const struct rpc_task *task),
34
35 TP_ARGS(task)
36 )
37 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
38 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
39
40 TP_PROTO(struct rpc_task *task),
41
42 TP_ARGS(task),
43
44 TP_FIELDS(
45 ctf_integer(unsigned int, task_id, task->tk_pid)
46 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
47 ctf_integer(int, status, task->tk_status)
48 )
49 )
50
51 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
52 TP_PROTO(struct rpc_task *task),
53
54 TP_ARGS(task)
55 )
56
57 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
58 TP_PROTO(struct rpc_task *task),
59
60 TP_ARGS(task)
61 )
62 #else
63 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
64
65 TP_PROTO(struct rpc_task *task),
66
67 TP_ARGS(task),
68
69 TP_FIELDS(
70 ctf_integer_hex(const struct rpc_task *, task, task)
71 ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client)
72 ctf_integer(int, status, task->tk_status)
73 )
74 )
75
76 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
77 TP_PROTO(struct rpc_task *task),
78
79 TP_ARGS(task)
80 )
81
82 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
83 TP_PROTO(struct rpc_task *task),
84
85 TP_ARGS(task)
86 )
87 #endif
88
89 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
90 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_connect_status,
91 TP_PROTO(const struct rpc_task *task),
92
93 TP_ARGS(task)
94 )
95 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0))
96 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
97 TP_PROTO(const struct rpc_task *task),
98
99 TP_ARGS(task),
100
101 TP_FIELDS(
102 ctf_integer(unsigned int, task_id, task->tk_pid)
103 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
104 ctf_integer(int, status, task->tk_status)
105 )
106 )
107 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
108 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
109 TP_PROTO(struct rpc_task *task, int status),
110
111 TP_ARGS(task, status),
112
113 TP_FIELDS(
114 ctf_integer(unsigned int, task_id, task->tk_pid)
115 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
116 ctf_integer(int, status, status)
117 )
118 )
119 #else
120 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
121 TP_PROTO(struct rpc_task *task, int status),
122
123 TP_ARGS(task, status),
124
125 TP_FIELDS(
126 ctf_integer_hex(const struct rpc_task *, task, task)
127 ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client)
128 ctf_integer(int, status, status)
129 )
130 )
131 #endif
132
133 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0))
134 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
135
136 TP_PROTO(const struct rpc_task *task, const void *action),
137
138 TP_ARGS(task, action),
139
140 TP_FIELDS(
141 ctf_integer(unsigned int, task_id, task->tk_pid)
142 ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1)
143 ctf_integer_hex(const void *, action, action)
144 ctf_integer(unsigned long, runstate, task->tk_runstate)
145 ctf_integer(int, status, task->tk_status)
146 ctf_integer(unsigned short, flags, task->tk_flags)
147 )
148 )
149
150 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
151
152 TP_PROTO(const struct rpc_task *task, const void *action),
153
154 TP_ARGS(task, action)
155 )
156
157 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
158
159 TP_PROTO(const struct rpc_task *task, const void *action),
160
161 TP_ARGS(task, action)
162 )
163
164 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
165
166 TP_PROTO(const struct rpc_task *task, const void *action),
167
168 TP_ARGS(task, action)
169 )
170
171 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
172
173 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
174
175 TP_ARGS(task, q),
176
177 TP_FIELDS(
178 ctf_integer(unsigned int, task_id, task->tk_pid)
179 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
180 ctf_integer(unsigned long, timeout, task->tk_timeout)
181 ctf_integer(unsigned long, runstate, task->tk_runstate)
182 ctf_integer(int, status, task->tk_status)
183 ctf_integer(unsigned short, flags, task->tk_flags)
184 ctf_string(q_name, rpc_qname(q))
185 )
186 )
187
188 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
189
190 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
191
192 TP_ARGS(task, q)
193 )
194
195 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
196
197 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
198
199 TP_ARGS(task, q)
200 )
201
202 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
203 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
204
205 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
206
207 TP_ARGS(clnt, task, action),
208
209 TP_FIELDS(
210 ctf_integer(unsigned int, task_id, task->tk_pid)
211 ctf_integer(unsigned int, client_id, task->tk_client ? task->tk_client->cl_clid : -1)
212 ctf_integer_hex(const void *, action, action)
213 ctf_integer(unsigned long, runstate, task->tk_runstate)
214 ctf_integer(int, status, task->tk_status)
215 ctf_integer(unsigned short, flags, task->tk_flags)
216 )
217 )
218
219 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
220
221 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
222
223 TP_ARGS(clnt, task, action)
224 )
225
226 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
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
233 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
234
235 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
236
237 TP_ARGS(clnt, task, action)
238 )
239
240 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
241
242 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
243
244 TP_ARGS(clnt, task, q),
245
246 TP_FIELDS(
247 ctf_integer(unsigned int, task_id, task->tk_pid)
248 ctf_integer(unsigned int, client_id, task->tk_client->cl_clid)
249 ctf_integer(unsigned long, timeout, task->tk_timeout)
250 ctf_integer(unsigned long, runstate, task->tk_runstate)
251 ctf_integer(int, status, task->tk_status)
252 ctf_integer(unsigned short, flags, task->tk_flags)
253 ctf_string(q_name, rpc_qname(q))
254 )
255 )
256
257 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
258
259 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
260
261 TP_ARGS(clnt, task, q)
262 )
263
264 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
265
266 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
267
268 TP_ARGS(clnt, task, q)
269 )
270
271 #else
272 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
273
274 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
275
276 TP_ARGS(clnt, task, action),
277
278 TP_FIELDS(
279 ctf_integer_hex(const struct rpc_clnt *, clnt, clnt)
280 ctf_integer_hex(const struct rpc_task *, task, task)
281 ctf_integer_hex(const void *, action, action)
282 ctf_integer(unsigned long, runstate, task->tk_runstate)
283 ctf_integer(int, status, task->tk_status)
284 ctf_integer(unsigned short, flags, task->tk_flags)
285 )
286 )
287
288 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
289
290 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
291
292 TP_ARGS(clnt, task, action)
293 )
294
295 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
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 )
301
302 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
303
304 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
305
306 TP_ARGS(clnt, task, action)
307 )
308
309 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
310
311 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
312
313 TP_ARGS(clnt, task, q),
314
315 TP_FIELDS(
316 ctf_integer_hex(const struct rpc_clnt *, clnt, clnt)
317 ctf_integer_hex(const struct rpc_task *, task, task)
318 ctf_integer(unsigned long, timeout, task->tk_timeout)
319 ctf_integer(unsigned long, runstate, task->tk_runstate)
320 ctf_integer(int, status, task->tk_status)
321 ctf_integer(unsigned short, flags, task->tk_flags)
322 ctf_string(q_name, rpc_qname(q))
323 )
324 )
325
326 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
327
328 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
329
330 TP_ARGS(clnt, task, q)
331 )
332
333 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
334
335 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
336
337 TP_ARGS(clnt, task, q)
338 )
339 #endif
340
341 #endif /* LTTNG_TRACE_RPC_H */
342
343 #include <probes/define_trace.h>
This page took 0.036944 seconds and 4 git commands to generate.