xref: /openbmc/linux/include/trace/events/sunrpc.h (revision d4295e12)
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_stream_read_data,
474 	TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
475 
476 	TP_ARGS(xprt, err, total),
477 
478 	TP_STRUCT__entry(
479 		__field(ssize_t, err)
480 		__field(size_t, 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=%zd total=%zu", __get_str(addr),
497 			__get_str(port), __entry->err, __entry->total)
498 );
499 
500 TRACE_EVENT(xs_stream_read_request,
501 	TP_PROTO(struct sock_xprt *xs),
502 
503 	TP_ARGS(xs),
504 
505 	TP_STRUCT__entry(
506 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
507 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
508 		__field(u32, xid)
509 		__field(unsigned long, copied)
510 		__field(unsigned int, reclen)
511 		__field(unsigned int, offset)
512 	),
513 
514 	TP_fast_assign(
515 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
516 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
517 		__entry->xid = be32_to_cpu(xs->recv.xid);
518 		__entry->copied = xs->recv.copied;
519 		__entry->reclen = xs->recv.len;
520 		__entry->offset = xs->recv.offset;
521 	),
522 
523 	TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
524 			__get_str(addr), __get_str(port), __entry->xid,
525 			__entry->copied, __entry->reclen, __entry->offset)
526 );
527 
528 #define show_rqstp_flags(flags)						\
529 	__print_flags(flags, "|",					\
530 		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
531 		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
532 		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
533 		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
534 		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
535 		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
536 		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
537 
538 TRACE_EVENT(svc_recv,
539 	TP_PROTO(struct svc_rqst *rqst, int len),
540 
541 	TP_ARGS(rqst, len),
542 
543 	TP_STRUCT__entry(
544 		__field(u32, xid)
545 		__field(int, len)
546 		__field(unsigned long, flags)
547 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
548 	),
549 
550 	TP_fast_assign(
551 		__entry->xid = be32_to_cpu(rqst->rq_xid);
552 		__entry->len = len;
553 		__entry->flags = rqst->rq_flags;
554 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
555 	),
556 
557 	TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
558 			__get_str(addr), __entry->xid, __entry->len,
559 			show_rqstp_flags(__entry->flags))
560 );
561 
562 TRACE_EVENT(svc_process,
563 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
564 
565 	TP_ARGS(rqst, name),
566 
567 	TP_STRUCT__entry(
568 		__field(u32, xid)
569 		__field(u32, vers)
570 		__field(u32, proc)
571 		__string(service, name)
572 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
573 	),
574 
575 	TP_fast_assign(
576 		__entry->xid = be32_to_cpu(rqst->rq_xid);
577 		__entry->vers = rqst->rq_vers;
578 		__entry->proc = rqst->rq_proc;
579 		__assign_str(service, name);
580 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
581 	),
582 
583 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
584 			__get_str(addr), __entry->xid,
585 			__get_str(service), __entry->vers, __entry->proc)
586 );
587 
588 DECLARE_EVENT_CLASS(svc_rqst_event,
589 
590 	TP_PROTO(struct svc_rqst *rqst),
591 
592 	TP_ARGS(rqst),
593 
594 	TP_STRUCT__entry(
595 		__field(u32, xid)
596 		__field(unsigned long, flags)
597 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
598 	),
599 
600 	TP_fast_assign(
601 		__entry->xid = be32_to_cpu(rqst->rq_xid);
602 		__entry->flags = rqst->rq_flags;
603 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
604 	),
605 
606 	TP_printk("addr=%s xid=0x%08x flags=%s",
607 			__get_str(addr), __entry->xid,
608 			show_rqstp_flags(__entry->flags))
609 );
610 
611 DEFINE_EVENT(svc_rqst_event, svc_defer,
612 	TP_PROTO(struct svc_rqst *rqst),
613 	TP_ARGS(rqst));
614 
615 DEFINE_EVENT(svc_rqst_event, svc_drop,
616 	TP_PROTO(struct svc_rqst *rqst),
617 	TP_ARGS(rqst));
618 
619 DECLARE_EVENT_CLASS(svc_rqst_status,
620 
621 	TP_PROTO(struct svc_rqst *rqst, int status),
622 
623 	TP_ARGS(rqst, status),
624 
625 	TP_STRUCT__entry(
626 		__field(u32, xid)
627 		__field(int, status)
628 		__field(unsigned long, flags)
629 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
630 	),
631 
632 	TP_fast_assign(
633 		__entry->xid = be32_to_cpu(rqst->rq_xid);
634 		__entry->status = status;
635 		__entry->flags = rqst->rq_flags;
636 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
637 	),
638 
639 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
640 		  __get_str(addr), __entry->xid,
641 		  __entry->status, show_rqstp_flags(__entry->flags))
642 );
643 
644 DEFINE_EVENT(svc_rqst_status, svc_send,
645 	TP_PROTO(struct svc_rqst *rqst, int status),
646 	TP_ARGS(rqst, status));
647 
648 #define show_svc_xprt_flags(flags)					\
649 	__print_flags(flags, "|",					\
650 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
651 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
652 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
653 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
654 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
655 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
656 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
657 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
658 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
659 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
660 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
661 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
662 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
663 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
664 
665 TRACE_EVENT(svc_xprt_do_enqueue,
666 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
667 
668 	TP_ARGS(xprt, rqst),
669 
670 	TP_STRUCT__entry(
671 		__field(struct svc_xprt *, xprt)
672 		__field(int, pid)
673 		__field(unsigned long, flags)
674 		__string(addr, xprt->xpt_remotebuf)
675 	),
676 
677 	TP_fast_assign(
678 		__entry->xprt = xprt;
679 		__entry->pid = rqst? rqst->rq_task->pid : 0;
680 		__entry->flags = xprt->xpt_flags;
681 		__assign_str(addr, xprt->xpt_remotebuf);
682 	),
683 
684 	TP_printk("xprt=%p addr=%s pid=%d flags=%s",
685 			__entry->xprt, __get_str(addr),
686 			__entry->pid, show_svc_xprt_flags(__entry->flags))
687 );
688 
689 DECLARE_EVENT_CLASS(svc_xprt_event,
690 	TP_PROTO(struct svc_xprt *xprt),
691 
692 	TP_ARGS(xprt),
693 
694 	TP_STRUCT__entry(
695 		__field(struct svc_xprt *, xprt)
696 		__field(unsigned long, flags)
697 		__string(addr, xprt->xpt_remotebuf)
698 	),
699 
700 	TP_fast_assign(
701 		__entry->xprt = xprt;
702 		__entry->flags = xprt->xpt_flags;
703 		__assign_str(addr, xprt->xpt_remotebuf);
704 	),
705 
706 	TP_printk("xprt=%p addr=%s flags=%s",
707 			__entry->xprt, __get_str(addr),
708 			show_svc_xprt_flags(__entry->flags))
709 );
710 
711 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
712 	TP_PROTO(struct svc_xprt *xprt),
713 	TP_ARGS(xprt));
714 
715 TRACE_EVENT(svc_xprt_dequeue,
716 	TP_PROTO(struct svc_rqst *rqst),
717 
718 	TP_ARGS(rqst),
719 
720 	TP_STRUCT__entry(
721 		__field(struct svc_xprt *, xprt)
722 		__field(unsigned long, flags)
723 		__field(unsigned long, wakeup)
724 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
725 	),
726 
727 	TP_fast_assign(
728 		__entry->xprt = rqst->rq_xprt;
729 		__entry->flags = rqst->rq_xprt->xpt_flags;
730 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
731 							rqst->rq_qtime));
732 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
733 	),
734 
735 	TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
736 			__entry->xprt, __get_str(addr),
737 			show_svc_xprt_flags(__entry->flags),
738 			__entry->wakeup)
739 );
740 
741 TRACE_EVENT(svc_wake_up,
742 	TP_PROTO(int pid),
743 
744 	TP_ARGS(pid),
745 
746 	TP_STRUCT__entry(
747 		__field(int, pid)
748 	),
749 
750 	TP_fast_assign(
751 		__entry->pid = pid;
752 	),
753 
754 	TP_printk("pid=%d", __entry->pid)
755 );
756 
757 TRACE_EVENT(svc_handle_xprt,
758 	TP_PROTO(struct svc_xprt *xprt, int len),
759 
760 	TP_ARGS(xprt, len),
761 
762 	TP_STRUCT__entry(
763 		__field(struct svc_xprt *, xprt)
764 		__field(int, len)
765 		__field(unsigned long, flags)
766 		__string(addr, xprt->xpt_remotebuf)
767 	),
768 
769 	TP_fast_assign(
770 		__entry->xprt = xprt;
771 		__entry->len = len;
772 		__entry->flags = xprt->xpt_flags;
773 		__assign_str(addr, xprt->xpt_remotebuf);
774 	),
775 
776 	TP_printk("xprt=%p addr=%s len=%d flags=%s",
777 		__entry->xprt, __get_str(addr),
778 		__entry->len, show_svc_xprt_flags(__entry->flags))
779 );
780 
781 TRACE_EVENT(svc_stats_latency,
782 	TP_PROTO(const struct svc_rqst *rqst),
783 
784 	TP_ARGS(rqst),
785 
786 	TP_STRUCT__entry(
787 		__field(u32, xid)
788 		__field(unsigned long, execute)
789 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
790 	),
791 
792 	TP_fast_assign(
793 		__entry->xid = be32_to_cpu(rqst->rq_xid);
794 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
795 							 rqst->rq_stime));
796 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
797 	),
798 
799 	TP_printk("addr=%s xid=0x%08x execute-us=%lu",
800 		__get_str(addr), __entry->xid, __entry->execute)
801 );
802 
803 DECLARE_EVENT_CLASS(svc_deferred_event,
804 	TP_PROTO(struct svc_deferred_req *dr),
805 
806 	TP_ARGS(dr),
807 
808 	TP_STRUCT__entry(
809 		__field(u32, xid)
810 		__string(addr, dr->xprt->xpt_remotebuf)
811 	),
812 
813 	TP_fast_assign(
814 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
815 						       (dr->xprt_hlen>>2)));
816 		__assign_str(addr, dr->xprt->xpt_remotebuf);
817 	),
818 
819 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
820 );
821 
822 DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
823 	TP_PROTO(struct svc_deferred_req *dr),
824 	TP_ARGS(dr));
825 DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
826 	TP_PROTO(struct svc_deferred_req *dr),
827 	TP_ARGS(dr));
828 #endif /* _TRACE_SUNRPC_H */
829 
830 #include <trace/define_trace.h>
831