xref: /openbmc/linux/include/trace/events/sunrpc.h (revision bdeeed09)
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(u32, xid)
228 		__field(int, version)
229 		__string(progname, task->tk_client->cl_program->name)
230 		__string(procname, rpc_proc_name(task))
231 		__field(unsigned long, backlog)
232 		__field(unsigned long, rtt)
233 		__field(unsigned long, execute)
234 		__string(addr,
235 			 task->tk_xprt->address_strings[RPC_DISPLAY_ADDR])
236 		__string(port,
237 			 task->tk_xprt->address_strings[RPC_DISPLAY_PORT])
238 	),
239 
240 	TP_fast_assign(
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 		__assign_str(addr,
249 			     task->tk_xprt->address_strings[RPC_DISPLAY_ADDR]);
250 		__assign_str(port,
251 			     task->tk_xprt->address_strings[RPC_DISPLAY_PORT]);
252 	),
253 
254 	TP_printk("peer=[%s]:%s xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
255 		__get_str(addr), __get_str(port), __entry->xid,
256 		__get_str(progname), __entry->version, __get_str(procname),
257 		__entry->backlog, __entry->rtt, __entry->execute)
258 );
259 
260 /*
261  * First define the enums in the below macros to be exported to userspace
262  * via TRACE_DEFINE_ENUM().
263  */
264 #undef EM
265 #undef EMe
266 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
267 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
268 
269 #define RPC_SHOW_SOCKET				\
270 	EM( SS_FREE, "FREE" )			\
271 	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
272 	EM( SS_CONNECTING, "CONNECTING," )	\
273 	EM( SS_CONNECTED, "CONNECTED," )	\
274 	EMe(SS_DISCONNECTING, "DISCONNECTING" )
275 
276 #define rpc_show_socket_state(state) \
277 	__print_symbolic(state, RPC_SHOW_SOCKET)
278 
279 RPC_SHOW_SOCKET
280 
281 #define RPC_SHOW_SOCK				\
282 	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
283 	EM( TCP_SYN_SENT, "SYN_SENT" )		\
284 	EM( TCP_SYN_RECV, "SYN_RECV" )		\
285 	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
286 	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
287 	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
288 	EM( TCP_CLOSE, "CLOSE" )		\
289 	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
290 	EM( TCP_LAST_ACK, "LAST_ACK" )		\
291 	EM( TCP_LISTEN, "LISTEN" )		\
292 	EMe( TCP_CLOSING, "CLOSING" )
293 
294 #define rpc_show_sock_state(state) \
295 	__print_symbolic(state, RPC_SHOW_SOCK)
296 
297 RPC_SHOW_SOCK
298 
299 /*
300  * Now redefine the EM() and EMe() macros to map the enums to the strings
301  * that will be printed in the output.
302  */
303 #undef EM
304 #undef EMe
305 #define EM(a, b)	{a, b},
306 #define EMe(a, b)	{a, b}
307 
308 DECLARE_EVENT_CLASS(xs_socket_event,
309 
310 		TP_PROTO(
311 			struct rpc_xprt *xprt,
312 			struct socket *socket
313 		),
314 
315 		TP_ARGS(xprt, socket),
316 
317 		TP_STRUCT__entry(
318 			__field(unsigned int, socket_state)
319 			__field(unsigned int, sock_state)
320 			__field(unsigned long long, ino)
321 			__string(dstaddr,
322 				xprt->address_strings[RPC_DISPLAY_ADDR])
323 			__string(dstport,
324 				xprt->address_strings[RPC_DISPLAY_PORT])
325 		),
326 
327 		TP_fast_assign(
328 			struct inode *inode = SOCK_INODE(socket);
329 			__entry->socket_state = socket->state;
330 			__entry->sock_state = socket->sk->sk_state;
331 			__entry->ino = (unsigned long long)inode->i_ino;
332 			__assign_str(dstaddr,
333 				xprt->address_strings[RPC_DISPLAY_ADDR]);
334 			__assign_str(dstport,
335 				xprt->address_strings[RPC_DISPLAY_PORT]);
336 		),
337 
338 		TP_printk(
339 			"socket:[%llu] dstaddr=%s/%s "
340 			"state=%u (%s) sk_state=%u (%s)",
341 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
342 			__entry->socket_state,
343 			rpc_show_socket_state(__entry->socket_state),
344 			__entry->sock_state,
345 			rpc_show_sock_state(__entry->sock_state)
346 		)
347 );
348 #define DEFINE_RPC_SOCKET_EVENT(name) \
349 	DEFINE_EVENT(xs_socket_event, name, \
350 			TP_PROTO( \
351 				struct rpc_xprt *xprt, \
352 				struct socket *socket \
353 			), \
354 			TP_ARGS(xprt, socket))
355 
356 DECLARE_EVENT_CLASS(xs_socket_event_done,
357 
358 		TP_PROTO(
359 			struct rpc_xprt *xprt,
360 			struct socket *socket,
361 			int error
362 		),
363 
364 		TP_ARGS(xprt, socket, error),
365 
366 		TP_STRUCT__entry(
367 			__field(int, error)
368 			__field(unsigned int, socket_state)
369 			__field(unsigned int, sock_state)
370 			__field(unsigned long long, ino)
371 			__string(dstaddr,
372 				xprt->address_strings[RPC_DISPLAY_ADDR])
373 			__string(dstport,
374 				xprt->address_strings[RPC_DISPLAY_PORT])
375 		),
376 
377 		TP_fast_assign(
378 			struct inode *inode = SOCK_INODE(socket);
379 			__entry->socket_state = socket->state;
380 			__entry->sock_state = socket->sk->sk_state;
381 			__entry->ino = (unsigned long long)inode->i_ino;
382 			__entry->error = error;
383 			__assign_str(dstaddr,
384 				xprt->address_strings[RPC_DISPLAY_ADDR]);
385 			__assign_str(dstport,
386 				xprt->address_strings[RPC_DISPLAY_PORT]);
387 		),
388 
389 		TP_printk(
390 			"error=%d socket:[%llu] dstaddr=%s/%s "
391 			"state=%u (%s) sk_state=%u (%s)",
392 			__entry->error,
393 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
394 			__entry->socket_state,
395 			rpc_show_socket_state(__entry->socket_state),
396 			__entry->sock_state,
397 			rpc_show_sock_state(__entry->sock_state)
398 		)
399 );
400 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
401 	DEFINE_EVENT(xs_socket_event_done, name, \
402 			TP_PROTO( \
403 				struct rpc_xprt *xprt, \
404 				struct socket *socket, \
405 				int error \
406 			), \
407 			TP_ARGS(xprt, socket, error))
408 
409 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
410 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
411 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
412 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
413 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
414 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
415 
416 DECLARE_EVENT_CLASS(rpc_xprt_event,
417 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
418 
419 	TP_ARGS(xprt, xid, status),
420 
421 	TP_STRUCT__entry(
422 		__field(u32, xid)
423 		__field(int, status)
424 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
425 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
426 	),
427 
428 	TP_fast_assign(
429 		__entry->xid = be32_to_cpu(xid);
430 		__entry->status = status;
431 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
432 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
433 	),
434 
435 	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
436 			__get_str(port), __entry->xid,
437 			__entry->status)
438 );
439 
440 DEFINE_EVENT(rpc_xprt_event, xprt_timer,
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_lookup_rqst,
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_transmit,
449 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
450 	TP_ARGS(xprt, xid, status));
451 
452 DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
453 	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
454 	TP_ARGS(xprt, xid, status));
455 
456 TRACE_EVENT(xprt_ping,
457 	TP_PROTO(const struct rpc_xprt *xprt, int status),
458 
459 	TP_ARGS(xprt, status),
460 
461 	TP_STRUCT__entry(
462 		__field(int, status)
463 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
464 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
465 	),
466 
467 	TP_fast_assign(
468 		__entry->status = status;
469 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
470 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
471 	),
472 
473 	TP_printk("peer=[%s]:%s status=%d",
474 			__get_str(addr), __get_str(port), __entry->status)
475 );
476 
477 TRACE_EVENT(xs_tcp_data_ready,
478 	TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
479 
480 	TP_ARGS(xprt, err, total),
481 
482 	TP_STRUCT__entry(
483 		__field(int, err)
484 		__field(unsigned int, total)
485 		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
486 				"(null)")
487 		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
488 				"(null)")
489 	),
490 
491 	TP_fast_assign(
492 		__entry->err = err;
493 		__entry->total = total;
494 		__assign_str(addr, xprt ?
495 			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
496 		__assign_str(port, xprt ?
497 			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
498 	),
499 
500 	TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
501 			__get_str(port), __entry->err, __entry->total)
502 );
503 
504 #define rpc_show_sock_xprt_flags(flags) \
505 	__print_flags(flags, "|", \
506 		{ TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
507 		{ TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
508 		{ TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
509 		{ TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
510 		{ TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
511 		{ TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
512 		{ TCP_RPC_REPLY, "TCP_RPC_REPLY" })
513 
514 TRACE_EVENT(xs_tcp_data_recv,
515 	TP_PROTO(struct sock_xprt *xs),
516 
517 	TP_ARGS(xs),
518 
519 	TP_STRUCT__entry(
520 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
521 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
522 		__field(u32, xid)
523 		__field(unsigned long, flags)
524 		__field(unsigned long, copied)
525 		__field(unsigned int, reclen)
526 		__field(unsigned long, offset)
527 	),
528 
529 	TP_fast_assign(
530 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
531 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
532 		__entry->xid = be32_to_cpu(xs->tcp_xid);
533 		__entry->flags = xs->tcp_flags;
534 		__entry->copied = xs->tcp_copied;
535 		__entry->reclen = xs->tcp_reclen;
536 		__entry->offset = xs->tcp_offset;
537 	),
538 
539 	TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu",
540 			__get_str(addr), __get_str(port), __entry->xid,
541 			rpc_show_sock_xprt_flags(__entry->flags),
542 			__entry->copied, __entry->reclen, __entry->offset)
543 );
544 
545 #define show_rqstp_flags(flags)						\
546 	__print_flags(flags, "|",					\
547 		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
548 		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
549 		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
550 		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
551 		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
552 		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
553 		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
554 
555 TRACE_EVENT(svc_recv,
556 	TP_PROTO(struct svc_rqst *rqst, int len),
557 
558 	TP_ARGS(rqst, len),
559 
560 	TP_STRUCT__entry(
561 		__field(u32, xid)
562 		__field(int, len)
563 		__field(unsigned long, flags)
564 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
565 	),
566 
567 	TP_fast_assign(
568 		__entry->xid = be32_to_cpu(rqst->rq_xid);
569 		__entry->len = len;
570 		__entry->flags = rqst->rq_flags;
571 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
572 	),
573 
574 	TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
575 			__get_str(addr), __entry->xid, __entry->len,
576 			show_rqstp_flags(__entry->flags))
577 );
578 
579 TRACE_EVENT(svc_process,
580 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
581 
582 	TP_ARGS(rqst, name),
583 
584 	TP_STRUCT__entry(
585 		__field(u32, xid)
586 		__field(u32, vers)
587 		__field(u32, proc)
588 		__string(service, name)
589 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
590 	),
591 
592 	TP_fast_assign(
593 		__entry->xid = be32_to_cpu(rqst->rq_xid);
594 		__entry->vers = rqst->rq_vers;
595 		__entry->proc = rqst->rq_proc;
596 		__assign_str(service, name);
597 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
598 	),
599 
600 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
601 			__get_str(addr), __entry->xid,
602 			__get_str(service), __entry->vers, __entry->proc)
603 );
604 
605 DECLARE_EVENT_CLASS(svc_rqst_event,
606 
607 	TP_PROTO(struct svc_rqst *rqst),
608 
609 	TP_ARGS(rqst),
610 
611 	TP_STRUCT__entry(
612 		__field(u32, xid)
613 		__field(unsigned long, flags)
614 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
615 	),
616 
617 	TP_fast_assign(
618 		__entry->xid = be32_to_cpu(rqst->rq_xid);
619 		__entry->flags = rqst->rq_flags;
620 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
621 	),
622 
623 	TP_printk("addr=%s xid=0x%08x flags=%s",
624 			__get_str(addr), __entry->xid,
625 			show_rqstp_flags(__entry->flags))
626 );
627 
628 DEFINE_EVENT(svc_rqst_event, svc_defer,
629 	TP_PROTO(struct svc_rqst *rqst),
630 	TP_ARGS(rqst));
631 
632 DEFINE_EVENT(svc_rqst_event, svc_drop,
633 	TP_PROTO(struct svc_rqst *rqst),
634 	TP_ARGS(rqst));
635 
636 DECLARE_EVENT_CLASS(svc_rqst_status,
637 
638 	TP_PROTO(struct svc_rqst *rqst, int status),
639 
640 	TP_ARGS(rqst, status),
641 
642 	TP_STRUCT__entry(
643 		__field(u32, xid)
644 		__field(int, status)
645 		__field(unsigned long, flags)
646 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
647 	),
648 
649 	TP_fast_assign(
650 		__entry->xid = be32_to_cpu(rqst->rq_xid);
651 		__entry->status = status;
652 		__entry->flags = rqst->rq_flags;
653 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
654 	),
655 
656 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
657 		  __get_str(addr), __entry->xid,
658 		  __entry->status, show_rqstp_flags(__entry->flags))
659 );
660 
661 DEFINE_EVENT(svc_rqst_status, svc_send,
662 	TP_PROTO(struct svc_rqst *rqst, int status),
663 	TP_ARGS(rqst, status));
664 
665 #define show_svc_xprt_flags(flags)					\
666 	__print_flags(flags, "|",					\
667 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
668 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
669 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
670 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
671 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
672 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
673 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
674 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
675 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
676 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
677 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
678 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
679 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
680 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
681 
682 TRACE_EVENT(svc_xprt_do_enqueue,
683 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
684 
685 	TP_ARGS(xprt, rqst),
686 
687 	TP_STRUCT__entry(
688 		__field(struct svc_xprt *, xprt)
689 		__field(int, pid)
690 		__field(unsigned long, flags)
691 		__string(addr, xprt->xpt_remotebuf)
692 	),
693 
694 	TP_fast_assign(
695 		__entry->xprt = xprt;
696 		__entry->pid = rqst? rqst->rq_task->pid : 0;
697 		__entry->flags = xprt->xpt_flags;
698 		__assign_str(addr, xprt->xpt_remotebuf);
699 	),
700 
701 	TP_printk("xprt=%p addr=%s pid=%d flags=%s",
702 			__entry->xprt, __get_str(addr),
703 			__entry->pid, show_svc_xprt_flags(__entry->flags))
704 );
705 
706 DECLARE_EVENT_CLASS(svc_xprt_event,
707 	TP_PROTO(struct svc_xprt *xprt),
708 
709 	TP_ARGS(xprt),
710 
711 	TP_STRUCT__entry(
712 		__field(struct svc_xprt *, xprt)
713 		__field(unsigned long, flags)
714 		__string(addr, xprt->xpt_remotebuf)
715 	),
716 
717 	TP_fast_assign(
718 		__entry->xprt = xprt;
719 		__entry->flags = xprt->xpt_flags;
720 		__assign_str(addr, xprt->xpt_remotebuf);
721 	),
722 
723 	TP_printk("xprt=%p addr=%s flags=%s",
724 			__entry->xprt, __get_str(addr),
725 			show_svc_xprt_flags(__entry->flags))
726 );
727 
728 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
729 	TP_PROTO(struct svc_xprt *xprt),
730 	TP_ARGS(xprt));
731 
732 TRACE_EVENT(svc_xprt_dequeue,
733 	TP_PROTO(struct svc_rqst *rqst),
734 
735 	TP_ARGS(rqst),
736 
737 	TP_STRUCT__entry(
738 		__field(struct svc_xprt *, xprt)
739 		__field(unsigned long, flags)
740 		__field(unsigned long, wakeup)
741 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
742 	),
743 
744 	TP_fast_assign(
745 		__entry->xprt = rqst->rq_xprt;
746 		__entry->flags = rqst->rq_xprt->xpt_flags;
747 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
748 							rqst->rq_qtime));
749 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
750 	),
751 
752 	TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
753 			__entry->xprt, __get_str(addr),
754 			show_svc_xprt_flags(__entry->flags),
755 			__entry->wakeup)
756 );
757 
758 TRACE_EVENT(svc_wake_up,
759 	TP_PROTO(int pid),
760 
761 	TP_ARGS(pid),
762 
763 	TP_STRUCT__entry(
764 		__field(int, pid)
765 	),
766 
767 	TP_fast_assign(
768 		__entry->pid = pid;
769 	),
770 
771 	TP_printk("pid=%d", __entry->pid)
772 );
773 
774 TRACE_EVENT(svc_handle_xprt,
775 	TP_PROTO(struct svc_xprt *xprt, int len),
776 
777 	TP_ARGS(xprt, len),
778 
779 	TP_STRUCT__entry(
780 		__field(struct svc_xprt *, xprt)
781 		__field(int, len)
782 		__field(unsigned long, flags)
783 		__string(addr, xprt->xpt_remotebuf)
784 	),
785 
786 	TP_fast_assign(
787 		__entry->xprt = xprt;
788 		__entry->len = len;
789 		__entry->flags = xprt->xpt_flags;
790 		__assign_str(addr, xprt->xpt_remotebuf);
791 	),
792 
793 	TP_printk("xprt=%p addr=%s len=%d flags=%s",
794 		__entry->xprt, __get_str(addr),
795 		__entry->len, show_svc_xprt_flags(__entry->flags))
796 );
797 
798 TRACE_EVENT(svc_stats_latency,
799 	TP_PROTO(const struct svc_rqst *rqst),
800 
801 	TP_ARGS(rqst),
802 
803 	TP_STRUCT__entry(
804 		__field(u32, xid)
805 		__field(unsigned long, execute)
806 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
807 	),
808 
809 	TP_fast_assign(
810 		__entry->xid = be32_to_cpu(rqst->rq_xid);
811 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
812 							 rqst->rq_stime));
813 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
814 	),
815 
816 	TP_printk("addr=%s xid=0x%08x execute-us=%lu",
817 		__get_str(addr), __entry->xid, __entry->execute)
818 );
819 
820 DECLARE_EVENT_CLASS(svc_deferred_event,
821 	TP_PROTO(struct svc_deferred_req *dr),
822 
823 	TP_ARGS(dr),
824 
825 	TP_STRUCT__entry(
826 		__field(u32, xid)
827 		__string(addr, dr->xprt->xpt_remotebuf)
828 	),
829 
830 	TP_fast_assign(
831 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
832 						       (dr->xprt_hlen>>2)));
833 		__assign_str(addr, dr->xprt->xpt_remotebuf);
834 	),
835 
836 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
837 );
838 
839 DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
840 	TP_PROTO(struct svc_deferred_req *dr),
841 	TP_ARGS(dr));
842 DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
843 	TP_PROTO(struct svc_deferred_req *dr),
844 	TP_ARGS(dr));
845 #endif /* _TRACE_SUNRPC_H */
846 
847 #include <trace/define_trace.h>
848