xref: /openbmc/linux/include/trace/events/sunrpc.h (revision f1575595)
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 DECLARE_EVENT_CLASS(rpc_task_status,
18 
19 	TP_PROTO(struct rpc_task *task),
20 
21 	TP_ARGS(task),
22 
23 	TP_STRUCT__entry(
24 		__field(unsigned int, task_id)
25 		__field(unsigned int, client_id)
26 		__field(int, status)
27 	),
28 
29 	TP_fast_assign(
30 		__entry->task_id = task->tk_pid;
31 		__entry->client_id = task->tk_client->cl_clid;
32 		__entry->status = task->tk_status;
33 	),
34 
35 	TP_printk("task:%u@%u status=%d",
36 		__entry->task_id, __entry->client_id,
37 		__entry->status)
38 );
39 
40 DEFINE_EVENT(rpc_task_status, rpc_call_status,
41 	TP_PROTO(struct rpc_task *task),
42 
43 	TP_ARGS(task)
44 );
45 
46 DEFINE_EVENT(rpc_task_status, rpc_bind_status,
47 	TP_PROTO(struct rpc_task *task),
48 
49 	TP_ARGS(task)
50 );
51 
52 TRACE_EVENT(rpc_connect_status,
53 	TP_PROTO(const struct rpc_task *task),
54 
55 	TP_ARGS(task),
56 
57 	TP_STRUCT__entry(
58 		__field(unsigned int, task_id)
59 		__field(unsigned int, client_id)
60 		__field(int, status)
61 	),
62 
63 	TP_fast_assign(
64 		__entry->task_id = task->tk_pid;
65 		__entry->client_id = task->tk_client->cl_clid;
66 		__entry->status = task->tk_status;
67 	),
68 
69 	TP_printk("task:%u@%u status=%d",
70 		__entry->task_id, __entry->client_id,
71 		__entry->status)
72 );
73 
74 TRACE_EVENT(rpc_request,
75 	TP_PROTO(const struct rpc_task *task),
76 
77 	TP_ARGS(task),
78 
79 	TP_STRUCT__entry(
80 		__field(unsigned int, task_id)
81 		__field(unsigned int, client_id)
82 		__field(int, version)
83 		__field(bool, async)
84 		__string(progname, task->tk_client->cl_program->name)
85 		__string(procname, rpc_proc_name(task))
86 	),
87 
88 	TP_fast_assign(
89 		__entry->task_id = task->tk_pid;
90 		__entry->client_id = task->tk_client->cl_clid;
91 		__entry->version = task->tk_client->cl_vers;
92 		__entry->async = RPC_IS_ASYNC(task);
93 		__assign_str(progname, task->tk_client->cl_program->name)
94 		__assign_str(procname, rpc_proc_name(task))
95 	),
96 
97 	TP_printk("task:%u@%u %sv%d %s (%ssync)",
98 		__entry->task_id, __entry->client_id,
99 		__get_str(progname), __entry->version,
100 		__get_str(procname), __entry->async ? "a": ""
101 		)
102 );
103 
104 DECLARE_EVENT_CLASS(rpc_task_running,
105 
106 	TP_PROTO(const struct rpc_task *task, const void *action),
107 
108 	TP_ARGS(task, action),
109 
110 	TP_STRUCT__entry(
111 		__field(unsigned int, task_id)
112 		__field(unsigned int, client_id)
113 		__field(const void *, action)
114 		__field(unsigned long, runstate)
115 		__field(int, status)
116 		__field(unsigned short, flags)
117 		),
118 
119 	TP_fast_assign(
120 		__entry->client_id = task->tk_client ?
121 				     task->tk_client->cl_clid : -1;
122 		__entry->task_id = task->tk_pid;
123 		__entry->action = action;
124 		__entry->runstate = task->tk_runstate;
125 		__entry->status = task->tk_status;
126 		__entry->flags = task->tk_flags;
127 		),
128 
129 	TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
130 		__entry->task_id, __entry->client_id,
131 		__entry->flags,
132 		__entry->runstate,
133 		__entry->status,
134 		__entry->action
135 		)
136 );
137 
138 DEFINE_EVENT(rpc_task_running, rpc_task_begin,
139 
140 	TP_PROTO(const struct rpc_task *task, const void *action),
141 
142 	TP_ARGS(task, action)
143 
144 );
145 
146 DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
147 
148 	TP_PROTO(const struct rpc_task *task, const void *action),
149 
150 	TP_ARGS(task, action)
151 
152 );
153 
154 DEFINE_EVENT(rpc_task_running, rpc_task_complete,
155 
156 	TP_PROTO(const struct rpc_task *task, const void *action),
157 
158 	TP_ARGS(task, action)
159 
160 );
161 
162 DECLARE_EVENT_CLASS(rpc_task_queued,
163 
164 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
165 
166 	TP_ARGS(task, q),
167 
168 	TP_STRUCT__entry(
169 		__field(unsigned int, task_id)
170 		__field(unsigned int, client_id)
171 		__field(unsigned long, timeout)
172 		__field(unsigned long, runstate)
173 		__field(int, status)
174 		__field(unsigned short, flags)
175 		__string(q_name, rpc_qname(q))
176 		),
177 
178 	TP_fast_assign(
179 		__entry->client_id = task->tk_client ?
180 				     task->tk_client->cl_clid : -1;
181 		__entry->task_id = task->tk_pid;
182 		__entry->timeout = task->tk_timeout;
183 		__entry->runstate = task->tk_runstate;
184 		__entry->status = task->tk_status;
185 		__entry->flags = task->tk_flags;
186 		__assign_str(q_name, rpc_qname(q));
187 		),
188 
189 	TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
190 		__entry->task_id, __entry->client_id,
191 		__entry->flags,
192 		__entry->runstate,
193 		__entry->status,
194 		__entry->timeout,
195 		__get_str(q_name)
196 		)
197 );
198 
199 DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
200 
201 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
202 
203 	TP_ARGS(task, q)
204 
205 );
206 
207 DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
208 
209 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
210 
211 	TP_ARGS(task, q)
212 
213 );
214 
215 TRACE_EVENT(rpc_stats_latency,
216 
217 	TP_PROTO(
218 		const struct rpc_task *task,
219 		ktime_t backlog,
220 		ktime_t rtt,
221 		ktime_t execute
222 	),
223 
224 	TP_ARGS(task, backlog, rtt, execute),
225 
226 	TP_STRUCT__entry(
227 		__field(unsigned int, task_id)
228 		__field(unsigned int, client_id)
229 		__field(u32, xid)
230 		__field(int, version)
231 		__string(progname, task->tk_client->cl_program->name)
232 		__string(procname, rpc_proc_name(task))
233 		__field(unsigned long, backlog)
234 		__field(unsigned long, rtt)
235 		__field(unsigned long, execute)
236 	),
237 
238 	TP_fast_assign(
239 		__entry->client_id = task->tk_client->cl_clid;
240 		__entry->task_id = task->tk_pid;
241 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
242 		__entry->version = task->tk_client->cl_vers;
243 		__assign_str(progname, task->tk_client->cl_program->name)
244 		__assign_str(procname, rpc_proc_name(task))
245 		__entry->backlog = ktime_to_us(backlog);
246 		__entry->rtt = ktime_to_us(rtt);
247 		__entry->execute = ktime_to_us(execute);
248 	),
249 
250 	TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
251 		__entry->task_id, __entry->client_id, __entry->xid,
252 		__get_str(progname), __entry->version, __get_str(procname),
253 		__entry->backlog, __entry->rtt, __entry->execute)
254 );
255 
256 /*
257  * First define the enums in the below macros to be exported to userspace
258  * via TRACE_DEFINE_ENUM().
259  */
260 #undef EM
261 #undef EMe
262 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
263 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
264 
265 #define RPC_SHOW_SOCKET				\
266 	EM( SS_FREE, "FREE" )			\
267 	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
268 	EM( SS_CONNECTING, "CONNECTING," )	\
269 	EM( SS_CONNECTED, "CONNECTED," )	\
270 	EMe(SS_DISCONNECTING, "DISCONNECTING" )
271 
272 #define rpc_show_socket_state(state) \
273 	__print_symbolic(state, RPC_SHOW_SOCKET)
274 
275 RPC_SHOW_SOCKET
276 
277 #define RPC_SHOW_SOCK				\
278 	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
279 	EM( TCP_SYN_SENT, "SYN_SENT" )		\
280 	EM( TCP_SYN_RECV, "SYN_RECV" )		\
281 	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
282 	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
283 	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
284 	EM( TCP_CLOSE, "CLOSE" )		\
285 	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
286 	EM( TCP_LAST_ACK, "LAST_ACK" )		\
287 	EM( TCP_LISTEN, "LISTEN" )		\
288 	EMe( TCP_CLOSING, "CLOSING" )
289 
290 #define rpc_show_sock_state(state) \
291 	__print_symbolic(state, RPC_SHOW_SOCK)
292 
293 RPC_SHOW_SOCK
294 
295 /*
296  * Now redefine the EM() and EMe() macros to map the enums to the strings
297  * that will be printed in the output.
298  */
299 #undef EM
300 #undef EMe
301 #define EM(a, b)	{a, b},
302 #define EMe(a, b)	{a, b}
303 
304 DECLARE_EVENT_CLASS(xs_socket_event,
305 
306 		TP_PROTO(
307 			struct rpc_xprt *xprt,
308 			struct socket *socket
309 		),
310 
311 		TP_ARGS(xprt, socket),
312 
313 		TP_STRUCT__entry(
314 			__field(unsigned int, socket_state)
315 			__field(unsigned int, sock_state)
316 			__field(unsigned long long, ino)
317 			__string(dstaddr,
318 				xprt->address_strings[RPC_DISPLAY_ADDR])
319 			__string(dstport,
320 				xprt->address_strings[RPC_DISPLAY_PORT])
321 		),
322 
323 		TP_fast_assign(
324 			struct inode *inode = SOCK_INODE(socket);
325 			__entry->socket_state = socket->state;
326 			__entry->sock_state = socket->sk->sk_state;
327 			__entry->ino = (unsigned long long)inode->i_ino;
328 			__assign_str(dstaddr,
329 				xprt->address_strings[RPC_DISPLAY_ADDR]);
330 			__assign_str(dstport,
331 				xprt->address_strings[RPC_DISPLAY_PORT]);
332 		),
333 
334 		TP_printk(
335 			"socket:[%llu] dstaddr=%s/%s "
336 			"state=%u (%s) sk_state=%u (%s)",
337 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
338 			__entry->socket_state,
339 			rpc_show_socket_state(__entry->socket_state),
340 			__entry->sock_state,
341 			rpc_show_sock_state(__entry->sock_state)
342 		)
343 );
344 #define DEFINE_RPC_SOCKET_EVENT(name) \
345 	DEFINE_EVENT(xs_socket_event, name, \
346 			TP_PROTO( \
347 				struct rpc_xprt *xprt, \
348 				struct socket *socket \
349 			), \
350 			TP_ARGS(xprt, socket))
351 
352 DECLARE_EVENT_CLASS(xs_socket_event_done,
353 
354 		TP_PROTO(
355 			struct rpc_xprt *xprt,
356 			struct socket *socket,
357 			int error
358 		),
359 
360 		TP_ARGS(xprt, socket, error),
361 
362 		TP_STRUCT__entry(
363 			__field(int, error)
364 			__field(unsigned int, socket_state)
365 			__field(unsigned int, sock_state)
366 			__field(unsigned long long, ino)
367 			__string(dstaddr,
368 				xprt->address_strings[RPC_DISPLAY_ADDR])
369 			__string(dstport,
370 				xprt->address_strings[RPC_DISPLAY_PORT])
371 		),
372 
373 		TP_fast_assign(
374 			struct inode *inode = SOCK_INODE(socket);
375 			__entry->socket_state = socket->state;
376 			__entry->sock_state = socket->sk->sk_state;
377 			__entry->ino = (unsigned long long)inode->i_ino;
378 			__entry->error = error;
379 			__assign_str(dstaddr,
380 				xprt->address_strings[RPC_DISPLAY_ADDR]);
381 			__assign_str(dstport,
382 				xprt->address_strings[RPC_DISPLAY_PORT]);
383 		),
384 
385 		TP_printk(
386 			"error=%d socket:[%llu] dstaddr=%s/%s "
387 			"state=%u (%s) sk_state=%u (%s)",
388 			__entry->error,
389 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
390 			__entry->socket_state,
391 			rpc_show_socket_state(__entry->socket_state),
392 			__entry->sock_state,
393 			rpc_show_sock_state(__entry->sock_state)
394 		)
395 );
396 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
397 	DEFINE_EVENT(xs_socket_event_done, name, \
398 			TP_PROTO( \
399 				struct rpc_xprt *xprt, \
400 				struct socket *socket, \
401 				int error \
402 			), \
403 			TP_ARGS(xprt, socket, error))
404 
405 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
406 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
407 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
408 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
409 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
410 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
411 
412 DECLARE_EVENT_CLASS(rpc_xprt_event,
413 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
414 
415 	TP_ARGS(xprt, xid, status),
416 
417 	TP_STRUCT__entry(
418 		__field(u32, xid)
419 		__field(int, status)
420 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
421 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
422 	),
423 
424 	TP_fast_assign(
425 		__entry->xid = be32_to_cpu(xid);
426 		__entry->status = status;
427 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
428 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
429 	),
430 
431 	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
432 			__get_str(port), __entry->xid,
433 			__entry->status)
434 );
435 
436 DEFINE_EVENT(rpc_xprt_event, xprt_timer,
437 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
438 	TP_ARGS(xprt, xid, status));
439 
440 DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
441 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
442 	TP_ARGS(xprt, xid, status));
443 
444 DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
445 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
446 	TP_ARGS(xprt, xid, status));
447 
448 DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
449 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
450 	TP_ARGS(xprt, xid, status));
451 
452 TRACE_EVENT(xprt_ping,
453 	TP_PROTO(const struct rpc_xprt *xprt, int status),
454 
455 	TP_ARGS(xprt, status),
456 
457 	TP_STRUCT__entry(
458 		__field(int, status)
459 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
460 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
461 	),
462 
463 	TP_fast_assign(
464 		__entry->status = status;
465 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
466 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
467 	),
468 
469 	TP_printk("peer=[%s]:%s status=%d",
470 			__get_str(addr), __get_str(port), __entry->status)
471 );
472 
473 TRACE_EVENT(xs_tcp_data_ready,
474 	TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
475 
476 	TP_ARGS(xprt, err, total),
477 
478 	TP_STRUCT__entry(
479 		__field(int, err)
480 		__field(unsigned int, total)
481 		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
482 				"(null)")
483 		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
484 				"(null)")
485 	),
486 
487 	TP_fast_assign(
488 		__entry->err = err;
489 		__entry->total = total;
490 		__assign_str(addr, xprt ?
491 			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
492 		__assign_str(port, xprt ?
493 			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
494 	),
495 
496 	TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
497 			__get_str(port), __entry->err, __entry->total)
498 );
499 
500 #define rpc_show_sock_xprt_flags(flags) \
501 	__print_flags(flags, "|", \
502 		{ TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
503 		{ TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
504 		{ TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
505 		{ TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
506 		{ TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
507 		{ TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
508 		{ TCP_RPC_REPLY, "TCP_RPC_REPLY" })
509 
510 TRACE_EVENT(xs_tcp_data_recv,
511 	TP_PROTO(struct sock_xprt *xs),
512 
513 	TP_ARGS(xs),
514 
515 	TP_STRUCT__entry(
516 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
517 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
518 		__field(u32, xid)
519 		__field(unsigned long, flags)
520 		__field(unsigned long, copied)
521 		__field(unsigned int, reclen)
522 		__field(unsigned long, offset)
523 	),
524 
525 	TP_fast_assign(
526 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
527 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
528 		__entry->xid = be32_to_cpu(xs->tcp_xid);
529 		__entry->flags = xs->tcp_flags;
530 		__entry->copied = xs->tcp_copied;
531 		__entry->reclen = xs->tcp_reclen;
532 		__entry->offset = xs->tcp_offset;
533 	),
534 
535 	TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu",
536 			__get_str(addr), __get_str(port), __entry->xid,
537 			rpc_show_sock_xprt_flags(__entry->flags),
538 			__entry->copied, __entry->reclen, __entry->offset)
539 );
540 
541 #define show_rqstp_flags(flags)						\
542 	__print_flags(flags, "|",					\
543 		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
544 		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
545 		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
546 		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
547 		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
548 		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
549 		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
550 
551 TRACE_EVENT(svc_recv,
552 	TP_PROTO(struct svc_rqst *rqst, int len),
553 
554 	TP_ARGS(rqst, len),
555 
556 	TP_STRUCT__entry(
557 		__field(u32, xid)
558 		__field(int, len)
559 		__field(unsigned long, flags)
560 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
561 	),
562 
563 	TP_fast_assign(
564 		__entry->xid = be32_to_cpu(rqst->rq_xid);
565 		__entry->len = len;
566 		__entry->flags = rqst->rq_flags;
567 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
568 	),
569 
570 	TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
571 			__get_str(addr), __entry->xid, __entry->len,
572 			show_rqstp_flags(__entry->flags))
573 );
574 
575 TRACE_EVENT(svc_process,
576 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
577 
578 	TP_ARGS(rqst, name),
579 
580 	TP_STRUCT__entry(
581 		__field(u32, xid)
582 		__field(u32, vers)
583 		__field(u32, proc)
584 		__string(service, name)
585 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
586 	),
587 
588 	TP_fast_assign(
589 		__entry->xid = be32_to_cpu(rqst->rq_xid);
590 		__entry->vers = rqst->rq_vers;
591 		__entry->proc = rqst->rq_proc;
592 		__assign_str(service, name);
593 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
594 	),
595 
596 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
597 			__get_str(addr), __entry->xid,
598 			__get_str(service), __entry->vers, __entry->proc)
599 );
600 
601 DECLARE_EVENT_CLASS(svc_rqst_event,
602 
603 	TP_PROTO(struct svc_rqst *rqst),
604 
605 	TP_ARGS(rqst),
606 
607 	TP_STRUCT__entry(
608 		__field(u32, xid)
609 		__field(unsigned long, flags)
610 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
611 	),
612 
613 	TP_fast_assign(
614 		__entry->xid = be32_to_cpu(rqst->rq_xid);
615 		__entry->flags = rqst->rq_flags;
616 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
617 	),
618 
619 	TP_printk("addr=%s xid=0x%08x flags=%s",
620 			__get_str(addr), __entry->xid,
621 			show_rqstp_flags(__entry->flags))
622 );
623 
624 DEFINE_EVENT(svc_rqst_event, svc_defer,
625 	TP_PROTO(struct svc_rqst *rqst),
626 	TP_ARGS(rqst));
627 
628 DEFINE_EVENT(svc_rqst_event, svc_drop,
629 	TP_PROTO(struct svc_rqst *rqst),
630 	TP_ARGS(rqst));
631 
632 DECLARE_EVENT_CLASS(svc_rqst_status,
633 
634 	TP_PROTO(struct svc_rqst *rqst, int status),
635 
636 	TP_ARGS(rqst, status),
637 
638 	TP_STRUCT__entry(
639 		__field(u32, xid)
640 		__field(int, status)
641 		__field(unsigned long, flags)
642 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
643 	),
644 
645 	TP_fast_assign(
646 		__entry->xid = be32_to_cpu(rqst->rq_xid);
647 		__entry->status = status;
648 		__entry->flags = rqst->rq_flags;
649 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
650 	),
651 
652 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
653 		  __get_str(addr), __entry->xid,
654 		  __entry->status, show_rqstp_flags(__entry->flags))
655 );
656 
657 DEFINE_EVENT(svc_rqst_status, svc_send,
658 	TP_PROTO(struct svc_rqst *rqst, int status),
659 	TP_ARGS(rqst, status));
660 
661 #define show_svc_xprt_flags(flags)					\
662 	__print_flags(flags, "|",					\
663 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
664 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
665 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
666 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
667 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
668 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
669 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
670 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
671 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
672 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
673 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
674 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
675 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
676 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
677 
678 TRACE_EVENT(svc_xprt_do_enqueue,
679 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
680 
681 	TP_ARGS(xprt, rqst),
682 
683 	TP_STRUCT__entry(
684 		__field(struct svc_xprt *, xprt)
685 		__field(int, pid)
686 		__field(unsigned long, flags)
687 		__string(addr, xprt->xpt_remotebuf)
688 	),
689 
690 	TP_fast_assign(
691 		__entry->xprt = xprt;
692 		__entry->pid = rqst? rqst->rq_task->pid : 0;
693 		__entry->flags = xprt->xpt_flags;
694 		__assign_str(addr, xprt->xpt_remotebuf);
695 	),
696 
697 	TP_printk("xprt=%p addr=%s pid=%d flags=%s",
698 			__entry->xprt, __get_str(addr),
699 			__entry->pid, show_svc_xprt_flags(__entry->flags))
700 );
701 
702 DECLARE_EVENT_CLASS(svc_xprt_event,
703 	TP_PROTO(struct svc_xprt *xprt),
704 
705 	TP_ARGS(xprt),
706 
707 	TP_STRUCT__entry(
708 		__field(struct svc_xprt *, xprt)
709 		__field(unsigned long, flags)
710 		__string(addr, xprt->xpt_remotebuf)
711 	),
712 
713 	TP_fast_assign(
714 		__entry->xprt = xprt;
715 		__entry->flags = xprt->xpt_flags;
716 		__assign_str(addr, xprt->xpt_remotebuf);
717 	),
718 
719 	TP_printk("xprt=%p addr=%s flags=%s",
720 			__entry->xprt, __get_str(addr),
721 			show_svc_xprt_flags(__entry->flags))
722 );
723 
724 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
725 	TP_PROTO(struct svc_xprt *xprt),
726 	TP_ARGS(xprt));
727 
728 TRACE_EVENT(svc_xprt_dequeue,
729 	TP_PROTO(struct svc_rqst *rqst),
730 
731 	TP_ARGS(rqst),
732 
733 	TP_STRUCT__entry(
734 		__field(struct svc_xprt *, xprt)
735 		__field(unsigned long, flags)
736 		__field(unsigned long, wakeup)
737 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
738 	),
739 
740 	TP_fast_assign(
741 		__entry->xprt = rqst->rq_xprt;
742 		__entry->flags = rqst->rq_xprt->xpt_flags;
743 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
744 							rqst->rq_qtime));
745 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
746 	),
747 
748 	TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
749 			__entry->xprt, __get_str(addr),
750 			show_svc_xprt_flags(__entry->flags),
751 			__entry->wakeup)
752 );
753 
754 TRACE_EVENT(svc_wake_up,
755 	TP_PROTO(int pid),
756 
757 	TP_ARGS(pid),
758 
759 	TP_STRUCT__entry(
760 		__field(int, pid)
761 	),
762 
763 	TP_fast_assign(
764 		__entry->pid = pid;
765 	),
766 
767 	TP_printk("pid=%d", __entry->pid)
768 );
769 
770 TRACE_EVENT(svc_handle_xprt,
771 	TP_PROTO(struct svc_xprt *xprt, int len),
772 
773 	TP_ARGS(xprt, len),
774 
775 	TP_STRUCT__entry(
776 		__field(struct svc_xprt *, xprt)
777 		__field(int, len)
778 		__field(unsigned long, flags)
779 		__string(addr, xprt->xpt_remotebuf)
780 	),
781 
782 	TP_fast_assign(
783 		__entry->xprt = xprt;
784 		__entry->len = len;
785 		__entry->flags = xprt->xpt_flags;
786 		__assign_str(addr, xprt->xpt_remotebuf);
787 	),
788 
789 	TP_printk("xprt=%p addr=%s len=%d flags=%s",
790 		__entry->xprt, __get_str(addr),
791 		__entry->len, show_svc_xprt_flags(__entry->flags))
792 );
793 
794 TRACE_EVENT(svc_stats_latency,
795 	TP_PROTO(const struct svc_rqst *rqst),
796 
797 	TP_ARGS(rqst),
798 
799 	TP_STRUCT__entry(
800 		__field(u32, xid)
801 		__field(unsigned long, execute)
802 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
803 	),
804 
805 	TP_fast_assign(
806 		__entry->xid = be32_to_cpu(rqst->rq_xid);
807 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
808 							 rqst->rq_stime));
809 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
810 	),
811 
812 	TP_printk("addr=%s xid=0x%08x execute-us=%lu",
813 		__get_str(addr), __entry->xid, __entry->execute)
814 );
815 
816 DECLARE_EVENT_CLASS(svc_deferred_event,
817 	TP_PROTO(struct svc_deferred_req *dr),
818 
819 	TP_ARGS(dr),
820 
821 	TP_STRUCT__entry(
822 		__field(u32, xid)
823 		__string(addr, dr->xprt->xpt_remotebuf)
824 	),
825 
826 	TP_fast_assign(
827 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
828 						       (dr->xprt_hlen>>2)));
829 		__assign_str(addr, dr->xprt->xpt_remotebuf);
830 	),
831 
832 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
833 );
834 
835 DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
836 	TP_PROTO(struct svc_deferred_req *dr),
837 	TP_ARGS(dr));
838 DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
839 	TP_PROTO(struct svc_deferred_req *dr),
840 	TP_ARGS(dr));
841 #endif /* _TRACE_SUNRPC_H */
842 
843 #include <trace/define_trace.h>
844