1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM sunrpc
5 #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_SUNRPC_H
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>
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
);
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" }) \
37 DECLARE_EVENT_CLASS(rpc_task_status,
39 TP_PROTO(const struct rpc_task
*task
),
44 __field(unsigned int, task_id
)
45 __field(unsigned int, client_id
)
50 __entry
->task_id
= task
->tk_pid
;
51 __entry
->client_id
= task
->tk_client
->cl_clid
;
52 __entry
->status
= task
->tk_status
;
55 TP_printk("task:%u@%u status=%d",
56 __entry
->task_id
, __entry
->client_id
,
59 #define DEFINE_RPC_STATUS_EVENT(name) \
60 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
62 const struct rpc_task *task \
66 DEFINE_RPC_STATUS_EVENT(call
);
67 DEFINE_RPC_STATUS_EVENT(bind
);
68 DEFINE_RPC_STATUS_EVENT(connect
);
70 TRACE_EVENT(rpc_request
,
71 TP_PROTO(const struct rpc_task
*task
),
76 __field(unsigned int, task_id
)
77 __field(unsigned int, client_id
)
80 __string(progname
, task
->tk_client
->cl_program
->name
)
81 __string(procname
, rpc_proc_name(task
))
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
))
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": ""
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
);
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" })
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
);
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" })
144 DECLARE_EVENT_CLASS(rpc_task_running
,
146 TP_PROTO(const struct rpc_task
*task
, const void *action
),
148 TP_ARGS(task
, action
),
151 __field(unsigned int, task_id
)
152 __field(unsigned int, client_id
)
153 __field(const void *, action
)
154 __field(unsigned long, runstate
)
156 __field(unsigned short, flags
)
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
;
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
),
177 #define DEFINE_RPC_RUNNING_EVENT(name) \
178 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
180 const struct rpc_task *task, \
183 TP_ARGS(task, action))
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
);
191 DECLARE_EVENT_CLASS(rpc_task_queued
,
193 TP_PROTO(const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
198 __field(unsigned int, task_id
)
199 __field(unsigned int, client_id
)
200 __field(unsigned long, timeout
)
201 __field(unsigned long, runstate
)
203 __field(unsigned short, flags
)
204 __string(q_name
, rpc_qname(q
))
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
));
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
),
227 #define DEFINE_RPC_QUEUED_EVENT(name) \
228 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
230 const struct rpc_task *task, \
231 const struct rpc_wait_queue *q \
235 DEFINE_RPC_QUEUED_EVENT(sleep
);
236 DEFINE_RPC_QUEUED_EVENT(wakeup
);
238 DECLARE_EVENT_CLASS(rpc_failure
,
240 TP_PROTO(const struct rpc_task
*task
),
245 __field(unsigned int, task_id
)
246 __field(unsigned int, client_id
)
250 __entry
->task_id
= task
->tk_pid
;
251 __entry
->client_id
= task
->tk_client
->cl_clid
;
254 TP_printk("task:%u@%u",
255 __entry
->task_id
, __entry
->client_id
)
258 #define DEFINE_RPC_FAILURE(name) \
259 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \
261 const struct rpc_task *task \
265 DEFINE_RPC_FAILURE(callhdr
);
266 DEFINE_RPC_FAILURE(verifier
);
268 DECLARE_EVENT_CLASS(rpc_reply_event
,
271 const struct rpc_task
*task
277 __field(unsigned int, task_id
)
278 __field(unsigned int, client_id
)
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
)
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
)
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
,
302 #define DEFINE_RPC_REPLY_EVENT(name) \
303 DEFINE_EVENT(rpc_reply_event, rpc__##name, \
305 const struct rpc_task *task \
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
);
319 TRACE_EVENT(rpc_stats_latency
,
322 const struct rpc_task
*task
,
328 TP_ARGS(task
, backlog
, rtt
, execute
),
331 __field(unsigned int, task_id
)
332 __field(unsigned int, client_id
)
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
)
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
);
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
)
360 TRACE_EVENT(rpc_xdr_overflow
,
362 const struct xdr_stream
*xdr
,
366 TP_ARGS(xdr
, requested
),
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
)
382 xdr
->rqst
->rq_task
->tk_client
->cl_program
->name
)
384 xdr
->rqst
->rq_task
->tk_msg
.rpc_proc
->p_name
)
389 const struct rpc_task
*task
= xdr
->rqst
->rq_task
;
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
)
398 __entry
->task_id
= 0;
399 __entry
->client_id
= 0;
400 __assign_str(progname
, "unknown")
401 __entry
->version
= 0;
402 __assign_str(procedure
, "unknown")
404 __entry
->requested
= requested
;
405 __entry
->end
= xdr
->end
;
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
;
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
,
422 __entry
->tail_base
, __entry
->tail_len
,
427 TRACE_EVENT(rpc_xdr_alignment
,
429 const struct xdr_stream
*xdr
,
434 TP_ARGS(xdr
, offset
, copied
),
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
)
449 xdr
->rqst
->rq_task
->tk_client
->cl_program
->name
)
451 xdr
->rqst
->rq_task
->tk_msg
.rpc_proc
->p_name
)
455 const struct rpc_task
*task
= xdr
->rqst
->rq_task
;
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
)
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
;
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
,
481 __entry
->tail_base
, __entry
->tail_len
,
486 TRACE_EVENT(rpc_reply_pages
,
488 const struct rpc_rqst
*req
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
)
504 __entry
->task_id
= req
->rq_task
->tk_pid
;
505 __entry
->client_id
= req
->rq_task
->tk_client
->cl_clid
;
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
;
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
,
519 __entry
->tail_base
, __entry
->tail_len
524 * First define the enums in the below macros to be exported to userspace
525 * via TRACE_DEFINE_ENUM().
529 #define EM(a, b) TRACE_DEFINE_ENUM(a);
530 #define EMe(a, b) TRACE_DEFINE_ENUM(a);
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" )
539 #define rpc_show_socket_state(state) \
540 __print_symbolic(state, RPC_SHOW_SOCKET)
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" )
557 #define rpc_show_sock_state(state) \
558 __print_symbolic(state, RPC_SHOW_SOCK)
563 * Now redefine the EM() and EMe() macros to map the enums to the strings
564 * that will be printed in the output.
568 #define EM(a, b) {a, b},
569 #define EMe(a, b) {a, b}
571 DECLARE_EVENT_CLASS(xs_socket_event
,
574 struct rpc_xprt
*xprt
,
575 struct socket
*socket
578 TP_ARGS(xprt
, socket
),
581 __field(unsigned int, socket_state
)
582 __field(unsigned int, sock_state
)
583 __field(unsigned long long, ino
)
585 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
587 xprt
->address_strings
[RPC_DISPLAY_PORT
])
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
]);
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
),
608 rpc_show_sock_state(__entry
->sock_state
)
611 #define DEFINE_RPC_SOCKET_EVENT(name) \
612 DEFINE_EVENT(xs_socket_event, name, \
614 struct rpc_xprt *xprt, \
615 struct socket *socket \
617 TP_ARGS(xprt, socket))
619 DECLARE_EVENT_CLASS(xs_socket_event_done
,
622 struct rpc_xprt
*xprt
,
623 struct socket
*socket
,
627 TP_ARGS(xprt
, socket
, error
),
631 __field(unsigned int, socket_state
)
632 __field(unsigned int, sock_state
)
633 __field(unsigned long long, ino
)
635 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
637 xprt
->address_strings
[RPC_DISPLAY_PORT
])
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
]);
653 "error=%d socket:[%llu] dstaddr=%s/%s "
654 "state=%u (%s) sk_state=%u (%s)",
656 __entry
->ino
, __get_str(dstaddr
), __get_str(dstport
),
657 __entry
->socket_state
,
658 rpc_show_socket_state(__entry
->socket_state
),
660 rpc_show_sock_state(__entry
->sock_state
)
663 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
664 DEFINE_EVENT(xs_socket_event_done, name, \
666 struct rpc_xprt *xprt, \
667 struct socket *socket, \
670 TP_ARGS(xprt, socket, error))
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
);
679 DECLARE_EVENT_CLASS(rpc_xprt_event
,
681 const struct rpc_xprt
*xprt
,
686 TP_ARGS(xprt
, xid
, status
),
691 __string(addr
, xprt
->address_strings
[RPC_DISPLAY_ADDR
])
692 __string(port
, xprt
->address_strings
[RPC_DISPLAY_PORT
])
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
]);
702 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr
),
703 __get_str(port
), __entry
->xid
,
706 #define DEFINE_RPC_XPRT_EVENT(name) \
707 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
709 const struct rpc_xprt *xprt, \
713 TP_ARGS(xprt, xid, status))
715 DEFINE_RPC_XPRT_EVENT(timer
);
716 DEFINE_RPC_XPRT_EVENT(lookup_rqst
);
717 DEFINE_RPC_XPRT_EVENT(complete_rqst
);
719 TRACE_EVENT(xprt_transmit
,
721 const struct rpc_rqst
*rqst
,
725 TP_ARGS(rqst
, status
),
728 __field(unsigned int, task_id
)
729 __field(unsigned int, client_id
)
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
;
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
)
750 TRACE_EVENT(xprt_enq_xmit
,
752 const struct rpc_task
*task
,
756 TP_ARGS(task
, stage
),
759 __field(unsigned int, task_id
)
760 __field(unsigned int, client_id
)
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
;
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
)
781 TRACE_EVENT(xprt_ping
,
782 TP_PROTO(const struct rpc_xprt
*xprt
, int status
),
784 TP_ARGS(xprt
, status
),
788 __string(addr
, xprt
->address_strings
[RPC_DISPLAY_ADDR
])
789 __string(port
, xprt
->address_strings
[RPC_DISPLAY_PORT
])
793 __entry
->status
= status
;
794 __assign_str(addr
, xprt
->address_strings
[RPC_DISPLAY_ADDR
]);
795 __assign_str(port
, xprt
->address_strings
[RPC_DISPLAY_PORT
]);
798 TP_printk("peer=[%s]:%s status=%d",
799 __get_str(addr
), __get_str(port
), __entry
->status
)
802 DECLARE_EVENT_CLASS(xprt_writelock_event
,
804 const struct rpc_xprt
*xprt
, const struct rpc_task
*task
810 __field(unsigned int, task_id
)
811 __field(unsigned int, client_id
)
812 __field(unsigned int, snd_task_id
)
817 __entry
->task_id
= task
->tk_pid
;
818 __entry
->client_id
= task
->tk_client
?
819 task
->tk_client
->cl_clid
: -1;
821 __entry
->task_id
= -1;
822 __entry
->client_id
= -1;
824 __entry
->snd_task_id
= xprt
->snd_task
?
825 xprt
->snd_task
->tk_pid
: -1;
828 TP_printk("task:%u@%u snd_task:%u",
829 __entry
->task_id
, __entry
->client_id
,
830 __entry
->snd_task_id
)
833 #define DEFINE_WRITELOCK_EVENT(name) \
834 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
836 const struct rpc_xprt *xprt, \
837 const struct rpc_task *task \
841 DEFINE_WRITELOCK_EVENT(reserve_xprt
);
842 DEFINE_WRITELOCK_EVENT(release_xprt
);
844 DECLARE_EVENT_CLASS(xprt_cong_event
,
846 const struct rpc_xprt
*xprt
, const struct rpc_task
*task
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
)
862 __entry
->task_id
= task
->tk_pid
;
863 __entry
->client_id
= task
->tk_client
?
864 task
->tk_client
->cl_clid
: -1;
866 __entry
->task_id
= -1;
867 __entry
->client_id
= -1;
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
);
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)" : "")
882 #define DEFINE_CONG_EVENT(name) \
883 DEFINE_EVENT(xprt_cong_event, xprt_##name, \
885 const struct rpc_xprt *xprt, \
886 const struct rpc_task *task \
890 DEFINE_CONG_EVENT(reserve_cong
);
891 DEFINE_CONG_EVENT(release_cong
);
892 DEFINE_CONG_EVENT(get_cong
);
893 DEFINE_CONG_EVENT(put_cong
);
895 TRACE_EVENT(xs_stream_read_data
,
896 TP_PROTO(struct rpc_xprt
*xprt
, ssize_t err
, size_t total
),
898 TP_ARGS(xprt
, err
, total
),
901 __field(ssize_t
, err
)
902 __field(size_t, total
)
903 __string(addr
, xprt
? xprt
->address_strings
[RPC_DISPLAY_ADDR
] :
905 __string(port
, xprt
? xprt
->address_strings
[RPC_DISPLAY_PORT
] :
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)");
918 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr
),
919 __get_str(port
), __entry
->err
, __entry
->total
)
922 TRACE_EVENT(xs_stream_read_request
,
923 TP_PROTO(struct sock_xprt
*xs
),
928 __string(addr
, xs
->xprt
.address_strings
[RPC_DISPLAY_ADDR
])
929 __string(port
, xs
->xprt
.address_strings
[RPC_DISPLAY_PORT
])
931 __field(unsigned long, copied
)
932 __field(unsigned int, reclen
)
933 __field(unsigned int, offset
)
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
;
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
)
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"})
960 TRACE_EVENT(svc_recv
,
961 TP_PROTO(struct svc_rqst
*rqst
, int len
),
968 __field(unsigned long, flags
)
969 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
973 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
975 __entry
->flags
= rqst
->rq_flags
;
976 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
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
))
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" })
997 TRACE_EVENT(svc_authenticate
,
998 TP_PROTO(const struct svc_rqst
*rqst
, int auth_res
, __be32 auth_stat
),
1000 TP_ARGS(rqst
, auth_res
, auth_stat
),
1004 __field(unsigned long, svc_status
)
1005 __field(unsigned long, auth_stat
)
1009 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
1010 __entry
->svc_status
= auth_res
;
1011 __entry
->auth_stat
= be32_to_cpu(auth_stat
);
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
))
1019 TRACE_EVENT(svc_process
,
1020 TP_PROTO(const struct svc_rqst
*rqst
, const char *name
),
1022 TP_ARGS(rqst
, name
),
1028 __string(service
, name
)
1029 __string(addr
, rqst
->rq_xprt
?
1030 rqst
->rq_xprt
->xpt_remotebuf
: "(null)")
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)");
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
)
1047 DECLARE_EVENT_CLASS(svc_rqst_event
,
1050 const struct svc_rqst
*rqst
1057 __field(unsigned long, flags
)
1058 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
1062 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
1063 __entry
->flags
= rqst
->rq_flags
;
1064 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
1067 TP_printk("addr=%s xid=0x%08x flags=%s",
1068 __get_str(addr
), __entry
->xid
,
1069 show_rqstp_flags(__entry
->flags
))
1071 #define DEFINE_SVC_RQST_EVENT(name) \
1072 DEFINE_EVENT(svc_rqst_event, svc_##name, \
1074 const struct svc_rqst *rqst \
1078 DEFINE_SVC_RQST_EVENT(defer
);
1079 DEFINE_SVC_RQST_EVENT(drop
);
1081 DECLARE_EVENT_CLASS(svc_rqst_status
,
1083 TP_PROTO(struct svc_rqst
*rqst
, int status
),
1085 TP_ARGS(rqst
, status
),
1089 __field(int, status
)
1090 __field(unsigned long, flags
)
1091 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
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
);
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
))
1106 DEFINE_EVENT(svc_rqst_status
, svc_send
,
1107 TP_PROTO(struct svc_rqst
*rqst
, int status
),
1108 TP_ARGS(rqst
, status
));
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"})
1127 TRACE_EVENT(svc_xprt_do_enqueue
,
1128 TP_PROTO(struct svc_xprt
*xprt
, struct svc_rqst
*rqst
),
1130 TP_ARGS(xprt
, rqst
),
1133 __field(struct svc_xprt
*, xprt
)
1135 __field(unsigned long, flags
)
1136 __string(addr
, xprt
->xpt_remotebuf
)
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
);
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
))
1151 DECLARE_EVENT_CLASS(svc_xprt_event
,
1152 TP_PROTO(struct svc_xprt
*xprt
),
1157 __field(struct svc_xprt
*, xprt
)
1158 __field(unsigned long, flags
)
1159 __string(addr
, xprt
->xpt_remotebuf
)
1163 __entry
->xprt
= xprt
;
1164 __entry
->flags
= xprt
->xpt_flags
;
1165 __assign_str(addr
, xprt
->xpt_remotebuf
);
1168 TP_printk("xprt=%p addr=%s flags=%s",
1169 __entry
->xprt
, __get_str(addr
),
1170 show_svc_xprt_flags(__entry
->flags
))
1173 DEFINE_EVENT(svc_xprt_event
, svc_xprt_no_write_space
,
1174 TP_PROTO(struct svc_xprt
*xprt
),
1177 TRACE_EVENT(svc_xprt_dequeue
,
1178 TP_PROTO(struct svc_rqst
*rqst
),
1183 __field(struct svc_xprt
*, xprt
)
1184 __field(unsigned long, flags
)
1185 __field(unsigned long, wakeup
)
1186 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
1190 __entry
->xprt
= rqst
->rq_xprt
;
1191 __entry
->flags
= rqst
->rq_xprt
->xpt_flags
;
1192 __entry
->wakeup
= ktime_to_us(ktime_sub(ktime_get(),
1194 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
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
),
1203 TRACE_EVENT(svc_wake_up
,
1216 TP_printk("pid=%d", __entry
->pid
)
1219 TRACE_EVENT(svc_handle_xprt
,
1220 TP_PROTO(struct svc_xprt
*xprt
, int len
),
1225 __field(struct svc_xprt
*, xprt
)
1227 __field(unsigned long, flags
)
1228 __string(addr
, xprt
->xpt_remotebuf
)
1232 __entry
->xprt
= xprt
;
1234 __entry
->flags
= xprt
->xpt_flags
;
1235 __assign_str(addr
, xprt
->xpt_remotebuf
);
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
))
1243 TRACE_EVENT(svc_stats_latency
,
1244 TP_PROTO(const struct svc_rqst
*rqst
),
1250 __field(unsigned long, execute
)
1251 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
1255 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
1256 __entry
->execute
= ktime_to_us(ktime_sub(ktime_get(),
1258 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
1261 TP_printk("addr=%s xid=0x%08x execute-us=%lu",
1262 __get_str(addr
), __entry
->xid
, __entry
->execute
)
1265 DECLARE_EVENT_CLASS(svc_deferred_event
,
1267 const struct svc_deferred_req
*dr
1274 __string(addr
, dr
->xprt
->xpt_remotebuf
)
1278 __entry
->xid
= be32_to_cpu(*(__be32
*)(dr
->args
+
1279 (dr
->xprt_hlen
>>2)));
1280 __assign_str(addr
, dr
->xprt
->xpt_remotebuf
);
1283 TP_printk("addr=%s xid=0x%08x", __get_str(addr
), __entry
->xid
)
1285 #define DEFINE_SVC_DEFERRED_EVENT(name) \
1286 DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \
1288 const struct svc_deferred_req *dr \
1292 DEFINE_SVC_DEFERRED_EVENT(drop
);
1293 DEFINE_SVC_DEFERRED_EVENT(revisit
);
1295 #endif /* _TRACE_SUNRPC_H */
1297 #include <trace/define_trace.h>