blob: 2b3f9d139e7553c9cb38fa66c3298680cd37b15d [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebust82b0a4c2012-01-20 14:52:23 -05002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM sunrpc
4
5#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_SUNRPC_H
7
8#include <linux/sunrpc/sched.h>
9#include <linux/sunrpc/clnt.h>
Jeff Layton860a0d92014-10-28 14:24:12 -040010#include <linux/sunrpc/svc.h>
Jeff Layton1a867a02014-10-28 14:24:14 -040011#include <linux/sunrpc/xprtsock.h>
Jeff Layton83a712e2014-11-21 14:19:31 -050012#include <linux/sunrpc/svc_xprt.h>
Trond Myklebust40b5ea02013-09-04 12:16:23 -040013#include <net/tcp_states.h>
14#include <linux/net.h>
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050015#include <linux/tracepoint.h>
16
Steve Dickson5753cba2012-02-06 10:08:08 -050017DECLARE_EVENT_CLASS(rpc_task_status,
18
Chuck Levere671edb2018-03-16 10:33:44 -040019 TP_PROTO(const struct rpc_task *task),
Steve Dickson5753cba2012-02-06 10:08:08 -050020
Chuck Levere671edb2018-03-16 10:33:44 -040021 TP_ARGS(task),
Steve Dickson5753cba2012-02-06 10:08:08 -050022
23 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040024 __field(unsigned int, task_id)
25 __field(unsigned int, client_id)
Steve Dickson5753cba2012-02-06 10:08:08 -050026 __field(int, status)
27 ),
28
29 TP_fast_assign(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040030 __entry->task_id = task->tk_pid;
31 __entry->client_id = task->tk_client->cl_clid;
Chuck Levere671edb2018-03-16 10:33:44 -040032 __entry->status = task->tk_status;
Steve Dickson5753cba2012-02-06 10:08:08 -050033 ),
34
Chuck Lever52069442018-01-03 15:38:33 -050035 TP_printk("task:%u@%u status=%d",
Trond Myklebust92cb6c52013-09-04 22:09:50 -040036 __entry->task_id, __entry->client_id,
37 __entry->status)
Steve Dickson5753cba2012-02-06 10:08:08 -050038);
Chuck Leverdc5820b2018-12-19 11:00:16 -050039#define DEFINE_RPC_STATUS_EVENT(name) \
40 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
41 TP_PROTO( \
42 const struct rpc_task *task \
43 ), \
44 TP_ARGS(task))
45
46DEFINE_RPC_STATUS_EVENT(call);
47DEFINE_RPC_STATUS_EVENT(bind);
48DEFINE_RPC_STATUS_EVENT(connect);
Steve Dickson5753cba2012-02-06 10:08:08 -050049
Chuck Leverc435da62017-11-03 13:46:14 -040050TRACE_EVENT(rpc_request,
51 TP_PROTO(const struct rpc_task *task),
52
53 TP_ARGS(task),
54
55 TP_STRUCT__entry(
56 __field(unsigned int, task_id)
57 __field(unsigned int, client_id)
58 __field(int, version)
59 __field(bool, async)
60 __string(progname, task->tk_client->cl_program->name)
61 __string(procname, rpc_proc_name(task))
62 ),
63
64 TP_fast_assign(
65 __entry->task_id = task->tk_pid;
66 __entry->client_id = task->tk_client->cl_clid;
67 __entry->version = task->tk_client->cl_vers;
68 __entry->async = RPC_IS_ASYNC(task);
69 __assign_str(progname, task->tk_client->cl_program->name)
70 __assign_str(procname, rpc_proc_name(task))
71 ),
72
73 TP_printk("task:%u@%u %sv%d %s (%ssync)",
74 __entry->task_id, __entry->client_id,
75 __get_str(progname), __entry->version,
76 __get_str(procname), __entry->async ? "a": ""
77 )
78);
79
Chuck Lever6f7013832019-02-11 11:24:00 -050080TRACE_DEFINE_ENUM(RPC_TASK_ASYNC);
81TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER);
82TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN);
83TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS);
84TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC);
85TRACE_DEFINE_ENUM(RPC_TASK_KILLED);
86TRACE_DEFINE_ENUM(RPC_TASK_SOFT);
87TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN);
88TRACE_DEFINE_ENUM(RPC_TASK_SENT);
89TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT);
90TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT);
91TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT);
92
93#define rpc_show_task_flags(flags) \
94 __print_flags(flags, "|", \
95 { RPC_TASK_ASYNC, "ASYNC" }, \
96 { RPC_TASK_SWAPPER, "SWAPPER" }, \
97 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \
98 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \
99 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \
100 { RPC_TASK_KILLED, "KILLED" }, \
101 { RPC_TASK_SOFT, "SOFT" }, \
102 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \
103 { RPC_TASK_SENT, "SENT" }, \
104 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \
105 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \
106 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" })
107
108TRACE_DEFINE_ENUM(RPC_TASK_RUNNING);
109TRACE_DEFINE_ENUM(RPC_TASK_QUEUED);
110TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE);
111TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT);
112TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV);
113TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT);
114
115#define rpc_show_runstate(flags) \
116 __print_flags(flags, "|", \
117 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \
118 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \
119 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \
120 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \
121 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \
122 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" })
123
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500124DECLARE_EVENT_CLASS(rpc_task_running,
125
Chuck Levere671edb2018-03-16 10:33:44 -0400126 TP_PROTO(const struct rpc_task *task, const void *action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500127
Chuck Levere671edb2018-03-16 10:33:44 -0400128 TP_ARGS(task, action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500129
130 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400131 __field(unsigned int, task_id)
132 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500133 __field(const void *, action)
134 __field(unsigned long, runstate)
135 __field(int, status)
136 __field(unsigned short, flags)
137 ),
138
139 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400140 __entry->client_id = task->tk_client ?
141 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400142 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500143 __entry->action = action;
144 __entry->runstate = task->tk_runstate;
145 __entry->status = task->tk_status;
146 __entry->flags = task->tk_flags;
147 ),
148
Chuck Lever6f7013832019-02-11 11:24:00 -0500149 TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%pf",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400150 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500151 rpc_show_task_flags(__entry->flags),
152 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500153 __entry->status,
154 __entry->action
155 )
156);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500157#define DEFINE_RPC_RUNNING_EVENT(name) \
158 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
159 TP_PROTO( \
160 const struct rpc_task *task, \
161 const void *action \
162 ), \
163 TP_ARGS(task, action))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500164
Chuck Leverdc5820b2018-12-19 11:00:16 -0500165DEFINE_RPC_RUNNING_EVENT(begin);
166DEFINE_RPC_RUNNING_EVENT(run_action);
167DEFINE_RPC_RUNNING_EVENT(complete);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500168
169DECLARE_EVENT_CLASS(rpc_task_queued,
170
Chuck Levere671edb2018-03-16 10:33:44 -0400171 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500172
Chuck Levere671edb2018-03-16 10:33:44 -0400173 TP_ARGS(task, q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500174
175 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400176 __field(unsigned int, task_id)
177 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500178 __field(unsigned long, timeout)
179 __field(unsigned long, runstate)
180 __field(int, status)
181 __field(unsigned short, flags)
Trond Myklebust85c0d242012-02-06 10:31:35 -0500182 __string(q_name, rpc_qname(q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500183 ),
184
185 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400186 __entry->client_id = task->tk_client ?
187 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400188 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500189 __entry->timeout = task->tk_timeout;
190 __entry->runstate = task->tk_runstate;
191 __entry->status = task->tk_status;
192 __entry->flags = task->tk_flags;
Trond Myklebust85c0d242012-02-06 10:31:35 -0500193 __assign_str(q_name, rpc_qname(q));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500194 ),
195
Chuck Lever6f7013832019-02-11 11:24:00 -0500196 TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400197 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500198 rpc_show_task_flags(__entry->flags),
199 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500200 __entry->status,
201 __entry->timeout,
Trond Myklebust85c0d242012-02-06 10:31:35 -0500202 __get_str(q_name)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500203 )
204);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500205#define DEFINE_RPC_QUEUED_EVENT(name) \
206 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
207 TP_PROTO( \
208 const struct rpc_task *task, \
209 const struct rpc_wait_queue *q \
210 ), \
211 TP_ARGS(task, q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500212
Chuck Leverdc5820b2018-12-19 11:00:16 -0500213DEFINE_RPC_QUEUED_EVENT(sleep);
214DEFINE_RPC_QUEUED_EVENT(wakeup);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500215
Chuck Levere8680a22019-02-11 11:24:48 -0500216DECLARE_EVENT_CLASS(rpc_failure,
217
218 TP_PROTO(const struct rpc_task *task),
219
220 TP_ARGS(task),
221
222 TP_STRUCT__entry(
223 __field(unsigned int, task_id)
224 __field(unsigned int, client_id)
225 ),
226
227 TP_fast_assign(
228 __entry->task_id = task->tk_pid;
229 __entry->client_id = task->tk_client->cl_clid;
230 ),
231
232 TP_printk("task:%u@%u",
233 __entry->task_id, __entry->client_id)
234);
235
236#define DEFINE_RPC_FAILURE(name) \
237 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \
238 TP_PROTO( \
239 const struct rpc_task *task \
240 ), \
241 TP_ARGS(task))
242
243DEFINE_RPC_FAILURE(callhdr);
244
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400245TRACE_EVENT(rpc_stats_latency,
246
247 TP_PROTO(
248 const struct rpc_task *task,
249 ktime_t backlog,
250 ktime_t rtt,
251 ktime_t execute
252 ),
253
254 TP_ARGS(task, backlog, rtt, execute),
255
256 TP_STRUCT__entry(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400257 __field(unsigned int, task_id)
258 __field(unsigned int, client_id)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400259 __field(u32, xid)
260 __field(int, version)
261 __string(progname, task->tk_client->cl_program->name)
262 __string(procname, rpc_proc_name(task))
263 __field(unsigned long, backlog)
264 __field(unsigned long, rtt)
265 __field(unsigned long, execute)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400266 ),
267
268 TP_fast_assign(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400269 __entry->client_id = task->tk_client->cl_clid;
270 __entry->task_id = task->tk_pid;
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400271 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
272 __entry->version = task->tk_client->cl_vers;
273 __assign_str(progname, task->tk_client->cl_program->name)
274 __assign_str(procname, rpc_proc_name(task))
275 __entry->backlog = ktime_to_us(backlog);
276 __entry->rtt = ktime_to_us(rtt);
277 __entry->execute = ktime_to_us(execute);
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400278 ),
279
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400280 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
281 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400282 __get_str(progname), __entry->version, __get_str(procname),
283 __entry->backlog, __entry->rtt, __entry->execute)
284);
285
Chuck Lever55828632019-02-11 11:24:10 -0500286TRACE_EVENT(rpc_xdr_overflow,
287 TP_PROTO(
288 const struct xdr_stream *xdr,
289 size_t requested
290 ),
291
292 TP_ARGS(xdr, requested),
293
294 TP_STRUCT__entry(
295 __field(unsigned int, task_id)
296 __field(unsigned int, client_id)
297 __field(int, version)
298 __field(size_t, requested)
299 __field(const void *, end)
300 __field(const void *, p)
301 __field(const void *, head_base)
302 __field(size_t, head_len)
303 __field(const void *, tail_base)
304 __field(size_t, tail_len)
305 __field(unsigned int, page_len)
306 __field(unsigned int, len)
307 __string(progname,
308 xdr->rqst->rq_task->tk_client->cl_program->name)
309 __string(procedure,
310 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
311 ),
312
313 TP_fast_assign(
314 if (xdr->rqst) {
315 const struct rpc_task *task = xdr->rqst->rq_task;
316
317 __entry->task_id = task->tk_pid;
318 __entry->client_id = task->tk_client->cl_clid;
319 __assign_str(progname,
320 task->tk_client->cl_program->name)
321 __entry->version = task->tk_client->cl_vers;
322 __assign_str(procedure, task->tk_msg.rpc_proc->p_name)
323 } else {
324 __entry->task_id = 0;
325 __entry->client_id = 0;
326 __assign_str(progname, "unknown")
327 __entry->version = 0;
328 __assign_str(procedure, "unknown")
329 }
330 __entry->requested = requested;
331 __entry->end = xdr->end;
332 __entry->p = xdr->p;
333 __entry->head_base = xdr->buf->head[0].iov_base,
334 __entry->head_len = xdr->buf->head[0].iov_len,
335 __entry->page_len = xdr->buf->page_len,
336 __entry->tail_base = xdr->buf->tail[0].iov_base,
337 __entry->tail_len = xdr->buf->tail[0].iov_len,
338 __entry->len = xdr->buf->len;
339 ),
340
341 TP_printk(
342 "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
343 __entry->task_id, __entry->client_id,
344 __get_str(progname), __entry->version, __get_str(procedure),
345 __entry->requested, __entry->p, __entry->end,
346 __entry->head_base, __entry->head_len,
347 __entry->page_len,
348 __entry->tail_base, __entry->tail_len,
349 __entry->len
350 )
351);
352
Chuck Lever7be9cea32019-02-11 11:24:16 -0500353TRACE_EVENT(rpc_xdr_alignment,
354 TP_PROTO(
355 const struct xdr_stream *xdr,
356 size_t offset,
357 unsigned int copied
358 ),
359
360 TP_ARGS(xdr, offset, copied),
361
362 TP_STRUCT__entry(
363 __field(unsigned int, task_id)
364 __field(unsigned int, client_id)
365 __field(int, version)
366 __field(size_t, offset)
367 __field(unsigned int, copied)
368 __field(const void *, head_base)
369 __field(size_t, head_len)
370 __field(const void *, tail_base)
371 __field(size_t, tail_len)
372 __field(unsigned int, page_len)
373 __field(unsigned int, len)
374 __string(progname,
375 xdr->rqst->rq_task->tk_client->cl_program->name)
376 __string(procedure,
377 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
378 ),
379
380 TP_fast_assign(
381 const struct rpc_task *task = xdr->rqst->rq_task;
382
383 __entry->task_id = task->tk_pid;
384 __entry->client_id = task->tk_client->cl_clid;
385 __assign_str(progname,
386 task->tk_client->cl_program->name)
387 __entry->version = task->tk_client->cl_vers;
388 __assign_str(procedure, task->tk_msg.rpc_proc->p_name)
389
390 __entry->offset = offset;
391 __entry->copied = copied;
392 __entry->head_base = xdr->buf->head[0].iov_base,
393 __entry->head_len = xdr->buf->head[0].iov_len,
394 __entry->page_len = xdr->buf->page_len,
395 __entry->tail_base = xdr->buf->tail[0].iov_base,
396 __entry->tail_len = xdr->buf->tail[0].iov_len,
397 __entry->len = xdr->buf->len;
398 ),
399
400 TP_printk(
401 "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
402 __entry->task_id, __entry->client_id,
403 __get_str(progname), __entry->version, __get_str(procedure),
404 __entry->offset, __entry->copied,
405 __entry->head_base, __entry->head_len,
406 __entry->page_len,
407 __entry->tail_base, __entry->tail_len,
408 __entry->len
409 )
410);
411
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400412/*
413 * First define the enums in the below macros to be exported to userspace
414 * via TRACE_DEFINE_ENUM().
415 */
416#undef EM
417#undef EMe
418#define EM(a, b) TRACE_DEFINE_ENUM(a);
419#define EMe(a, b) TRACE_DEFINE_ENUM(a);
420
421#define RPC_SHOW_SOCKET \
422 EM( SS_FREE, "FREE" ) \
423 EM( SS_UNCONNECTED, "UNCONNECTED" ) \
424 EM( SS_CONNECTING, "CONNECTING," ) \
425 EM( SS_CONNECTED, "CONNECTED," ) \
426 EMe(SS_DISCONNECTING, "DISCONNECTING" )
427
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400428#define rpc_show_socket_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400429 __print_symbolic(state, RPC_SHOW_SOCKET)
430
431RPC_SHOW_SOCKET
432
433#define RPC_SHOW_SOCK \
434 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
435 EM( TCP_SYN_SENT, "SYN_SENT" ) \
436 EM( TCP_SYN_RECV, "SYN_RECV" ) \
437 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
438 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
439 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
440 EM( TCP_CLOSE, "CLOSE" ) \
441 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
442 EM( TCP_LAST_ACK, "LAST_ACK" ) \
443 EM( TCP_LISTEN, "LISTEN" ) \
444 EMe( TCP_CLOSING, "CLOSING" )
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400445
446#define rpc_show_sock_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400447 __print_symbolic(state, RPC_SHOW_SOCK)
448
449RPC_SHOW_SOCK
450
451/*
452 * Now redefine the EM() and EMe() macros to map the enums to the strings
453 * that will be printed in the output.
454 */
455#undef EM
456#undef EMe
457#define EM(a, b) {a, b},
458#define EMe(a, b) {a, b}
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400459
460DECLARE_EVENT_CLASS(xs_socket_event,
461
462 TP_PROTO(
463 struct rpc_xprt *xprt,
464 struct socket *socket
465 ),
466
467 TP_ARGS(xprt, socket),
468
469 TP_STRUCT__entry(
470 __field(unsigned int, socket_state)
471 __field(unsigned int, sock_state)
472 __field(unsigned long long, ino)
473 __string(dstaddr,
474 xprt->address_strings[RPC_DISPLAY_ADDR])
475 __string(dstport,
476 xprt->address_strings[RPC_DISPLAY_PORT])
477 ),
478
479 TP_fast_assign(
480 struct inode *inode = SOCK_INODE(socket);
481 __entry->socket_state = socket->state;
482 __entry->sock_state = socket->sk->sk_state;
483 __entry->ino = (unsigned long long)inode->i_ino;
484 __assign_str(dstaddr,
485 xprt->address_strings[RPC_DISPLAY_ADDR]);
486 __assign_str(dstport,
487 xprt->address_strings[RPC_DISPLAY_PORT]);
488 ),
489
490 TP_printk(
491 "socket:[%llu] dstaddr=%s/%s "
492 "state=%u (%s) sk_state=%u (%s)",
493 __entry->ino, __get_str(dstaddr), __get_str(dstport),
494 __entry->socket_state,
495 rpc_show_socket_state(__entry->socket_state),
496 __entry->sock_state,
497 rpc_show_sock_state(__entry->sock_state)
498 )
499);
500#define DEFINE_RPC_SOCKET_EVENT(name) \
501 DEFINE_EVENT(xs_socket_event, name, \
502 TP_PROTO( \
503 struct rpc_xprt *xprt, \
504 struct socket *socket \
505 ), \
506 TP_ARGS(xprt, socket))
507
508DECLARE_EVENT_CLASS(xs_socket_event_done,
509
510 TP_PROTO(
511 struct rpc_xprt *xprt,
512 struct socket *socket,
513 int error
514 ),
515
516 TP_ARGS(xprt, socket, error),
517
518 TP_STRUCT__entry(
519 __field(int, error)
520 __field(unsigned int, socket_state)
521 __field(unsigned int, sock_state)
522 __field(unsigned long long, ino)
523 __string(dstaddr,
524 xprt->address_strings[RPC_DISPLAY_ADDR])
525 __string(dstport,
526 xprt->address_strings[RPC_DISPLAY_PORT])
527 ),
528
529 TP_fast_assign(
530 struct inode *inode = SOCK_INODE(socket);
531 __entry->socket_state = socket->state;
532 __entry->sock_state = socket->sk->sk_state;
533 __entry->ino = (unsigned long long)inode->i_ino;
534 __entry->error = error;
535 __assign_str(dstaddr,
536 xprt->address_strings[RPC_DISPLAY_ADDR]);
537 __assign_str(dstport,
538 xprt->address_strings[RPC_DISPLAY_PORT]);
539 ),
540
541 TP_printk(
542 "error=%d socket:[%llu] dstaddr=%s/%s "
543 "state=%u (%s) sk_state=%u (%s)",
544 __entry->error,
545 __entry->ino, __get_str(dstaddr), __get_str(dstport),
546 __entry->socket_state,
547 rpc_show_socket_state(__entry->socket_state),
548 __entry->sock_state,
549 rpc_show_sock_state(__entry->sock_state)
550 )
551);
552#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
553 DEFINE_EVENT(xs_socket_event_done, name, \
554 TP_PROTO( \
555 struct rpc_xprt *xprt, \
556 struct socket *socket, \
557 int error \
558 ), \
559 TP_ARGS(xprt, socket, error))
560
561DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
562DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
Trond Myklebuste8353c762013-12-31 13:39:22 -0500563DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400564DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
565DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
566DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
567
Jeff Layton3705ad62014-10-28 14:24:13 -0400568DECLARE_EVENT_CLASS(rpc_xprt_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -0500569 TP_PROTO(
570 const struct rpc_xprt *xprt,
571 __be32 xid,
572 int status
573 ),
Jeff Layton3705ad62014-10-28 14:24:13 -0400574
575 TP_ARGS(xprt, xid, status),
576
577 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400578 __field(u32, xid)
Jeff Layton3705ad62014-10-28 14:24:13 -0400579 __field(int, status)
580 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
581 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
582 ),
583
584 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -0400585 __entry->xid = be32_to_cpu(xid);
Jeff Layton3705ad62014-10-28 14:24:13 -0400586 __entry->status = status;
587 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
588 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
589 ),
590
Chuck Levera30ccf12017-10-20 10:35:18 -0400591 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
592 __get_str(port), __entry->xid,
Jeff Layton3705ad62014-10-28 14:24:13 -0400593 __entry->status)
594);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500595#define DEFINE_RPC_XPRT_EVENT(name) \
596 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
597 TP_PROTO( \
598 const struct rpc_xprt *xprt, \
599 __be32 xid, \
600 int status \
601 ), \
602 TP_ARGS(xprt, xid, status))
Jeff Layton3705ad62014-10-28 14:24:13 -0400603
Chuck Leverdc5820b2018-12-19 11:00:16 -0500604DEFINE_RPC_XPRT_EVENT(timer);
605DEFINE_RPC_XPRT_EVENT(lookup_rqst);
606DEFINE_RPC_XPRT_EVENT(transmit);
607DEFINE_RPC_XPRT_EVENT(complete_rqst);
Jeff Layton3705ad62014-10-28 14:24:13 -0400608
Chuck Levera25a4cb2018-03-16 10:33:55 -0400609TRACE_EVENT(xprt_ping,
610 TP_PROTO(const struct rpc_xprt *xprt, int status),
611
612 TP_ARGS(xprt, status),
613
614 TP_STRUCT__entry(
615 __field(int, status)
616 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
617 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
618 ),
619
620 TP_fast_assign(
621 __entry->status = status;
622 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
623 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
624 ),
625
626 TP_printk("peer=[%s]:%s status=%d",
627 __get_str(addr), __get_str(port), __entry->status)
628);
629
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400630TRACE_EVENT(xs_stream_read_data,
631 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
Jeff Layton3705ad62014-10-28 14:24:13 -0400632
633 TP_ARGS(xprt, err, total),
634
635 TP_STRUCT__entry(
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400636 __field(ssize_t, err)
637 __field(size_t, total)
Jeff Layton3705ad62014-10-28 14:24:13 -0400638 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
639 "(null)")
640 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
641 "(null)")
642 ),
643
644 TP_fast_assign(
645 __entry->err = err;
646 __entry->total = total;
647 __assign_str(addr, xprt ?
648 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
649 __assign_str(port, xprt ?
650 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
651 ),
652
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400653 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
Jeff Layton3705ad62014-10-28 14:24:13 -0400654 __get_str(port), __entry->err, __entry->total)
655);
656
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400657TRACE_EVENT(xs_stream_read_request,
Jeff Layton1a867a02014-10-28 14:24:14 -0400658 TP_PROTO(struct sock_xprt *xs),
659
660 TP_ARGS(xs),
661
662 TP_STRUCT__entry(
663 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
664 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
Chuck Levera30ccf12017-10-20 10:35:18 -0400665 __field(u32, xid)
Jeff Layton1a867a02014-10-28 14:24:14 -0400666 __field(unsigned long, copied)
667 __field(unsigned int, reclen)
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400668 __field(unsigned int, offset)
Jeff Layton1a867a02014-10-28 14:24:14 -0400669 ),
670
671 TP_fast_assign(
672 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
673 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
Trond Myklebustd1109aa2018-08-13 15:48:42 -0400674 __entry->xid = be32_to_cpu(xs->recv.xid);
Trond Myklebustd1109aa2018-08-13 15:48:42 -0400675 __entry->copied = xs->recv.copied;
676 __entry->reclen = xs->recv.len;
677 __entry->offset = xs->recv.offset;
Jeff Layton1a867a02014-10-28 14:24:14 -0400678 ),
679
Trond Myklebustc50b8ee2018-09-14 14:26:28 -0400680 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
Chuck Levera30ccf12017-10-20 10:35:18 -0400681 __get_str(addr), __get_str(port), __entry->xid,
Jeff Layton1a867a02014-10-28 14:24:14 -0400682 __entry->copied, __entry->reclen, __entry->offset)
683);
684
Jeff Layton30660e04b2014-11-19 07:51:16 -0500685#define show_rqstp_flags(flags) \
686 __print_flags(flags, "|", \
687 { (1UL << RQ_SECURE), "RQ_SECURE"}, \
688 { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \
Jeff Layton78b65eb2014-11-19 07:51:17 -0500689 { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \
Jeff Layton779fb0f2014-11-19 07:51:18 -0500690 { (1UL << RQ_DROPME), "RQ_DROPME"}, \
Jeff Layton81244382014-11-21 14:19:28 -0500691 { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \
Jeff Laytonb1691bc2014-11-21 14:19:30 -0500692 { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \
693 { (1UL << RQ_BUSY), "RQ_BUSY"})
Jeff Layton4d152e22014-11-19 07:51:14 -0500694
Jeff Layton860a0d92014-10-28 14:24:12 -0400695TRACE_EVENT(svc_recv,
Chuck Lever41f306d2018-03-27 10:50:42 -0400696 TP_PROTO(struct svc_rqst *rqst, int len),
Jeff Layton860a0d92014-10-28 14:24:12 -0400697
Chuck Lever41f306d2018-03-27 10:50:42 -0400698 TP_ARGS(rqst, len),
Jeff Layton860a0d92014-10-28 14:24:12 -0400699
700 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400701 __field(u32, xid)
Chuck Lever41f306d2018-03-27 10:50:42 -0400702 __field(int, len)
Jeff Layton4d152e22014-11-19 07:51:14 -0500703 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400704 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Jeff Layton860a0d92014-10-28 14:24:12 -0400705 ),
706
707 TP_fast_assign(
Chuck Lever41f306d2018-03-27 10:50:42 -0400708 __entry->xid = be32_to_cpu(rqst->rq_xid);
709 __entry->len = len;
Jeff Layton4d152e22014-11-19 07:51:14 -0500710 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -0400711 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Jeff Layton860a0d92014-10-28 14:24:12 -0400712 ),
713
Chuck Leverece200d2018-03-27 10:51:00 -0400714 TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
715 __get_str(addr), __entry->xid, __entry->len,
Jeff Layton4d152e22014-11-19 07:51:14 -0500716 show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -0400717);
718
Chuck Lever0b9547b2018-03-27 10:51:22 -0400719TRACE_EVENT(svc_process,
720 TP_PROTO(const struct svc_rqst *rqst, const char *name),
721
722 TP_ARGS(rqst, name),
723
724 TP_STRUCT__entry(
725 __field(u32, xid)
726 __field(u32, vers)
727 __field(u32, proc)
728 __string(service, name)
Vasily Averind4b09ac2018-12-24 14:44:52 +0300729 __string(addr, rqst->rq_xprt ?
730 rqst->rq_xprt->xpt_remotebuf : "(null)")
Chuck Lever0b9547b2018-03-27 10:51:22 -0400731 ),
732
733 TP_fast_assign(
734 __entry->xid = be32_to_cpu(rqst->rq_xid);
735 __entry->vers = rqst->rq_vers;
736 __entry->proc = rqst->rq_proc;
737 __assign_str(service, name);
Vasily Averind4b09ac2018-12-24 14:44:52 +0300738 __assign_str(addr, rqst->rq_xprt ?
739 rqst->rq_xprt->xpt_remotebuf : "(null)");
Chuck Lever0b9547b2018-03-27 10:51:22 -0400740 ),
741
742 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
743 __get_str(addr), __entry->xid,
744 __get_str(service), __entry->vers, __entry->proc)
745);
746
Trond Myklebust104f6352016-06-24 10:55:46 -0400747DECLARE_EVENT_CLASS(svc_rqst_event,
748
Chuck Leverdc5820b2018-12-19 11:00:16 -0500749 TP_PROTO(
750 const struct svc_rqst *rqst
751 ),
Trond Myklebust104f6352016-06-24 10:55:46 -0400752
753 TP_ARGS(rqst),
754
755 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400756 __field(u32, xid)
Trond Myklebust104f6352016-06-24 10:55:46 -0400757 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400758 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -0400759 ),
760
761 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -0400762 __entry->xid = be32_to_cpu(rqst->rq_xid);
Trond Myklebust104f6352016-06-24 10:55:46 -0400763 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -0400764 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -0400765 ),
766
Chuck Leverece200d2018-03-27 10:51:00 -0400767 TP_printk("addr=%s xid=0x%08x flags=%s",
768 __get_str(addr), __entry->xid,
769 show_rqstp_flags(__entry->flags))
Trond Myklebust104f6352016-06-24 10:55:46 -0400770);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500771#define DEFINE_SVC_RQST_EVENT(name) \
772 DEFINE_EVENT(svc_rqst_event, svc_##name, \
773 TP_PROTO( \
774 const struct svc_rqst *rqst \
775 ), \
776 TP_ARGS(rqst))
Trond Myklebust104f6352016-06-24 10:55:46 -0400777
Chuck Leverdc5820b2018-12-19 11:00:16 -0500778DEFINE_SVC_RQST_EVENT(defer);
779DEFINE_SVC_RQST_EVENT(drop);
Trond Myklebust104f6352016-06-24 10:55:46 -0400780
Jeff Layton860a0d92014-10-28 14:24:12 -0400781DECLARE_EVENT_CLASS(svc_rqst_status,
782
783 TP_PROTO(struct svc_rqst *rqst, int status),
784
785 TP_ARGS(rqst, status),
786
787 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400788 __field(u32, xid)
Jeff Layton860a0d92014-10-28 14:24:12 -0400789 __field(int, status)
Jeff Layton4d152e22014-11-19 07:51:14 -0500790 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400791 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Jeff Layton860a0d92014-10-28 14:24:12 -0400792 ),
793
794 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -0400795 __entry->xid = be32_to_cpu(rqst->rq_xid);
Jeff Layton860a0d92014-10-28 14:24:12 -0400796 __entry->status = status;
Jeff Layton4d152e22014-11-19 07:51:14 -0500797 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -0400798 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Jeff Layton860a0d92014-10-28 14:24:12 -0400799 ),
800
Chuck Leverece200d2018-03-27 10:51:00 -0400801 TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
802 __get_str(addr), __entry->xid,
803 __entry->status, show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -0400804);
805
Jeff Layton860a0d92014-10-28 14:24:12 -0400806DEFINE_EVENT(svc_rqst_status, svc_send,
807 TP_PROTO(struct svc_rqst *rqst, int status),
808 TP_ARGS(rqst, status));
809
Jeff Layton83a712e2014-11-21 14:19:31 -0500810#define show_svc_xprt_flags(flags) \
811 __print_flags(flags, "|", \
812 { (1UL << XPT_BUSY), "XPT_BUSY"}, \
813 { (1UL << XPT_CONN), "XPT_CONN"}, \
814 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \
815 { (1UL << XPT_DATA), "XPT_DATA"}, \
816 { (1UL << XPT_TEMP), "XPT_TEMP"}, \
817 { (1UL << XPT_DEAD), "XPT_DEAD"}, \
818 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \
819 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \
820 { (1UL << XPT_OLD), "XPT_OLD"}, \
821 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \
822 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \
Chuck Lever03edb902018-03-27 10:49:53 -0400823 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \
824 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \
825 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"})
Jeff Layton83a712e2014-11-21 14:19:31 -0500826
827TRACE_EVENT(svc_xprt_do_enqueue,
828 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
829
830 TP_ARGS(xprt, rqst),
831
832 TP_STRUCT__entry(
833 __field(struct svc_xprt *, xprt)
Pratyush Anand051ac382015-08-27 10:01:33 +0530834 __field(int, pid)
835 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400836 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -0500837 ),
838
839 TP_fast_assign(
840 __entry->xprt = xprt;
Pratyush Anand051ac382015-08-27 10:01:33 +0530841 __entry->pid = rqst? rqst->rq_task->pid : 0;
Chuck Leverece200d2018-03-27 10:51:00 -0400842 __entry->flags = xprt->xpt_flags;
843 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -0500844 ),
845
Chuck Leverece200d2018-03-27 10:51:00 -0400846 TP_printk("xprt=%p addr=%s pid=%d flags=%s",
847 __entry->xprt, __get_str(addr),
848 __entry->pid, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -0500849);
850
Trond Myklebust82ea2d72016-06-24 10:55:45 -0400851DECLARE_EVENT_CLASS(svc_xprt_event,
Jeff Layton83a712e2014-11-21 14:19:31 -0500852 TP_PROTO(struct svc_xprt *xprt),
853
854 TP_ARGS(xprt),
855
856 TP_STRUCT__entry(
857 __field(struct svc_xprt *, xprt)
Jeff Layton83a712e2014-11-21 14:19:31 -0500858 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400859 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -0500860 ),
861
862 TP_fast_assign(
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400863 __entry->xprt = xprt;
Chuck Levercaa3e106d2018-03-27 10:50:07 -0400864 __entry->flags = xprt->xpt_flags;
Chuck Leverece200d2018-03-27 10:51:00 -0400865 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -0500866 ),
867
Chuck Leverece200d2018-03-27 10:51:00 -0400868 TP_printk("xprt=%p addr=%s flags=%s",
869 __entry->xprt, __get_str(addr),
870 show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -0500871);
872
Trond Myklebust82ea2d72016-06-24 10:55:45 -0400873DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
874 TP_PROTO(struct svc_xprt *xprt),
875 TP_ARGS(xprt));
876
Chuck Lever55f50882018-03-27 10:52:27 -0400877TRACE_EVENT(svc_xprt_dequeue,
878 TP_PROTO(struct svc_rqst *rqst),
879
880 TP_ARGS(rqst),
881
882 TP_STRUCT__entry(
883 __field(struct svc_xprt *, xprt)
884 __field(unsigned long, flags)
885 __field(unsigned long, wakeup)
886 __string(addr, rqst->rq_xprt->xpt_remotebuf)
887 ),
888
889 TP_fast_assign(
890 __entry->xprt = rqst->rq_xprt;
891 __entry->flags = rqst->rq_xprt->xpt_flags;
892 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
893 rqst->rq_qtime));
894 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
895 ),
896
897 TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
898 __entry->xprt, __get_str(addr),
899 show_svc_xprt_flags(__entry->flags),
900 __entry->wakeup)
901);
902
Jeff Layton83a712e2014-11-21 14:19:31 -0500903TRACE_EVENT(svc_wake_up,
904 TP_PROTO(int pid),
905
906 TP_ARGS(pid),
907
908 TP_STRUCT__entry(
909 __field(int, pid)
910 ),
911
912 TP_fast_assign(
913 __entry->pid = pid;
914 ),
915
916 TP_printk("pid=%d", __entry->pid)
917);
918
919TRACE_EVENT(svc_handle_xprt,
920 TP_PROTO(struct svc_xprt *xprt, int len),
921
922 TP_ARGS(xprt, len),
923
924 TP_STRUCT__entry(
925 __field(struct svc_xprt *, xprt)
926 __field(int, len)
Pratyush Anand051ac382015-08-27 10:01:33 +0530927 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -0400928 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -0500929 ),
930
931 TP_fast_assign(
932 __entry->xprt = xprt;
933 __entry->len = len;
Chuck Leverece200d2018-03-27 10:51:00 -0400934 __entry->flags = xprt->xpt_flags;
935 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -0500936 ),
937
Chuck Leverece200d2018-03-27 10:51:00 -0400938 TP_printk("xprt=%p addr=%s len=%d flags=%s",
939 __entry->xprt, __get_str(addr),
Pratyush Anand051ac382015-08-27 10:01:33 +0530940 __entry->len, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -0500941);
Trond Myklebust104f6352016-06-24 10:55:46 -0400942
Chuck Leveraaba72c2018-03-27 10:51:39 -0400943TRACE_EVENT(svc_stats_latency,
944 TP_PROTO(const struct svc_rqst *rqst),
945
946 TP_ARGS(rqst),
947
948 TP_STRUCT__entry(
949 __field(u32, xid)
950 __field(unsigned long, execute)
951 __string(addr, rqst->rq_xprt->xpt_remotebuf)
952 ),
953
954 TP_fast_assign(
955 __entry->xid = be32_to_cpu(rqst->rq_xid);
956 __entry->execute = ktime_to_us(ktime_sub(ktime_get(),
957 rqst->rq_stime));
958 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
959 ),
960
961 TP_printk("addr=%s xid=0x%08x execute-us=%lu",
962 __get_str(addr), __entry->xid, __entry->execute)
963);
Trond Myklebust104f6352016-06-24 10:55:46 -0400964
965DECLARE_EVENT_CLASS(svc_deferred_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -0500966 TP_PROTO(
967 const struct svc_deferred_req *dr
968 ),
Trond Myklebust104f6352016-06-24 10:55:46 -0400969
970 TP_ARGS(dr),
971
972 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400973 __field(u32, xid)
Chuck Leverece200d2018-03-27 10:51:00 -0400974 __string(addr, dr->xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -0400975 ),
976
977 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -0400978 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
979 (dr->xprt_hlen>>2)));
Chuck Leverece200d2018-03-27 10:51:00 -0400980 __assign_str(addr, dr->xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -0400981 ),
982
Chuck Leverece200d2018-03-27 10:51:00 -0400983 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
Trond Myklebust104f6352016-06-24 10:55:46 -0400984);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500985#define DEFINE_SVC_DEFERRED_EVENT(name) \
986 DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \
987 TP_PROTO( \
988 const struct svc_deferred_req *dr \
989 ), \
990 TP_ARGS(dr))
Trond Myklebust104f6352016-06-24 10:55:46 -0400991
Chuck Leverdc5820b2018-12-19 11:00:16 -0500992DEFINE_SVC_DEFERRED_EVENT(drop);
993DEFINE_SVC_DEFERRED_EVENT(revisit);
994
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500995#endif /* _TRACE_SUNRPC_H */
996
997#include <trace/define_trace.h>