xref: /openbmc/linux/include/trace/events/sunrpc.h (revision f17f06a0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #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>
10 #include <linux/sunrpc/svc.h>
11 #include <linux/sunrpc/xprtsock.h>
12 #include <linux/sunrpc/svc_xprt.h>
13 #include <net/tcp_states.h>
14 #include <linux/net.h>
15 #include <linux/tracepoint.h>
16 
17 TRACE_DEFINE_ENUM(RPC_AUTH_OK);
18 TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED);
19 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED);
20 TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF);
21 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF);
22 TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK);
23 TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM);
24 TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM);
25 
26 #define rpc_show_auth_stat(status)					\
27 	__print_symbolic(status,					\
28 		{ RPC_AUTH_OK,			"AUTH_OK" },		\
29 		{ RPC_AUTH_BADCRED,		"BADCRED" },		\
30 		{ RPC_AUTH_REJECTEDCRED,	"REJECTEDCRED" },	\
31 		{ RPC_AUTH_BADVERF,		"BADVERF" },		\
32 		{ RPC_AUTH_REJECTEDVERF,	"REJECTEDVERF" },	\
33 		{ RPC_AUTH_TOOWEAK,		"TOOWEAK" },		\
34 		{ RPCSEC_GSS_CREDPROBLEM,	"GSS_CREDPROBLEM" },	\
35 		{ RPCSEC_GSS_CTXPROBLEM,	"GSS_CTXPROBLEM" })	\
36 
37 DECLARE_EVENT_CLASS(rpc_task_status,
38 
39 	TP_PROTO(const struct rpc_task *task),
40 
41 	TP_ARGS(task),
42 
43 	TP_STRUCT__entry(
44 		__field(unsigned int, task_id)
45 		__field(unsigned int, client_id)
46 		__field(int, status)
47 	),
48 
49 	TP_fast_assign(
50 		__entry->task_id = task->tk_pid;
51 		__entry->client_id = task->tk_client->cl_clid;
52 		__entry->status = task->tk_status;
53 	),
54 
55 	TP_printk("task:%u@%u status=%d",
56 		__entry->task_id, __entry->client_id,
57 		__entry->status)
58 );
59 #define DEFINE_RPC_STATUS_EVENT(name) \
60 	DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
61 			TP_PROTO( \
62 				const struct rpc_task *task \
63 			), \
64 			TP_ARGS(task))
65 
66 DEFINE_RPC_STATUS_EVENT(call);
67 DEFINE_RPC_STATUS_EVENT(bind);
68 DEFINE_RPC_STATUS_EVENT(connect);
69 
70 TRACE_EVENT(rpc_request,
71 	TP_PROTO(const struct rpc_task *task),
72 
73 	TP_ARGS(task),
74 
75 	TP_STRUCT__entry(
76 		__field(unsigned int, task_id)
77 		__field(unsigned int, client_id)
78 		__field(int, version)
79 		__field(bool, async)
80 		__string(progname, task->tk_client->cl_program->name)
81 		__string(procname, rpc_proc_name(task))
82 	),
83 
84 	TP_fast_assign(
85 		__entry->task_id = task->tk_pid;
86 		__entry->client_id = task->tk_client->cl_clid;
87 		__entry->version = task->tk_client->cl_vers;
88 		__entry->async = RPC_IS_ASYNC(task);
89 		__assign_str(progname, task->tk_client->cl_program->name)
90 		__assign_str(procname, rpc_proc_name(task))
91 	),
92 
93 	TP_printk("task:%u@%u %sv%d %s (%ssync)",
94 		__entry->task_id, __entry->client_id,
95 		__get_str(progname), __entry->version,
96 		__get_str(procname), __entry->async ? "a": ""
97 		)
98 );
99 
100 TRACE_DEFINE_ENUM(RPC_TASK_ASYNC);
101 TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER);
102 TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN);
103 TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS);
104 TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC);
105 TRACE_DEFINE_ENUM(RPC_TASK_SOFT);
106 TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN);
107 TRACE_DEFINE_ENUM(RPC_TASK_SENT);
108 TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT);
109 TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT);
110 TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT);
111 
112 #define rpc_show_task_flags(flags)					\
113 	__print_flags(flags, "|",					\
114 		{ RPC_TASK_ASYNC, "ASYNC" },				\
115 		{ RPC_TASK_SWAPPER, "SWAPPER" },			\
116 		{ RPC_CALL_MAJORSEEN, "MAJORSEEN" },			\
117 		{ RPC_TASK_ROOTCREDS, "ROOTCREDS" },			\
118 		{ RPC_TASK_DYNAMIC, "DYNAMIC" },			\
119 		{ RPC_TASK_SOFT, "SOFT" },				\
120 		{ RPC_TASK_SOFTCONN, "SOFTCONN" },			\
121 		{ RPC_TASK_SENT, "SENT" },				\
122 		{ RPC_TASK_TIMEOUT, "TIMEOUT" },			\
123 		{ RPC_TASK_NOCONNECT, "NOCONNECT" },			\
124 		{ RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" })
125 
126 TRACE_DEFINE_ENUM(RPC_TASK_RUNNING);
127 TRACE_DEFINE_ENUM(RPC_TASK_QUEUED);
128 TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE);
129 TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT);
130 TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV);
131 TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT);
132 TRACE_DEFINE_ENUM(RPC_TASK_SIGNALLED);
133 
134 #define rpc_show_runstate(flags)					\
135 	__print_flags(flags, "|",					\
136 		{ (1UL << RPC_TASK_RUNNING), "RUNNING" },		\
137 		{ (1UL << RPC_TASK_QUEUED), "QUEUED" },			\
138 		{ (1UL << RPC_TASK_ACTIVE), "ACTIVE" },			\
139 		{ (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" },		\
140 		{ (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" },		\
141 		{ (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" },	\
142 		{ (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" })
143 
144 DECLARE_EVENT_CLASS(rpc_task_running,
145 
146 	TP_PROTO(const struct rpc_task *task, const void *action),
147 
148 	TP_ARGS(task, action),
149 
150 	TP_STRUCT__entry(
151 		__field(unsigned int, task_id)
152 		__field(unsigned int, client_id)
153 		__field(const void *, action)
154 		__field(unsigned long, runstate)
155 		__field(int, status)
156 		__field(unsigned short, flags)
157 		),
158 
159 	TP_fast_assign(
160 		__entry->client_id = task->tk_client ?
161 				     task->tk_client->cl_clid : -1;
162 		__entry->task_id = task->tk_pid;
163 		__entry->action = action;
164 		__entry->runstate = task->tk_runstate;
165 		__entry->status = task->tk_status;
166 		__entry->flags = task->tk_flags;
167 		),
168 
169 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps",
170 		__entry->task_id, __entry->client_id,
171 		rpc_show_task_flags(__entry->flags),
172 		rpc_show_runstate(__entry->runstate),
173 		__entry->status,
174 		__entry->action
175 		)
176 );
177 #define DEFINE_RPC_RUNNING_EVENT(name) \
178 	DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
179 			TP_PROTO( \
180 				const struct rpc_task *task, \
181 				const void *action \
182 			), \
183 			TP_ARGS(task, action))
184 
185 DEFINE_RPC_RUNNING_EVENT(begin);
186 DEFINE_RPC_RUNNING_EVENT(run_action);
187 DEFINE_RPC_RUNNING_EVENT(complete);
188 DEFINE_RPC_RUNNING_EVENT(signalled);
189 DEFINE_RPC_RUNNING_EVENT(end);
190 
191 DECLARE_EVENT_CLASS(rpc_task_queued,
192 
193 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
194 
195 	TP_ARGS(task, q),
196 
197 	TP_STRUCT__entry(
198 		__field(unsigned int, task_id)
199 		__field(unsigned int, client_id)
200 		__field(unsigned long, timeout)
201 		__field(unsigned long, runstate)
202 		__field(int, status)
203 		__field(unsigned short, flags)
204 		__string(q_name, rpc_qname(q))
205 		),
206 
207 	TP_fast_assign(
208 		__entry->client_id = task->tk_client ?
209 				     task->tk_client->cl_clid : -1;
210 		__entry->task_id = task->tk_pid;
211 		__entry->timeout = rpc_task_timeout(task);
212 		__entry->runstate = task->tk_runstate;
213 		__entry->status = task->tk_status;
214 		__entry->flags = task->tk_flags;
215 		__assign_str(q_name, rpc_qname(q));
216 		),
217 
218 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
219 		__entry->task_id, __entry->client_id,
220 		rpc_show_task_flags(__entry->flags),
221 		rpc_show_runstate(__entry->runstate),
222 		__entry->status,
223 		__entry->timeout,
224 		__get_str(q_name)
225 		)
226 );
227 #define DEFINE_RPC_QUEUED_EVENT(name) \
228 	DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
229 			TP_PROTO( \
230 				const struct rpc_task *task, \
231 				const struct rpc_wait_queue *q \
232 			), \
233 			TP_ARGS(task, q))
234 
235 DEFINE_RPC_QUEUED_EVENT(sleep);
236 DEFINE_RPC_QUEUED_EVENT(wakeup);
237 
238 DECLARE_EVENT_CLASS(rpc_failure,
239 
240 	TP_PROTO(const struct rpc_task *task),
241 
242 	TP_ARGS(task),
243 
244 	TP_STRUCT__entry(
245 		__field(unsigned int, task_id)
246 		__field(unsigned int, client_id)
247 	),
248 
249 	TP_fast_assign(
250 		__entry->task_id = task->tk_pid;
251 		__entry->client_id = task->tk_client->cl_clid;
252 	),
253 
254 	TP_printk("task:%u@%u",
255 		__entry->task_id, __entry->client_id)
256 );
257 
258 #define DEFINE_RPC_FAILURE(name)					\
259 	DEFINE_EVENT(rpc_failure, rpc_bad_##name,			\
260 			TP_PROTO(					\
261 				const struct rpc_task *task		\
262 			),						\
263 			TP_ARGS(task))
264 
265 DEFINE_RPC_FAILURE(callhdr);
266 DEFINE_RPC_FAILURE(verifier);
267 
268 DECLARE_EVENT_CLASS(rpc_reply_event,
269 
270 	TP_PROTO(
271 		const struct rpc_task *task
272 	),
273 
274 	TP_ARGS(task),
275 
276 	TP_STRUCT__entry(
277 		__field(unsigned int, task_id)
278 		__field(unsigned int, client_id)
279 		__field(u32, xid)
280 		__string(progname, task->tk_client->cl_program->name)
281 		__field(u32, version)
282 		__string(procname, rpc_proc_name(task))
283 		__string(servername, task->tk_xprt->servername)
284 	),
285 
286 	TP_fast_assign(
287 		__entry->task_id = task->tk_pid;
288 		__entry->client_id = task->tk_client->cl_clid;
289 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
290 		__assign_str(progname, task->tk_client->cl_program->name)
291 		__entry->version = task->tk_client->cl_vers;
292 		__assign_str(procname, rpc_proc_name(task))
293 		__assign_str(servername, task->tk_xprt->servername)
294 	),
295 
296 	TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s",
297 		__entry->task_id, __entry->client_id, __get_str(servername),
298 		__entry->xid, __get_str(progname), __entry->version,
299 		__get_str(procname))
300 )
301 
302 #define DEFINE_RPC_REPLY_EVENT(name)					\
303 	DEFINE_EVENT(rpc_reply_event, rpc__##name,			\
304 			TP_PROTO(					\
305 				const struct rpc_task *task		\
306 			),						\
307 			TP_ARGS(task))
308 
309 DEFINE_RPC_REPLY_EVENT(prog_unavail);
310 DEFINE_RPC_REPLY_EVENT(prog_mismatch);
311 DEFINE_RPC_REPLY_EVENT(proc_unavail);
312 DEFINE_RPC_REPLY_EVENT(garbage_args);
313 DEFINE_RPC_REPLY_EVENT(unparsable);
314 DEFINE_RPC_REPLY_EVENT(mismatch);
315 DEFINE_RPC_REPLY_EVENT(stale_creds);
316 DEFINE_RPC_REPLY_EVENT(bad_creds);
317 DEFINE_RPC_REPLY_EVENT(auth_tooweak);
318 
319 TRACE_EVENT(rpc_stats_latency,
320 
321 	TP_PROTO(
322 		const struct rpc_task *task,
323 		ktime_t backlog,
324 		ktime_t rtt,
325 		ktime_t execute
326 	),
327 
328 	TP_ARGS(task, backlog, rtt, execute),
329 
330 	TP_STRUCT__entry(
331 		__field(unsigned int, task_id)
332 		__field(unsigned int, client_id)
333 		__field(u32, xid)
334 		__field(int, version)
335 		__string(progname, task->tk_client->cl_program->name)
336 		__string(procname, rpc_proc_name(task))
337 		__field(unsigned long, backlog)
338 		__field(unsigned long, rtt)
339 		__field(unsigned long, execute)
340 	),
341 
342 	TP_fast_assign(
343 		__entry->client_id = task->tk_client->cl_clid;
344 		__entry->task_id = task->tk_pid;
345 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
346 		__entry->version = task->tk_client->cl_vers;
347 		__assign_str(progname, task->tk_client->cl_program->name)
348 		__assign_str(procname, rpc_proc_name(task))
349 		__entry->backlog = ktime_to_us(backlog);
350 		__entry->rtt = ktime_to_us(rtt);
351 		__entry->execute = ktime_to_us(execute);
352 	),
353 
354 	TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
355 		__entry->task_id, __entry->client_id, __entry->xid,
356 		__get_str(progname), __entry->version, __get_str(procname),
357 		__entry->backlog, __entry->rtt, __entry->execute)
358 );
359 
360 TRACE_EVENT(rpc_xdr_overflow,
361 	TP_PROTO(
362 		const struct xdr_stream *xdr,
363 		size_t requested
364 	),
365 
366 	TP_ARGS(xdr, requested),
367 
368 	TP_STRUCT__entry(
369 		__field(unsigned int, task_id)
370 		__field(unsigned int, client_id)
371 		__field(int, version)
372 		__field(size_t, requested)
373 		__field(const void *, end)
374 		__field(const void *, p)
375 		__field(const void *, head_base)
376 		__field(size_t, head_len)
377 		__field(const void *, tail_base)
378 		__field(size_t, tail_len)
379 		__field(unsigned int, page_len)
380 		__field(unsigned int, len)
381 		__string(progname,
382 			 xdr->rqst->rq_task->tk_client->cl_program->name)
383 		__string(procedure,
384 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
385 	),
386 
387 	TP_fast_assign(
388 		if (xdr->rqst) {
389 			const struct rpc_task *task = xdr->rqst->rq_task;
390 
391 			__entry->task_id = task->tk_pid;
392 			__entry->client_id = task->tk_client->cl_clid;
393 			__assign_str(progname,
394 				     task->tk_client->cl_program->name)
395 			__entry->version = task->tk_client->cl_vers;
396 			__assign_str(procedure, task->tk_msg.rpc_proc->p_name)
397 		} else {
398 			__entry->task_id = 0;
399 			__entry->client_id = 0;
400 			__assign_str(progname, "unknown")
401 			__entry->version = 0;
402 			__assign_str(procedure, "unknown")
403 		}
404 		__entry->requested = requested;
405 		__entry->end = xdr->end;
406 		__entry->p = xdr->p;
407 		__entry->head_base = xdr->buf->head[0].iov_base,
408 		__entry->head_len = xdr->buf->head[0].iov_len,
409 		__entry->page_len = xdr->buf->page_len,
410 		__entry->tail_base = xdr->buf->tail[0].iov_base,
411 		__entry->tail_len = xdr->buf->tail[0].iov_len,
412 		__entry->len = xdr->buf->len;
413 	),
414 
415 	TP_printk(
416 		"task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
417 		__entry->task_id, __entry->client_id,
418 		__get_str(progname), __entry->version, __get_str(procedure),
419 		__entry->requested, __entry->p, __entry->end,
420 		__entry->head_base, __entry->head_len,
421 		__entry->page_len,
422 		__entry->tail_base, __entry->tail_len,
423 		__entry->len
424 	)
425 );
426 
427 TRACE_EVENT(rpc_xdr_alignment,
428 	TP_PROTO(
429 		const struct xdr_stream *xdr,
430 		size_t offset,
431 		unsigned int copied
432 	),
433 
434 	TP_ARGS(xdr, offset, copied),
435 
436 	TP_STRUCT__entry(
437 		__field(unsigned int, task_id)
438 		__field(unsigned int, client_id)
439 		__field(int, version)
440 		__field(size_t, offset)
441 		__field(unsigned int, copied)
442 		__field(const void *, head_base)
443 		__field(size_t, head_len)
444 		__field(const void *, tail_base)
445 		__field(size_t, tail_len)
446 		__field(unsigned int, page_len)
447 		__field(unsigned int, len)
448 		__string(progname,
449 			 xdr->rqst->rq_task->tk_client->cl_program->name)
450 		__string(procedure,
451 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
452 	),
453 
454 	TP_fast_assign(
455 		const struct rpc_task *task = xdr->rqst->rq_task;
456 
457 		__entry->task_id = task->tk_pid;
458 		__entry->client_id = task->tk_client->cl_clid;
459 		__assign_str(progname,
460 			     task->tk_client->cl_program->name)
461 		__entry->version = task->tk_client->cl_vers;
462 		__assign_str(procedure, task->tk_msg.rpc_proc->p_name)
463 
464 		__entry->offset = offset;
465 		__entry->copied = copied;
466 		__entry->head_base = xdr->buf->head[0].iov_base,
467 		__entry->head_len = xdr->buf->head[0].iov_len,
468 		__entry->page_len = xdr->buf->page_len,
469 		__entry->tail_base = xdr->buf->tail[0].iov_base,
470 		__entry->tail_len = xdr->buf->tail[0].iov_len,
471 		__entry->len = xdr->buf->len;
472 	),
473 
474 	TP_printk(
475 		"task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
476 		__entry->task_id, __entry->client_id,
477 		__get_str(progname), __entry->version, __get_str(procedure),
478 		__entry->offset, __entry->copied,
479 		__entry->head_base, __entry->head_len,
480 		__entry->page_len,
481 		__entry->tail_base, __entry->tail_len,
482 		__entry->len
483 	)
484 );
485 
486 TRACE_EVENT(rpc_reply_pages,
487 	TP_PROTO(
488 		const struct rpc_rqst *req
489 	),
490 
491 	TP_ARGS(req),
492 
493 	TP_STRUCT__entry(
494 		__field(unsigned int, task_id)
495 		__field(unsigned int, client_id)
496 		__field(const void *, head_base)
497 		__field(size_t, head_len)
498 		__field(const void *, tail_base)
499 		__field(size_t, tail_len)
500 		__field(unsigned int, page_len)
501 	),
502 
503 	TP_fast_assign(
504 		__entry->task_id = req->rq_task->tk_pid;
505 		__entry->client_id = req->rq_task->tk_client->cl_clid;
506 
507 		__entry->head_base = req->rq_rcv_buf.head[0].iov_base;
508 		__entry->head_len = req->rq_rcv_buf.head[0].iov_len;
509 		__entry->page_len = req->rq_rcv_buf.page_len;
510 		__entry->tail_base = req->rq_rcv_buf.tail[0].iov_base;
511 		__entry->tail_len = req->rq_rcv_buf.tail[0].iov_len;
512 	),
513 
514 	TP_printk(
515 		"task:%u@%u xdr=[%p,%zu]/%u/[%p,%zu]\n",
516 		__entry->task_id, __entry->client_id,
517 		__entry->head_base, __entry->head_len,
518 		__entry->page_len,
519 		__entry->tail_base, __entry->tail_len
520 	)
521 );
522 
523 /*
524  * First define the enums in the below macros to be exported to userspace
525  * via TRACE_DEFINE_ENUM().
526  */
527 #undef EM
528 #undef EMe
529 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
530 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
531 
532 #define RPC_SHOW_SOCKET				\
533 	EM( SS_FREE, "FREE" )			\
534 	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
535 	EM( SS_CONNECTING, "CONNECTING," )	\
536 	EM( SS_CONNECTED, "CONNECTED," )	\
537 	EMe(SS_DISCONNECTING, "DISCONNECTING" )
538 
539 #define rpc_show_socket_state(state) \
540 	__print_symbolic(state, RPC_SHOW_SOCKET)
541 
542 RPC_SHOW_SOCKET
543 
544 #define RPC_SHOW_SOCK				\
545 	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
546 	EM( TCP_SYN_SENT, "SYN_SENT" )		\
547 	EM( TCP_SYN_RECV, "SYN_RECV" )		\
548 	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
549 	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
550 	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
551 	EM( TCP_CLOSE, "CLOSE" )		\
552 	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
553 	EM( TCP_LAST_ACK, "LAST_ACK" )		\
554 	EM( TCP_LISTEN, "LISTEN" )		\
555 	EMe( TCP_CLOSING, "CLOSING" )
556 
557 #define rpc_show_sock_state(state) \
558 	__print_symbolic(state, RPC_SHOW_SOCK)
559 
560 RPC_SHOW_SOCK
561 
562 /*
563  * Now redefine the EM() and EMe() macros to map the enums to the strings
564  * that will be printed in the output.
565  */
566 #undef EM
567 #undef EMe
568 #define EM(a, b)	{a, b},
569 #define EMe(a, b)	{a, b}
570 
571 DECLARE_EVENT_CLASS(xs_socket_event,
572 
573 		TP_PROTO(
574 			struct rpc_xprt *xprt,
575 			struct socket *socket
576 		),
577 
578 		TP_ARGS(xprt, socket),
579 
580 		TP_STRUCT__entry(
581 			__field(unsigned int, socket_state)
582 			__field(unsigned int, sock_state)
583 			__field(unsigned long long, ino)
584 			__string(dstaddr,
585 				xprt->address_strings[RPC_DISPLAY_ADDR])
586 			__string(dstport,
587 				xprt->address_strings[RPC_DISPLAY_PORT])
588 		),
589 
590 		TP_fast_assign(
591 			struct inode *inode = SOCK_INODE(socket);
592 			__entry->socket_state = socket->state;
593 			__entry->sock_state = socket->sk->sk_state;
594 			__entry->ino = (unsigned long long)inode->i_ino;
595 			__assign_str(dstaddr,
596 				xprt->address_strings[RPC_DISPLAY_ADDR]);
597 			__assign_str(dstport,
598 				xprt->address_strings[RPC_DISPLAY_PORT]);
599 		),
600 
601 		TP_printk(
602 			"socket:[%llu] dstaddr=%s/%s "
603 			"state=%u (%s) sk_state=%u (%s)",
604 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
605 			__entry->socket_state,
606 			rpc_show_socket_state(__entry->socket_state),
607 			__entry->sock_state,
608 			rpc_show_sock_state(__entry->sock_state)
609 		)
610 );
611 #define DEFINE_RPC_SOCKET_EVENT(name) \
612 	DEFINE_EVENT(xs_socket_event, name, \
613 			TP_PROTO( \
614 				struct rpc_xprt *xprt, \
615 				struct socket *socket \
616 			), \
617 			TP_ARGS(xprt, socket))
618 
619 DECLARE_EVENT_CLASS(xs_socket_event_done,
620 
621 		TP_PROTO(
622 			struct rpc_xprt *xprt,
623 			struct socket *socket,
624 			int error
625 		),
626 
627 		TP_ARGS(xprt, socket, error),
628 
629 		TP_STRUCT__entry(
630 			__field(int, error)
631 			__field(unsigned int, socket_state)
632 			__field(unsigned int, sock_state)
633 			__field(unsigned long long, ino)
634 			__string(dstaddr,
635 				xprt->address_strings[RPC_DISPLAY_ADDR])
636 			__string(dstport,
637 				xprt->address_strings[RPC_DISPLAY_PORT])
638 		),
639 
640 		TP_fast_assign(
641 			struct inode *inode = SOCK_INODE(socket);
642 			__entry->socket_state = socket->state;
643 			__entry->sock_state = socket->sk->sk_state;
644 			__entry->ino = (unsigned long long)inode->i_ino;
645 			__entry->error = error;
646 			__assign_str(dstaddr,
647 				xprt->address_strings[RPC_DISPLAY_ADDR]);
648 			__assign_str(dstport,
649 				xprt->address_strings[RPC_DISPLAY_PORT]);
650 		),
651 
652 		TP_printk(
653 			"error=%d socket:[%llu] dstaddr=%s/%s "
654 			"state=%u (%s) sk_state=%u (%s)",
655 			__entry->error,
656 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
657 			__entry->socket_state,
658 			rpc_show_socket_state(__entry->socket_state),
659 			__entry->sock_state,
660 			rpc_show_sock_state(__entry->sock_state)
661 		)
662 );
663 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
664 	DEFINE_EVENT(xs_socket_event_done, name, \
665 			TP_PROTO( \
666 				struct rpc_xprt *xprt, \
667 				struct socket *socket, \
668 				int error \
669 			), \
670 			TP_ARGS(xprt, socket, error))
671 
672 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
673 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
674 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
675 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
676 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
677 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
678 
679 DECLARE_EVENT_CLASS(rpc_xprt_event,
680 	TP_PROTO(
681 		const struct rpc_xprt *xprt,
682 		__be32 xid,
683 		int status
684 	),
685 
686 	TP_ARGS(xprt, xid, status),
687 
688 	TP_STRUCT__entry(
689 		__field(u32, xid)
690 		__field(int, status)
691 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
692 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
693 	),
694 
695 	TP_fast_assign(
696 		__entry->xid = be32_to_cpu(xid);
697 		__entry->status = status;
698 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
699 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
700 	),
701 
702 	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
703 			__get_str(port), __entry->xid,
704 			__entry->status)
705 );
706 #define DEFINE_RPC_XPRT_EVENT(name) \
707 	DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
708 			TP_PROTO( \
709 				const struct rpc_xprt *xprt, \
710 				__be32 xid, \
711 				int status \
712 			), \
713 			TP_ARGS(xprt, xid, status))
714 
715 DEFINE_RPC_XPRT_EVENT(timer);
716 DEFINE_RPC_XPRT_EVENT(lookup_rqst);
717 DEFINE_RPC_XPRT_EVENT(complete_rqst);
718 
719 TRACE_EVENT(xprt_transmit,
720 	TP_PROTO(
721 		const struct rpc_rqst *rqst,
722 		int status
723 	),
724 
725 	TP_ARGS(rqst, status),
726 
727 	TP_STRUCT__entry(
728 		__field(unsigned int, task_id)
729 		__field(unsigned int, client_id)
730 		__field(u32, xid)
731 		__field(u32, seqno)
732 		__field(int, status)
733 	),
734 
735 	TP_fast_assign(
736 		__entry->task_id = rqst->rq_task->tk_pid;
737 		__entry->client_id = rqst->rq_task->tk_client ?
738 			rqst->rq_task->tk_client->cl_clid : -1;
739 		__entry->xid = be32_to_cpu(rqst->rq_xid);
740 		__entry->seqno = rqst->rq_seqno;
741 		__entry->status = status;
742 	),
743 
744 	TP_printk(
745 		"task:%u@%u xid=0x%08x seqno=%u status=%d",
746 		__entry->task_id, __entry->client_id, __entry->xid,
747 		__entry->seqno, __entry->status)
748 );
749 
750 TRACE_EVENT(xprt_enq_xmit,
751 	TP_PROTO(
752 		const struct rpc_task *task,
753 		int stage
754 	),
755 
756 	TP_ARGS(task, stage),
757 
758 	TP_STRUCT__entry(
759 		__field(unsigned int, task_id)
760 		__field(unsigned int, client_id)
761 		__field(u32, xid)
762 		__field(u32, seqno)
763 		__field(int, stage)
764 	),
765 
766 	TP_fast_assign(
767 		__entry->task_id = task->tk_pid;
768 		__entry->client_id = task->tk_client ?
769 			task->tk_client->cl_clid : -1;
770 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
771 		__entry->seqno = task->tk_rqstp->rq_seqno;
772 		__entry->stage = stage;
773 	),
774 
775 	TP_printk(
776 		"task:%u@%u xid=0x%08x seqno=%u stage=%d",
777 		__entry->task_id, __entry->client_id, __entry->xid,
778 		__entry->seqno, __entry->stage)
779 );
780 
781 TRACE_EVENT(xprt_ping,
782 	TP_PROTO(const struct rpc_xprt *xprt, int status),
783 
784 	TP_ARGS(xprt, status),
785 
786 	TP_STRUCT__entry(
787 		__field(int, status)
788 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
789 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
790 	),
791 
792 	TP_fast_assign(
793 		__entry->status = status;
794 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
795 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
796 	),
797 
798 	TP_printk("peer=[%s]:%s status=%d",
799 			__get_str(addr), __get_str(port), __entry->status)
800 );
801 
802 DECLARE_EVENT_CLASS(xprt_writelock_event,
803 	TP_PROTO(
804 		const struct rpc_xprt *xprt, const struct rpc_task *task
805 	),
806 
807 	TP_ARGS(xprt, task),
808 
809 	TP_STRUCT__entry(
810 		__field(unsigned int, task_id)
811 		__field(unsigned int, client_id)
812 		__field(unsigned int, snd_task_id)
813 	),
814 
815 	TP_fast_assign(
816 		if (task) {
817 			__entry->task_id = task->tk_pid;
818 			__entry->client_id = task->tk_client ?
819 					     task->tk_client->cl_clid : -1;
820 		} else {
821 			__entry->task_id = -1;
822 			__entry->client_id = -1;
823 		}
824 		__entry->snd_task_id = xprt->snd_task ?
825 					xprt->snd_task->tk_pid : -1;
826 	),
827 
828 	TP_printk("task:%u@%u snd_task:%u",
829 			__entry->task_id, __entry->client_id,
830 			__entry->snd_task_id)
831 );
832 
833 #define DEFINE_WRITELOCK_EVENT(name) \
834 	DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
835 			TP_PROTO( \
836 				const struct rpc_xprt *xprt, \
837 				const struct rpc_task *task \
838 			), \
839 			TP_ARGS(xprt, task))
840 
841 DEFINE_WRITELOCK_EVENT(reserve_xprt);
842 DEFINE_WRITELOCK_EVENT(release_xprt);
843 
844 DECLARE_EVENT_CLASS(xprt_cong_event,
845 	TP_PROTO(
846 		const struct rpc_xprt *xprt, const struct rpc_task *task
847 	),
848 
849 	TP_ARGS(xprt, task),
850 
851 	TP_STRUCT__entry(
852 		__field(unsigned int, task_id)
853 		__field(unsigned int, client_id)
854 		__field(unsigned int, snd_task_id)
855 		__field(unsigned long, cong)
856 		__field(unsigned long, cwnd)
857 		__field(bool, wait)
858 	),
859 
860 	TP_fast_assign(
861 		if (task) {
862 			__entry->task_id = task->tk_pid;
863 			__entry->client_id = task->tk_client ?
864 					     task->tk_client->cl_clid : -1;
865 		} else {
866 			__entry->task_id = -1;
867 			__entry->client_id = -1;
868 		}
869 		__entry->snd_task_id = xprt->snd_task ?
870 					xprt->snd_task->tk_pid : -1;
871 		__entry->cong = xprt->cong;
872 		__entry->cwnd = xprt->cwnd;
873 		__entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
874 	),
875 
876 	TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s",
877 			__entry->task_id, __entry->client_id,
878 			__entry->snd_task_id, __entry->cong, __entry->cwnd,
879 			__entry->wait ? " (wait)" : "")
880 );
881 
882 #define DEFINE_CONG_EVENT(name) \
883 	DEFINE_EVENT(xprt_cong_event, xprt_##name, \
884 			TP_PROTO( \
885 				const struct rpc_xprt *xprt, \
886 				const struct rpc_task *task \
887 			), \
888 			TP_ARGS(xprt, task))
889 
890 DEFINE_CONG_EVENT(reserve_cong);
891 DEFINE_CONG_EVENT(release_cong);
892 DEFINE_CONG_EVENT(get_cong);
893 DEFINE_CONG_EVENT(put_cong);
894 
895 TRACE_EVENT(xs_stream_read_data,
896 	TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
897 
898 	TP_ARGS(xprt, err, total),
899 
900 	TP_STRUCT__entry(
901 		__field(ssize_t, err)
902 		__field(size_t, total)
903 		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
904 				"(null)")
905 		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
906 				"(null)")
907 	),
908 
909 	TP_fast_assign(
910 		__entry->err = err;
911 		__entry->total = total;
912 		__assign_str(addr, xprt ?
913 			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
914 		__assign_str(port, xprt ?
915 			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
916 	),
917 
918 	TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
919 			__get_str(port), __entry->err, __entry->total)
920 );
921 
922 TRACE_EVENT(xs_stream_read_request,
923 	TP_PROTO(struct sock_xprt *xs),
924 
925 	TP_ARGS(xs),
926 
927 	TP_STRUCT__entry(
928 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
929 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
930 		__field(u32, xid)
931 		__field(unsigned long, copied)
932 		__field(unsigned int, reclen)
933 		__field(unsigned int, offset)
934 	),
935 
936 	TP_fast_assign(
937 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
938 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
939 		__entry->xid = be32_to_cpu(xs->recv.xid);
940 		__entry->copied = xs->recv.copied;
941 		__entry->reclen = xs->recv.len;
942 		__entry->offset = xs->recv.offset;
943 	),
944 
945 	TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
946 			__get_str(addr), __get_str(port), __entry->xid,
947 			__entry->copied, __entry->reclen, __entry->offset)
948 );
949 
950 #define show_rqstp_flags(flags)						\
951 	__print_flags(flags, "|",					\
952 		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
953 		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
954 		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
955 		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
956 		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
957 		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
958 		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
959 
960 TRACE_EVENT(svc_recv,
961 	TP_PROTO(struct svc_rqst *rqst, int len),
962 
963 	TP_ARGS(rqst, len),
964 
965 	TP_STRUCT__entry(
966 		__field(u32, xid)
967 		__field(int, len)
968 		__field(unsigned long, flags)
969 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
970 	),
971 
972 	TP_fast_assign(
973 		__entry->xid = be32_to_cpu(rqst->rq_xid);
974 		__entry->len = len;
975 		__entry->flags = rqst->rq_flags;
976 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
977 	),
978 
979 	TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
980 			__get_str(addr), __entry->xid, __entry->len,
981 			show_rqstp_flags(__entry->flags))
982 );
983 
984 #define svc_show_status(status)				\
985 	__print_symbolic(status,			\
986 		{ SVC_GARBAGE,	"SVC_GARBAGE" },	\
987 		{ SVC_SYSERR,	"SVC_SYSERR" },		\
988 		{ SVC_VALID,	"SVC_VALID" },		\
989 		{ SVC_NEGATIVE,	"SVC_NEGATIVE" },	\
990 		{ SVC_OK,	"SVC_OK" },		\
991 		{ SVC_DROP,	"SVC_DROP" },		\
992 		{ SVC_CLOSE,	"SVC_CLOSE" },		\
993 		{ SVC_DENIED,	"SVC_DENIED" },		\
994 		{ SVC_PENDING,	"SVC_PENDING" },	\
995 		{ SVC_COMPLETE,	"SVC_COMPLETE" })
996 
997 TRACE_EVENT(svc_authenticate,
998 	TP_PROTO(const struct svc_rqst *rqst, int auth_res, __be32 auth_stat),
999 
1000 	TP_ARGS(rqst, auth_res, auth_stat),
1001 
1002 	TP_STRUCT__entry(
1003 		__field(u32, xid)
1004 		__field(unsigned long, svc_status)
1005 		__field(unsigned long, auth_stat)
1006 	),
1007 
1008 	TP_fast_assign(
1009 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1010 		__entry->svc_status = auth_res;
1011 		__entry->auth_stat = be32_to_cpu(auth_stat);
1012 	),
1013 
1014 	TP_printk("xid=0x%08x auth_res=%s auth_stat=%s",
1015 			__entry->xid, svc_show_status(__entry->svc_status),
1016 			rpc_show_auth_stat(__entry->auth_stat))
1017 );
1018 
1019 TRACE_EVENT(svc_process,
1020 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
1021 
1022 	TP_ARGS(rqst, name),
1023 
1024 	TP_STRUCT__entry(
1025 		__field(u32, xid)
1026 		__field(u32, vers)
1027 		__field(u32, proc)
1028 		__string(service, name)
1029 		__string(addr, rqst->rq_xprt ?
1030 			 rqst->rq_xprt->xpt_remotebuf : "(null)")
1031 	),
1032 
1033 	TP_fast_assign(
1034 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1035 		__entry->vers = rqst->rq_vers;
1036 		__entry->proc = rqst->rq_proc;
1037 		__assign_str(service, name);
1038 		__assign_str(addr, rqst->rq_xprt ?
1039 			     rqst->rq_xprt->xpt_remotebuf : "(null)");
1040 	),
1041 
1042 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
1043 			__get_str(addr), __entry->xid,
1044 			__get_str(service), __entry->vers, __entry->proc)
1045 );
1046 
1047 DECLARE_EVENT_CLASS(svc_rqst_event,
1048 
1049 	TP_PROTO(
1050 		const struct svc_rqst *rqst
1051 	),
1052 
1053 	TP_ARGS(rqst),
1054 
1055 	TP_STRUCT__entry(
1056 		__field(u32, xid)
1057 		__field(unsigned long, flags)
1058 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1059 	),
1060 
1061 	TP_fast_assign(
1062 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1063 		__entry->flags = rqst->rq_flags;
1064 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1065 	),
1066 
1067 	TP_printk("addr=%s xid=0x%08x flags=%s",
1068 			__get_str(addr), __entry->xid,
1069 			show_rqstp_flags(__entry->flags))
1070 );
1071 #define DEFINE_SVC_RQST_EVENT(name) \
1072 	DEFINE_EVENT(svc_rqst_event, svc_##name, \
1073 			TP_PROTO( \
1074 				const struct svc_rqst *rqst \
1075 			), \
1076 			TP_ARGS(rqst))
1077 
1078 DEFINE_SVC_RQST_EVENT(defer);
1079 DEFINE_SVC_RQST_EVENT(drop);
1080 
1081 DECLARE_EVENT_CLASS(svc_rqst_status,
1082 
1083 	TP_PROTO(struct svc_rqst *rqst, int status),
1084 
1085 	TP_ARGS(rqst, status),
1086 
1087 	TP_STRUCT__entry(
1088 		__field(u32, xid)
1089 		__field(int, status)
1090 		__field(unsigned long, flags)
1091 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1092 	),
1093 
1094 	TP_fast_assign(
1095 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1096 		__entry->status = status;
1097 		__entry->flags = rqst->rq_flags;
1098 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1099 	),
1100 
1101 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
1102 		  __get_str(addr), __entry->xid,
1103 		  __entry->status, show_rqstp_flags(__entry->flags))
1104 );
1105 
1106 DEFINE_EVENT(svc_rqst_status, svc_send,
1107 	TP_PROTO(struct svc_rqst *rqst, int status),
1108 	TP_ARGS(rqst, status));
1109 
1110 #define show_svc_xprt_flags(flags)					\
1111 	__print_flags(flags, "|",					\
1112 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
1113 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
1114 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
1115 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
1116 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
1117 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
1118 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
1119 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
1120 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
1121 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
1122 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
1123 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
1124 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
1125 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
1126 
1127 TRACE_EVENT(svc_xprt_do_enqueue,
1128 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
1129 
1130 	TP_ARGS(xprt, rqst),
1131 
1132 	TP_STRUCT__entry(
1133 		__field(struct svc_xprt *, xprt)
1134 		__field(int, pid)
1135 		__field(unsigned long, flags)
1136 		__string(addr, xprt->xpt_remotebuf)
1137 	),
1138 
1139 	TP_fast_assign(
1140 		__entry->xprt = xprt;
1141 		__entry->pid = rqst? rqst->rq_task->pid : 0;
1142 		__entry->flags = xprt->xpt_flags;
1143 		__assign_str(addr, xprt->xpt_remotebuf);
1144 	),
1145 
1146 	TP_printk("xprt=%p addr=%s pid=%d flags=%s",
1147 			__entry->xprt, __get_str(addr),
1148 			__entry->pid, show_svc_xprt_flags(__entry->flags))
1149 );
1150 
1151 DECLARE_EVENT_CLASS(svc_xprt_event,
1152 	TP_PROTO(struct svc_xprt *xprt),
1153 
1154 	TP_ARGS(xprt),
1155 
1156 	TP_STRUCT__entry(
1157 		__field(struct svc_xprt *, xprt)
1158 		__field(unsigned long, flags)
1159 		__string(addr, xprt->xpt_remotebuf)
1160 	),
1161 
1162 	TP_fast_assign(
1163 		__entry->xprt = xprt;
1164 		__entry->flags = xprt->xpt_flags;
1165 		__assign_str(addr, xprt->xpt_remotebuf);
1166 	),
1167 
1168 	TP_printk("xprt=%p addr=%s flags=%s",
1169 			__entry->xprt, __get_str(addr),
1170 			show_svc_xprt_flags(__entry->flags))
1171 );
1172 
1173 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
1174 	TP_PROTO(struct svc_xprt *xprt),
1175 	TP_ARGS(xprt));
1176 
1177 TRACE_EVENT(svc_xprt_dequeue,
1178 	TP_PROTO(struct svc_rqst *rqst),
1179 
1180 	TP_ARGS(rqst),
1181 
1182 	TP_STRUCT__entry(
1183 		__field(struct svc_xprt *, xprt)
1184 		__field(unsigned long, flags)
1185 		__field(unsigned long, wakeup)
1186 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1187 	),
1188 
1189 	TP_fast_assign(
1190 		__entry->xprt = rqst->rq_xprt;
1191 		__entry->flags = rqst->rq_xprt->xpt_flags;
1192 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
1193 							rqst->rq_qtime));
1194 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1195 	),
1196 
1197 	TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
1198 			__entry->xprt, __get_str(addr),
1199 			show_svc_xprt_flags(__entry->flags),
1200 			__entry->wakeup)
1201 );
1202 
1203 TRACE_EVENT(svc_wake_up,
1204 	TP_PROTO(int pid),
1205 
1206 	TP_ARGS(pid),
1207 
1208 	TP_STRUCT__entry(
1209 		__field(int, pid)
1210 	),
1211 
1212 	TP_fast_assign(
1213 		__entry->pid = pid;
1214 	),
1215 
1216 	TP_printk("pid=%d", __entry->pid)
1217 );
1218 
1219 TRACE_EVENT(svc_handle_xprt,
1220 	TP_PROTO(struct svc_xprt *xprt, int len),
1221 
1222 	TP_ARGS(xprt, len),
1223 
1224 	TP_STRUCT__entry(
1225 		__field(struct svc_xprt *, xprt)
1226 		__field(int, len)
1227 		__field(unsigned long, flags)
1228 		__string(addr, xprt->xpt_remotebuf)
1229 	),
1230 
1231 	TP_fast_assign(
1232 		__entry->xprt = xprt;
1233 		__entry->len = len;
1234 		__entry->flags = xprt->xpt_flags;
1235 		__assign_str(addr, xprt->xpt_remotebuf);
1236 	),
1237 
1238 	TP_printk("xprt=%p addr=%s len=%d flags=%s",
1239 		__entry->xprt, __get_str(addr),
1240 		__entry->len, show_svc_xprt_flags(__entry->flags))
1241 );
1242 
1243 TRACE_EVENT(svc_stats_latency,
1244 	TP_PROTO(const struct svc_rqst *rqst),
1245 
1246 	TP_ARGS(rqst),
1247 
1248 	TP_STRUCT__entry(
1249 		__field(u32, xid)
1250 		__field(unsigned long, execute)
1251 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1252 	),
1253 
1254 	TP_fast_assign(
1255 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1256 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
1257 							 rqst->rq_stime));
1258 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1259 	),
1260 
1261 	TP_printk("addr=%s xid=0x%08x execute-us=%lu",
1262 		__get_str(addr), __entry->xid, __entry->execute)
1263 );
1264 
1265 DECLARE_EVENT_CLASS(svc_deferred_event,
1266 	TP_PROTO(
1267 		const struct svc_deferred_req *dr
1268 	),
1269 
1270 	TP_ARGS(dr),
1271 
1272 	TP_STRUCT__entry(
1273 		__field(u32, xid)
1274 		__string(addr, dr->xprt->xpt_remotebuf)
1275 	),
1276 
1277 	TP_fast_assign(
1278 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
1279 						       (dr->xprt_hlen>>2)));
1280 		__assign_str(addr, dr->xprt->xpt_remotebuf);
1281 	),
1282 
1283 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
1284 );
1285 #define DEFINE_SVC_DEFERRED_EVENT(name) \
1286 	DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \
1287 			TP_PROTO( \
1288 				const struct svc_deferred_req *dr \
1289 			), \
1290 			TP_ARGS(dr))
1291 
1292 DEFINE_SVC_DEFERRED_EVENT(drop);
1293 DEFINE_SVC_DEFERRED_EVENT(revisit);
1294 
1295 #endif /* _TRACE_SUNRPC_H */
1296 
1297 #include <trace/define_trace.h>
1298