1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2017, 2018 Oracle. All rights reserved.
5 * Trace point definitions for the "rpcrdma" subsystem.
8 #define TRACE_SYSTEM rpcrdma
10 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_RPCRDMA_H
13 #include <linux/scatterlist.h>
14 #include <linux/tracepoint.h>
15 #include <trace/events/rdma.h>
21 DECLARE_EVENT_CLASS(xprtrdma_reply_event
,
23 const struct rpcrdma_rep
*rep
29 __field(const void *, rep
)
30 __field(const void *, r_xprt
)
38 __entry
->r_xprt
= rep
->rr_rxprt
;
39 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
40 __entry
->version
= be32_to_cpu(rep
->rr_vers
);
41 __entry
->proc
= be32_to_cpu(rep
->rr_proc
);
44 TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u",
45 __entry
->r_xprt
, __entry
->xid
, __entry
->rep
,
46 __entry
->version
, __entry
->proc
50 #define DEFINE_REPLY_EVENT(name) \
51 DEFINE_EVENT(xprtrdma_reply_event, name, \
53 const struct rpcrdma_rep *rep \
57 DECLARE_EVENT_CLASS(xprtrdma_rxprt
,
59 const struct rpcrdma_xprt
*r_xprt
65 __field(const void *, r_xprt
)
66 __string(addr
, rpcrdma_addrstr(r_xprt
))
67 __string(port
, rpcrdma_portstr(r_xprt
))
71 __entry
->r_xprt
= r_xprt
;
72 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
73 __assign_str(port
, rpcrdma_portstr(r_xprt
));
76 TP_printk("peer=[%s]:%s r_xprt=%p",
77 __get_str(addr
), __get_str(port
), __entry
->r_xprt
81 #define DEFINE_RXPRT_EVENT(name) \
82 DEFINE_EVENT(xprtrdma_rxprt, name, \
84 const struct rpcrdma_xprt *r_xprt \
88 DECLARE_EVENT_CLASS(xprtrdma_rdch_event
,
90 const struct rpc_task
*task
,
92 struct rpcrdma_mr
*mr
,
96 TP_ARGS(task
, pos
, mr
, nsegs
),
99 __field(unsigned int, task_id
)
100 __field(unsigned int, client_id
)
101 __field(unsigned int, pos
)
110 __entry
->task_id
= task
->tk_pid
;
111 __entry
->client_id
= task
->tk_client
->cl_clid
;
113 __entry
->nents
= mr
->mr_nents
;
114 __entry
->handle
= mr
->mr_handle
;
115 __entry
->length
= mr
->mr_length
;
116 __entry
->offset
= mr
->mr_offset
;
117 __entry
->nsegs
= nsegs
;
120 TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)",
121 __entry
->task_id
, __entry
->client_id
,
122 __entry
->pos
, __entry
->length
,
123 (unsigned long long)__entry
->offset
, __entry
->handle
,
124 __entry
->nents
< __entry
->nsegs
? "more" : "last"
128 #define DEFINE_RDCH_EVENT(name) \
129 DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\
131 const struct rpc_task *task, \
133 struct rpcrdma_mr *mr, \
136 TP_ARGS(task, pos, mr, nsegs))
138 DECLARE_EVENT_CLASS(xprtrdma_wrch_event
,
140 const struct rpc_task
*task
,
141 struct rpcrdma_mr
*mr
,
145 TP_ARGS(task
, mr
, nsegs
),
148 __field(unsigned int, task_id
)
149 __field(unsigned int, client_id
)
158 __entry
->task_id
= task
->tk_pid
;
159 __entry
->client_id
= task
->tk_client
->cl_clid
;
160 __entry
->nents
= mr
->mr_nents
;
161 __entry
->handle
= mr
->mr_handle
;
162 __entry
->length
= mr
->mr_length
;
163 __entry
->offset
= mr
->mr_offset
;
164 __entry
->nsegs
= nsegs
;
167 TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)",
168 __entry
->task_id
, __entry
->client_id
,
169 __entry
->length
, (unsigned long long)__entry
->offset
,
171 __entry
->nents
< __entry
->nsegs
? "more" : "last"
175 #define DEFINE_WRCH_EVENT(name) \
176 DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\
178 const struct rpc_task *task, \
179 struct rpcrdma_mr *mr, \
182 TP_ARGS(task, mr, nsegs))
184 TRACE_DEFINE_ENUM(FRWR_IS_INVALID
);
185 TRACE_DEFINE_ENUM(FRWR_IS_VALID
);
186 TRACE_DEFINE_ENUM(FRWR_FLUSHED_FR
);
187 TRACE_DEFINE_ENUM(FRWR_FLUSHED_LI
);
189 #define xprtrdma_show_frwr_state(x) \
190 __print_symbolic(x, \
191 { FRWR_IS_INVALID, "INVALID" }, \
192 { FRWR_IS_VALID, "VALID" }, \
193 { FRWR_FLUSHED_FR, "FLUSHED_FR" }, \
194 { FRWR_FLUSHED_LI, "FLUSHED_LI" })
196 DECLARE_EVENT_CLASS(xprtrdma_frwr_done
,
198 const struct ib_wc
*wc
,
199 const struct rpcrdma_frwr
*frwr
205 __field(const void *, mr
)
206 __field(unsigned int, state
)
207 __field(unsigned int, status
)
208 __field(unsigned int, vendor_err
)
212 __entry
->mr
= container_of(frwr
, struct rpcrdma_mr
, frwr
);
213 __entry
->state
= frwr
->fr_state
;
214 __entry
->status
= wc
->status
;
215 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
219 "mr=%p state=%s: %s (%u/0x%x)",
220 __entry
->mr
, xprtrdma_show_frwr_state(__entry
->state
),
221 rdma_show_wc_status(__entry
->status
),
222 __entry
->status
, __entry
->vendor_err
226 #define DEFINE_FRWR_DONE_EVENT(name) \
227 DEFINE_EVENT(xprtrdma_frwr_done, name, \
229 const struct ib_wc *wc, \
230 const struct rpcrdma_frwr *frwr \
234 TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL
);
235 TRACE_DEFINE_ENUM(DMA_TO_DEVICE
);
236 TRACE_DEFINE_ENUM(DMA_FROM_DEVICE
);
237 TRACE_DEFINE_ENUM(DMA_NONE
);
239 #define xprtrdma_show_direction(x) \
240 __print_symbolic(x, \
241 { DMA_BIDIRECTIONAL, "BIDIR" }, \
242 { DMA_TO_DEVICE, "TO_DEVICE" }, \
243 { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
244 { DMA_NONE, "NONE" })
246 DECLARE_EVENT_CLASS(xprtrdma_mr
,
248 const struct rpcrdma_mr
*mr
254 __field(const void *, mr
)
263 __entry
->handle
= mr
->mr_handle
;
264 __entry
->length
= mr
->mr_length
;
265 __entry
->offset
= mr
->mr_offset
;
266 __entry
->dir
= mr
->mr_dir
;
269 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s)",
270 __entry
->mr
, __entry
->length
,
271 (unsigned long long)__entry
->offset
, __entry
->handle
,
272 xprtrdma_show_direction(__entry
->dir
)
276 #define DEFINE_MR_EVENT(name) \
277 DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \
279 const struct rpcrdma_mr *mr \
283 DECLARE_EVENT_CLASS(xprtrdma_cb_event
,
285 const struct rpc_rqst
*rqst
291 __field(const void *, rqst
)
292 __field(const void *, rep
)
293 __field(const void *, req
)
298 __entry
->rqst
= rqst
;
299 __entry
->req
= rpcr_to_rdmar(rqst
);
300 __entry
->rep
= rpcr_to_rdmar(rqst
)->rl_reply
;
301 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
304 TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p",
305 __entry
->xid
, __entry
->rqst
, __entry
->req
, __entry
->rep
309 #define DEFINE_CB_EVENT(name) \
310 DEFINE_EVENT(xprtrdma_cb_event, name, \
312 const struct rpc_rqst *rqst \
320 TRACE_EVENT(xprtrdma_cm_event
,
322 const struct rpcrdma_xprt
*r_xprt
,
323 struct rdma_cm_event
*event
326 TP_ARGS(r_xprt
, event
),
329 __field(const void *, r_xprt
)
330 __field(unsigned int, event
)
332 __string(addr
, rpcrdma_addrstr(r_xprt
))
333 __string(port
, rpcrdma_portstr(r_xprt
))
337 __entry
->r_xprt
= r_xprt
;
338 __entry
->event
= event
->event
;
339 __entry
->status
= event
->status
;
340 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
341 __assign_str(port
, rpcrdma_portstr(r_xprt
));
344 TP_printk("peer=[%s]:%s r_xprt=%p: %s (%u/%d)",
345 __get_str(addr
), __get_str(port
),
346 __entry
->r_xprt
, rdma_show_cm_event(__entry
->event
),
347 __entry
->event
, __entry
->status
351 TRACE_EVENT(xprtrdma_disconnect
,
353 const struct rpcrdma_xprt
*r_xprt
,
357 TP_ARGS(r_xprt
, status
),
360 __field(const void *, r_xprt
)
362 __field(int, connected
)
363 __string(addr
, rpcrdma_addrstr(r_xprt
))
364 __string(port
, rpcrdma_portstr(r_xprt
))
368 __entry
->r_xprt
= r_xprt
;
369 __entry
->status
= status
;
370 __entry
->connected
= r_xprt
->rx_ep
.rep_connected
;
371 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
372 __assign_str(port
, rpcrdma_portstr(r_xprt
));
375 TP_printk("peer=[%s]:%s r_xprt=%p: status=%d %sconnected",
376 __get_str(addr
), __get_str(port
),
377 __entry
->r_xprt
, __entry
->status
,
378 __entry
->connected
== 1 ? "still " : "dis"
382 DEFINE_RXPRT_EVENT(xprtrdma_conn_start
);
383 DEFINE_RXPRT_EVENT(xprtrdma_conn_tout
);
384 DEFINE_RXPRT_EVENT(xprtrdma_create
);
385 DEFINE_RXPRT_EVENT(xprtrdma_op_destroy
);
386 DEFINE_RXPRT_EVENT(xprtrdma_remove
);
387 DEFINE_RXPRT_EVENT(xprtrdma_reinsert
);
388 DEFINE_RXPRT_EVENT(xprtrdma_reconnect
);
389 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc
);
390 DEFINE_RXPRT_EVENT(xprtrdma_op_close
);
391 DEFINE_RXPRT_EVENT(xprtrdma_op_connect
);
393 TRACE_EVENT(xprtrdma_qp_event
,
395 const struct rpcrdma_xprt
*r_xprt
,
396 const struct ib_event
*event
399 TP_ARGS(r_xprt
, event
),
402 __field(const void *, r_xprt
)
403 __field(unsigned int, event
)
404 __string(name
, event
->device
->name
)
405 __string(addr
, rpcrdma_addrstr(r_xprt
))
406 __string(port
, rpcrdma_portstr(r_xprt
))
410 __entry
->r_xprt
= r_xprt
;
411 __entry
->event
= event
->event
;
412 __assign_str(name
, event
->device
->name
);
413 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
414 __assign_str(port
, rpcrdma_portstr(r_xprt
));
417 TP_printk("peer=[%s]:%s r_xprt=%p: dev %s: %s (%u)",
418 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
419 __get_str(name
), rdma_show_ib_event(__entry
->event
),
428 TRACE_EVENT(xprtrdma_createmrs
,
430 const struct rpcrdma_xprt
*r_xprt
,
434 TP_ARGS(r_xprt
, count
),
437 __field(const void *, r_xprt
)
438 __field(unsigned int, count
)
442 __entry
->r_xprt
= r_xprt
;
443 __entry
->count
= count
;
446 TP_printk("r_xprt=%p: created %u MRs",
447 __entry
->r_xprt
, __entry
->count
451 DEFINE_RXPRT_EVENT(xprtrdma_nomrs
);
453 DEFINE_RDCH_EVENT(read
);
454 DEFINE_WRCH_EVENT(write
);
455 DEFINE_WRCH_EVENT(reply
);
457 TRACE_DEFINE_ENUM(rpcrdma_noch
);
458 TRACE_DEFINE_ENUM(rpcrdma_readch
);
459 TRACE_DEFINE_ENUM(rpcrdma_areadch
);
460 TRACE_DEFINE_ENUM(rpcrdma_writech
);
461 TRACE_DEFINE_ENUM(rpcrdma_replych
);
463 #define xprtrdma_show_chunktype(x) \
464 __print_symbolic(x, \
465 { rpcrdma_noch, "inline" }, \
466 { rpcrdma_readch, "read list" }, \
467 { rpcrdma_areadch, "*read list" }, \
468 { rpcrdma_writech, "write list" }, \
469 { rpcrdma_replych, "reply chunk" })
471 TRACE_EVENT(xprtrdma_marshal
,
473 const struct rpc_rqst
*rqst
,
479 TP_ARGS(rqst
, hdrlen
, rtype
, wtype
),
482 __field(unsigned int, task_id
)
483 __field(unsigned int, client_id
)
485 __field(unsigned int, hdrlen
)
486 __field(unsigned int, headlen
)
487 __field(unsigned int, pagelen
)
488 __field(unsigned int, taillen
)
489 __field(unsigned int, rtype
)
490 __field(unsigned int, wtype
)
494 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
495 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
496 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
497 __entry
->hdrlen
= hdrlen
;
498 __entry
->headlen
= rqst
->rq_snd_buf
.head
[0].iov_len
;
499 __entry
->pagelen
= rqst
->rq_snd_buf
.page_len
;
500 __entry
->taillen
= rqst
->rq_snd_buf
.tail
[0].iov_len
;
501 __entry
->rtype
= rtype
;
502 __entry
->wtype
= wtype
;
505 TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s",
506 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
508 __entry
->headlen
, __entry
->pagelen
, __entry
->taillen
,
509 xprtrdma_show_chunktype(__entry
->rtype
),
510 xprtrdma_show_chunktype(__entry
->wtype
)
514 TRACE_EVENT(xprtrdma_post_send
,
516 const struct rpcrdma_req
*req
,
520 TP_ARGS(req
, status
),
523 __field(const void *, req
)
524 __field(unsigned int, task_id
)
525 __field(unsigned int, client_id
)
526 __field(int, num_sge
)
527 __field(int, signaled
)
532 const struct rpc_rqst
*rqst
= &req
->rl_slot
;
534 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
535 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
537 __entry
->num_sge
= req
->rl_sendctx
->sc_wr
.num_sge
;
538 __entry
->signaled
= req
->rl_sendctx
->sc_wr
.send_flags
&
540 __entry
->status
= status
;
543 TP_printk("task:%u@%u req=%p (%d SGE%s) %sstatus=%d",
544 __entry
->task_id
, __entry
->client_id
,
545 __entry
->req
, __entry
->num_sge
,
546 (__entry
->num_sge
== 1 ? "" : "s"),
547 (__entry
->signaled
? "signaled " : ""),
552 TRACE_EVENT(xprtrdma_post_recv
,
554 const struct ib_cqe
*cqe
560 __field(const void *, cqe
)
572 TRACE_EVENT(xprtrdma_post_recvs
,
574 const struct rpcrdma_xprt
*r_xprt
,
579 TP_ARGS(r_xprt
, count
, status
),
582 __field(const void *, r_xprt
)
583 __field(unsigned int, count
)
586 __string(addr
, rpcrdma_addrstr(r_xprt
))
587 __string(port
, rpcrdma_portstr(r_xprt
))
591 __entry
->r_xprt
= r_xprt
;
592 __entry
->count
= count
;
593 __entry
->status
= status
;
594 __entry
->posted
= r_xprt
->rx_ep
.rep_receive_count
;
595 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
596 __assign_str(port
, rpcrdma_portstr(r_xprt
));
599 TP_printk("peer=[%s]:%s r_xprt=%p: %u new recvs, %d active (rc %d)",
600 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
601 __entry
->count
, __entry
->posted
, __entry
->status
609 TRACE_EVENT(xprtrdma_wc_send
,
611 const struct rpcrdma_sendctx
*sc
,
612 const struct ib_wc
*wc
618 __field(const void *, req
)
619 __field(unsigned int, unmap_count
)
620 __field(unsigned int, status
)
621 __field(unsigned int, vendor_err
)
625 __entry
->req
= sc
->sc_req
;
626 __entry
->unmap_count
= sc
->sc_unmap_count
;
627 __entry
->status
= wc
->status
;
628 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
631 TP_printk("req=%p, unmapped %u pages: %s (%u/0x%x)",
632 __entry
->req
, __entry
->unmap_count
,
633 rdma_show_wc_status(__entry
->status
),
634 __entry
->status
, __entry
->vendor_err
638 TRACE_EVENT(xprtrdma_wc_receive
,
640 const struct ib_wc
*wc
646 __field(const void *, cqe
)
647 __field(u32
, byte_len
)
648 __field(unsigned int, status
)
649 __field(u32
, vendor_err
)
653 __entry
->cqe
= wc
->wr_cqe
;
654 __entry
->status
= wc
->status
;
656 __entry
->byte_len
= 0;
657 __entry
->vendor_err
= wc
->vendor_err
;
659 __entry
->byte_len
= wc
->byte_len
;
660 __entry
->vendor_err
= 0;
664 TP_printk("cqe=%p %u bytes: %s (%u/0x%x)",
665 __entry
->cqe
, __entry
->byte_len
,
666 rdma_show_wc_status(__entry
->status
),
667 __entry
->status
, __entry
->vendor_err
671 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg
);
672 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li
);
673 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake
);
675 TRACE_EVENT(xprtrdma_frwr_alloc
,
677 const struct rpcrdma_mr
*mr
,
684 __field(const void *, mr
)
693 TP_printk("mr=%p: rc=%d",
694 __entry
->mr
, __entry
->rc
698 TRACE_EVENT(xprtrdma_frwr_dereg
,
700 const struct rpcrdma_mr
*mr
,
707 __field(const void *, mr
)
717 __entry
->handle
= mr
->mr_handle
;
718 __entry
->length
= mr
->mr_length
;
719 __entry
->offset
= mr
->mr_offset
;
720 __entry
->dir
= mr
->mr_dir
;
724 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s): rc=%d",
725 __entry
->mr
, __entry
->length
,
726 (unsigned long long)__entry
->offset
, __entry
->handle
,
727 xprtrdma_show_direction(__entry
->dir
),
732 TRACE_EVENT(xprtrdma_frwr_sgerr
,
734 const struct rpcrdma_mr
*mr
,
738 TP_ARGS(mr
, sg_nents
),
741 __field(const void *, mr
)
749 __entry
->addr
= mr
->mr_sg
->dma_address
;
750 __entry
->dir
= mr
->mr_dir
;
751 __entry
->nents
= sg_nents
;
754 TP_printk("mr=%p dma addr=0x%llx (%s) sg_nents=%d",
755 __entry
->mr
, __entry
->addr
,
756 xprtrdma_show_direction(__entry
->dir
),
761 TRACE_EVENT(xprtrdma_frwr_maperr
,
763 const struct rpcrdma_mr
*mr
,
767 TP_ARGS(mr
, num_mapped
),
770 __field(const void *, mr
)
773 __field(int, num_mapped
)
779 __entry
->addr
= mr
->mr_sg
->dma_address
;
780 __entry
->dir
= mr
->mr_dir
;
781 __entry
->num_mapped
= num_mapped
;
782 __entry
->nents
= mr
->mr_nents
;
785 TP_printk("mr=%p dma addr=0x%llx (%s) nents=%d of %d",
786 __entry
->mr
, __entry
->addr
,
787 xprtrdma_show_direction(__entry
->dir
),
788 __entry
->num_mapped
, __entry
->nents
792 DEFINE_MR_EVENT(localinv
);
793 DEFINE_MR_EVENT(map
);
794 DEFINE_MR_EVENT(unmap
);
795 DEFINE_MR_EVENT(remoteinv
);
796 DEFINE_MR_EVENT(recycle
);
798 TRACE_EVENT(xprtrdma_dma_maperr
,
810 __entry
->addr
= addr
;
813 TP_printk("dma addr=0x%llx\n", __entry
->addr
)
820 TRACE_EVENT(xprtrdma_reply
,
822 const struct rpc_task
*task
,
823 const struct rpcrdma_rep
*rep
,
824 const struct rpcrdma_req
*req
,
828 TP_ARGS(task
, rep
, req
, credits
),
831 __field(unsigned int, task_id
)
832 __field(unsigned int, client_id
)
833 __field(const void *, rep
)
834 __field(const void *, req
)
836 __field(unsigned int, credits
)
840 __entry
->task_id
= task
->tk_pid
;
841 __entry
->client_id
= task
->tk_client
->cl_clid
;
844 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
845 __entry
->credits
= credits
;
848 TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p",
849 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
850 __entry
->credits
, __entry
->rep
, __entry
->req
854 TRACE_EVENT(xprtrdma_defer_cmp
,
856 const struct rpcrdma_rep
*rep
862 __field(unsigned int, task_id
)
863 __field(unsigned int, client_id
)
864 __field(const void *, rep
)
869 __entry
->task_id
= rep
->rr_rqst
->rq_task
->tk_pid
;
870 __entry
->client_id
= rep
->rr_rqst
->rq_task
->tk_client
->cl_clid
;
872 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
875 TP_printk("task:%u@%u xid=0x%08x rep=%p",
876 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
881 DEFINE_REPLY_EVENT(xprtrdma_reply_vers
);
882 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst
);
883 DEFINE_REPLY_EVENT(xprtrdma_reply_short
);
884 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr
);
886 TRACE_EVENT(xprtrdma_fixup
,
888 const struct rpc_rqst
*rqst
,
893 TP_ARGS(rqst
, len
, hdrlen
),
896 __field(unsigned int, task_id
)
897 __field(unsigned int, client_id
)
898 __field(const void *, base
)
904 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
905 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
906 __entry
->base
= rqst
->rq_rcv_buf
.head
[0].iov_base
;
908 __entry
->hdrlen
= hdrlen
;
911 TP_printk("task:%u@%u base=%p len=%d hdrlen=%d",
912 __entry
->task_id
, __entry
->client_id
,
913 __entry
->base
, __entry
->len
, __entry
->hdrlen
917 TRACE_EVENT(xprtrdma_fixup_pg
,
919 const struct rpc_rqst
*rqst
,
926 TP_ARGS(rqst
, pageno
, pos
, len
, curlen
),
929 __field(unsigned int, task_id
)
930 __field(unsigned int, client_id
)
931 __field(const void *, pos
)
938 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
939 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
941 __entry
->pageno
= pageno
;
943 __entry
->curlen
= curlen
;
946 TP_printk("task:%u@%u pageno=%d pos=%p len=%d curlen=%d",
947 __entry
->task_id
, __entry
->client_id
,
948 __entry
->pageno
, __entry
->pos
, __entry
->len
, __entry
->curlen
952 TRACE_EVENT(xprtrdma_decode_seg
,
959 TP_ARGS(handle
, length
, offset
),
968 __entry
->handle
= handle
;
969 __entry
->length
= length
;
970 __entry
->offset
= offset
;
973 TP_printk("%u@0x%016llx:0x%08x",
974 __entry
->length
, (unsigned long long)__entry
->offset
,
980 ** Allocation/release of rpcrdma_reqs and rpcrdma_reps
983 TRACE_EVENT(xprtrdma_op_allocate
,
985 const struct rpc_task
*task
,
986 const struct rpcrdma_req
*req
992 __field(unsigned int, task_id
)
993 __field(unsigned int, client_id
)
994 __field(const void *, req
)
995 __field(size_t, callsize
)
996 __field(size_t, rcvsize
)
1000 __entry
->task_id
= task
->tk_pid
;
1001 __entry
->client_id
= task
->tk_client
->cl_clid
;
1003 __entry
->callsize
= task
->tk_rqstp
->rq_callsize
;
1004 __entry
->rcvsize
= task
->tk_rqstp
->rq_rcvsize
;
1007 TP_printk("task:%u@%u req=%p (%zu, %zu)",
1008 __entry
->task_id
, __entry
->client_id
,
1009 __entry
->req
, __entry
->callsize
, __entry
->rcvsize
1013 TRACE_EVENT(xprtrdma_op_free
,
1015 const struct rpc_task
*task
,
1016 const struct rpcrdma_req
*req
1022 __field(unsigned int, task_id
)
1023 __field(unsigned int, client_id
)
1024 __field(const void *, req
)
1025 __field(const void *, rep
)
1029 __entry
->task_id
= task
->tk_pid
;
1030 __entry
->client_id
= task
->tk_client
->cl_clid
;
1032 __entry
->rep
= req
->rl_reply
;
1035 TP_printk("task:%u@%u req=%p rep=%p",
1036 __entry
->task_id
, __entry
->client_id
,
1037 __entry
->req
, __entry
->rep
1045 TRACE_EVENT(xprtrdma_cb_setup
,
1047 const struct rpcrdma_xprt
*r_xprt
,
1051 TP_ARGS(r_xprt
, reqs
),
1054 __field(const void *, r_xprt
)
1055 __field(unsigned int, reqs
)
1056 __string(addr
, rpcrdma_addrstr(r_xprt
))
1057 __string(port
, rpcrdma_portstr(r_xprt
))
1061 __entry
->r_xprt
= r_xprt
;
1062 __entry
->reqs
= reqs
;
1063 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
1064 __assign_str(port
, rpcrdma_portstr(r_xprt
));
1067 TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs",
1068 __get_str(addr
), __get_str(port
),
1069 __entry
->r_xprt
, __entry
->reqs
1073 DEFINE_CB_EVENT(xprtrdma_cb_call
);
1074 DEFINE_CB_EVENT(xprtrdma_cb_reply
);
1076 TRACE_EVENT(xprtrdma_leaked_rep
,
1078 const struct rpc_rqst
*rqst
,
1079 const struct rpcrdma_rep
*rep
1085 __field(unsigned int, task_id
)
1086 __field(unsigned int, client_id
)
1088 __field(const void *, rep
)
1092 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
1093 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
1094 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
1098 TP_printk("task:%u@%u xid=0x%08x rep=%p",
1099 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
1105 ** Server-side RPC/RDMA events
1108 DECLARE_EVENT_CLASS(svcrdma_xprt_event
,
1110 const struct svc_xprt
*xprt
1116 __field(const void *, xprt
)
1117 __string(addr
, xprt
->xpt_remotebuf
)
1121 __entry
->xprt
= xprt
;
1122 __assign_str(addr
, xprt
->xpt_remotebuf
);
1125 TP_printk("xprt=%p addr=%s",
1126 __entry
->xprt
, __get_str(addr
)
1130 #define DEFINE_XPRT_EVENT(name) \
1131 DEFINE_EVENT(svcrdma_xprt_event, svcrdma_xprt_##name, \
1133 const struct svc_xprt *xprt \
1137 DEFINE_XPRT_EVENT(accept
);
1138 DEFINE_XPRT_EVENT(fail
);
1139 DEFINE_XPRT_EVENT(free
);
1141 TRACE_DEFINE_ENUM(RDMA_MSG
);
1142 TRACE_DEFINE_ENUM(RDMA_NOMSG
);
1143 TRACE_DEFINE_ENUM(RDMA_MSGP
);
1144 TRACE_DEFINE_ENUM(RDMA_DONE
);
1145 TRACE_DEFINE_ENUM(RDMA_ERROR
);
1147 #define show_rpcrdma_proc(x) \
1148 __print_symbolic(x, \
1149 { RDMA_MSG, "RDMA_MSG" }, \
1150 { RDMA_NOMSG, "RDMA_NOMSG" }, \
1151 { RDMA_MSGP, "RDMA_MSGP" }, \
1152 { RDMA_DONE, "RDMA_DONE" }, \
1153 { RDMA_ERROR, "RDMA_ERROR" })
1155 TRACE_EVENT(svcrdma_decode_rqst
,
1167 __field(u32
, credits
)
1168 __field(unsigned int, hdrlen
)
1172 __entry
->xid
= be32_to_cpup(p
++);
1173 __entry
->vers
= be32_to_cpup(p
++);
1174 __entry
->credits
= be32_to_cpup(p
++);
1175 __entry
->proc
= be32_to_cpup(p
);
1176 __entry
->hdrlen
= hdrlen
;
1179 TP_printk("xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u",
1180 __entry
->xid
, __entry
->vers
, __entry
->credits
,
1181 show_rpcrdma_proc(__entry
->proc
), __entry
->hdrlen
)
1184 TRACE_EVENT(svcrdma_decode_short
,
1192 __field(unsigned int, hdrlen
)
1196 __entry
->hdrlen
= hdrlen
;
1199 TP_printk("hdrlen=%u", __entry
->hdrlen
)
1202 DECLARE_EVENT_CLASS(svcrdma_badreq_event
,
1213 __field(u32
, credits
)
1217 __entry
->xid
= be32_to_cpup(p
++);
1218 __entry
->vers
= be32_to_cpup(p
++);
1219 __entry
->credits
= be32_to_cpup(p
++);
1220 __entry
->proc
= be32_to_cpup(p
);
1223 TP_printk("xid=0x%08x vers=%u credits=%u proc=%u",
1224 __entry
->xid
, __entry
->vers
, __entry
->credits
, __entry
->proc
)
1227 #define DEFINE_BADREQ_EVENT(name) \
1228 DEFINE_EVENT(svcrdma_badreq_event, svcrdma_decode_##name,\
1234 DEFINE_BADREQ_EVENT(badvers
);
1235 DEFINE_BADREQ_EVENT(drop
);
1236 DEFINE_BADREQ_EVENT(badproc
);
1237 DEFINE_BADREQ_EVENT(parse
);
1239 DECLARE_EVENT_CLASS(svcrdma_segment_event
,
1246 TP_ARGS(handle
, length
, offset
),
1249 __field(u32
, handle
)
1250 __field(u32
, length
)
1251 __field(u64
, offset
)
1255 __entry
->handle
= handle
;
1256 __entry
->length
= length
;
1257 __entry
->offset
= offset
;
1260 TP_printk("%u@0x%016llx:0x%08x",
1261 __entry
->length
, (unsigned long long)__entry
->offset
,
1266 #define DEFINE_SEGMENT_EVENT(name) \
1267 DEFINE_EVENT(svcrdma_segment_event, svcrdma_encode_##name,\
1273 TP_ARGS(handle, length, offset))
1275 DEFINE_SEGMENT_EVENT(rseg
);
1276 DEFINE_SEGMENT_EVENT(wseg
);
1278 DECLARE_EVENT_CLASS(svcrdma_chunk_event
,
1286 __field(u32
, length
)
1290 __entry
->length
= length
;
1293 TP_printk("length=%u",
1298 #define DEFINE_CHUNK_EVENT(name) \
1299 DEFINE_EVENT(svcrdma_chunk_event, svcrdma_encode_##name,\
1305 DEFINE_CHUNK_EVENT(pzr
);
1306 DEFINE_CHUNK_EVENT(write
);
1307 DEFINE_CHUNK_EVENT(reply
);
1309 TRACE_EVENT(svcrdma_encode_read
,
1315 TP_ARGS(length
, position
),
1318 __field(u32
, length
)
1319 __field(u32
, position
)
1323 __entry
->length
= length
;
1324 __entry
->position
= position
;
1327 TP_printk("length=%u position=%u",
1328 __entry
->length
, __entry
->position
1332 DECLARE_EVENT_CLASS(svcrdma_error_event
,
1344 __entry
->xid
= be32_to_cpu(xid
);
1347 TP_printk("xid=0x%08x",
1352 #define DEFINE_ERROR_EVENT(name) \
1353 DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name, \
1359 DEFINE_ERROR_EVENT(vers
);
1360 DEFINE_ERROR_EVENT(chunk
);
1363 ** Server-side RDMA API events
1366 TRACE_EVENT(svcrdma_dma_map_page
,
1368 const struct svcxprt_rdma
*rdma
,
1372 TP_ARGS(rdma
, page
),
1375 __field(const void *, page
);
1376 __string(device
, rdma
->sc_cm_id
->device
->name
)
1377 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1381 __entry
->page
= page
;
1382 __assign_str(device
, rdma
->sc_cm_id
->device
->name
);
1383 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1386 TP_printk("addr=%s device=%s page=%p",
1387 __get_str(addr
), __get_str(device
), __entry
->page
1391 TRACE_EVENT(svcrdma_dma_map_rwctx
,
1393 const struct svcxprt_rdma
*rdma
,
1397 TP_ARGS(rdma
, status
),
1400 __field(int, status
)
1401 __string(device
, rdma
->sc_cm_id
->device
->name
)
1402 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1406 __entry
->status
= status
;
1407 __assign_str(device
, rdma
->sc_cm_id
->device
->name
);
1408 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1411 TP_printk("addr=%s device=%s status=%d",
1412 __get_str(addr
), __get_str(device
), __entry
->status
1416 TRACE_EVENT(svcrdma_send_failed
,
1418 const struct svc_rqst
*rqst
,
1422 TP_ARGS(rqst
, status
),
1425 __field(int, status
)
1427 __field(const void *, xprt
)
1428 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
1432 __entry
->status
= status
;
1433 __entry
->xid
= __be32_to_cpu(rqst
->rq_xid
);
1434 __entry
->xprt
= rqst
->rq_xprt
;
1435 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
1438 TP_printk("xprt=%p addr=%s xid=0x%08x status=%d",
1439 __entry
->xprt
, __get_str(addr
),
1440 __entry
->xid
, __entry
->status
1444 DECLARE_EVENT_CLASS(svcrdma_sendcomp_event
,
1446 const struct ib_wc
*wc
1452 __field(const void *, cqe
)
1453 __field(unsigned int, status
)
1454 __field(unsigned int, vendor_err
)
1458 __entry
->cqe
= wc
->wr_cqe
;
1459 __entry
->status
= wc
->status
;
1461 __entry
->vendor_err
= wc
->vendor_err
;
1463 __entry
->vendor_err
= 0;
1466 TP_printk("cqe=%p status=%s (%u/0x%x)",
1467 __entry
->cqe
, rdma_show_wc_status(__entry
->status
),
1468 __entry
->status
, __entry
->vendor_err
1472 #define DEFINE_SENDCOMP_EVENT(name) \
1473 DEFINE_EVENT(svcrdma_sendcomp_event, svcrdma_wc_##name, \
1475 const struct ib_wc *wc \
1479 TRACE_EVENT(svcrdma_post_send
,
1481 const struct ib_send_wr
*wr
,
1485 TP_ARGS(wr
, status
),
1488 __field(const void *, cqe
)
1489 __field(unsigned int, num_sge
)
1490 __field(u32
, inv_rkey
)
1491 __field(int, status
)
1495 __entry
->cqe
= wr
->wr_cqe
;
1496 __entry
->num_sge
= wr
->num_sge
;
1497 __entry
->inv_rkey
= (wr
->opcode
== IB_WR_SEND_WITH_INV
) ?
1498 wr
->ex
.invalidate_rkey
: 0;
1499 __entry
->status
= status
;
1502 TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x status=%d",
1503 __entry
->cqe
, __entry
->num_sge
,
1504 __entry
->inv_rkey
, __entry
->status
1508 DEFINE_SENDCOMP_EVENT(send
);
1510 TRACE_EVENT(svcrdma_post_recv
,
1512 const struct ib_recv_wr
*wr
,
1516 TP_ARGS(wr
, status
),
1519 __field(const void *, cqe
)
1520 __field(int, status
)
1524 __entry
->cqe
= wr
->wr_cqe
;
1525 __entry
->status
= status
;
1528 TP_printk("cqe=%p status=%d",
1529 __entry
->cqe
, __entry
->status
1533 TRACE_EVENT(svcrdma_wc_receive
,
1535 const struct ib_wc
*wc
1541 __field(const void *, cqe
)
1542 __field(u32
, byte_len
)
1543 __field(unsigned int, status
)
1544 __field(u32
, vendor_err
)
1548 __entry
->cqe
= wc
->wr_cqe
;
1549 __entry
->status
= wc
->status
;
1551 __entry
->byte_len
= 0;
1552 __entry
->vendor_err
= wc
->vendor_err
;
1554 __entry
->byte_len
= wc
->byte_len
;
1555 __entry
->vendor_err
= 0;
1559 TP_printk("cqe=%p byte_len=%u status=%s (%u/0x%x)",
1560 __entry
->cqe
, __entry
->byte_len
,
1561 rdma_show_wc_status(__entry
->status
),
1562 __entry
->status
, __entry
->vendor_err
1566 TRACE_EVENT(svcrdma_post_rw
,
1573 TP_ARGS(cqe
, sqecount
, status
),
1576 __field(const void *, cqe
)
1577 __field(int, sqecount
)
1578 __field(int, status
)
1583 __entry
->sqecount
= sqecount
;
1584 __entry
->status
= status
;
1587 TP_printk("cqe=%p sqecount=%d status=%d",
1588 __entry
->cqe
, __entry
->sqecount
, __entry
->status
1592 DEFINE_SENDCOMP_EVENT(read
);
1593 DEFINE_SENDCOMP_EVENT(write
);
1595 TRACE_EVENT(svcrdma_cm_event
,
1597 const struct rdma_cm_event
*event
,
1598 const struct sockaddr
*sap
1601 TP_ARGS(event
, sap
),
1604 __field(unsigned int, event
)
1605 __field(int, status
)
1606 __array(__u8
, addr
, INET6_ADDRSTRLEN
+ 10)
1610 __entry
->event
= event
->event
;
1611 __entry
->status
= event
->status
;
1612 snprintf(__entry
->addr
, sizeof(__entry
->addr
) - 1,
1616 TP_printk("addr=%s event=%s (%u/%d)",
1618 rdma_show_cm_event(__entry
->event
),
1619 __entry
->event
, __entry
->status
1623 TRACE_EVENT(svcrdma_qp_error
,
1625 const struct ib_event
*event
,
1626 const struct sockaddr
*sap
1629 TP_ARGS(event
, sap
),
1632 __field(unsigned int, event
)
1633 __string(device
, event
->device
->name
)
1634 __array(__u8
, addr
, INET6_ADDRSTRLEN
+ 10)
1638 __entry
->event
= event
->event
;
1639 __assign_str(device
, event
->device
->name
);
1640 snprintf(__entry
->addr
, sizeof(__entry
->addr
) - 1,
1644 TP_printk("addr=%s dev=%s event=%s (%u)",
1645 __entry
->addr
, __get_str(device
),
1646 rdma_show_ib_event(__entry
->event
), __entry
->event
1650 DECLARE_EVENT_CLASS(svcrdma_sendqueue_event
,
1652 const struct svcxprt_rdma
*rdma
1660 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1664 __entry
->avail
= atomic_read(&rdma
->sc_sq_avail
);
1665 __entry
->depth
= rdma
->sc_sq_depth
;
1666 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1669 TP_printk("addr=%s sc_sq_avail=%d/%d",
1670 __get_str(addr
), __entry
->avail
, __entry
->depth
1674 #define DEFINE_SQ_EVENT(name) \
1675 DEFINE_EVENT(svcrdma_sendqueue_event, svcrdma_sq_##name,\
1677 const struct svcxprt_rdma *rdma \
1681 DEFINE_SQ_EVENT(full
);
1682 DEFINE_SQ_EVENT(retry
);
1684 #endif /* _TRACE_RPCRDMA_H */
1686 #include <trace/define_trace.h>