1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2017 Oracle. All rights reserved.
6 #define TRACE_SYSTEM rpcrdma
8 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_RPCRDMA_H
11 #include <linux/tracepoint.h>
12 #include <trace/events/rdma.h>
18 DECLARE_EVENT_CLASS(xprtrdma_reply_event
,
20 const struct rpcrdma_rep
*rep
26 __field(const void *, rep
)
27 __field(const void *, r_xprt
)
35 __entry
->r_xprt
= rep
->rr_rxprt
;
36 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
37 __entry
->version
= be32_to_cpu(rep
->rr_vers
);
38 __entry
->proc
= be32_to_cpu(rep
->rr_proc
);
41 TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u",
42 __entry
->r_xprt
, __entry
->xid
, __entry
->rep
,
43 __entry
->version
, __entry
->proc
47 #define DEFINE_REPLY_EVENT(name) \
48 DEFINE_EVENT(xprtrdma_reply_event, name, \
50 const struct rpcrdma_rep *rep \
54 DECLARE_EVENT_CLASS(xprtrdma_rxprt
,
56 const struct rpcrdma_xprt
*r_xprt
62 __field(const void *, r_xprt
)
63 __string(addr
, rpcrdma_addrstr(r_xprt
))
64 __string(port
, rpcrdma_portstr(r_xprt
))
68 __entry
->r_xprt
= r_xprt
;
69 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
70 __assign_str(port
, rpcrdma_portstr(r_xprt
));
73 TP_printk("peer=[%s]:%s r_xprt=%p",
74 __get_str(addr
), __get_str(port
), __entry
->r_xprt
78 #define DEFINE_RXPRT_EVENT(name) \
79 DEFINE_EVENT(xprtrdma_rxprt, name, \
81 const struct rpcrdma_xprt *r_xprt \
85 DECLARE_EVENT_CLASS(xprtrdma_rdch_event
,
87 const struct rpc_task
*task
,
89 struct rpcrdma_mr
*mr
,
93 TP_ARGS(task
, pos
, mr
, nsegs
),
96 __field(unsigned int, task_id
)
97 __field(unsigned int, client_id
)
98 __field(const void *, mr
)
99 __field(unsigned int, pos
)
108 __entry
->task_id
= task
->tk_pid
;
109 __entry
->client_id
= task
->tk_client
->cl_clid
;
112 __entry
->nents
= mr
->mr_nents
;
113 __entry
->handle
= mr
->mr_handle
;
114 __entry
->length
= mr
->mr_length
;
115 __entry
->offset
= mr
->mr_offset
;
116 __entry
->nsegs
= nsegs
;
119 TP_printk("task:%u@%u mr=%p pos=%u %u@0x%016llx:0x%08x (%s)",
120 __entry
->task_id
, __entry
->client_id
, __entry
->mr
,
121 __entry
->pos
, __entry
->length
,
122 (unsigned long long)__entry
->offset
, __entry
->handle
,
123 __entry
->nents
< __entry
->nsegs
? "more" : "last"
127 #define DEFINE_RDCH_EVENT(name) \
128 DEFINE_EVENT(xprtrdma_rdch_event, name, \
130 const struct rpc_task *task, \
132 struct rpcrdma_mr *mr, \
135 TP_ARGS(task, pos, mr, nsegs))
137 DECLARE_EVENT_CLASS(xprtrdma_wrch_event
,
139 const struct rpc_task
*task
,
140 struct rpcrdma_mr
*mr
,
144 TP_ARGS(task
, mr
, nsegs
),
147 __field(unsigned int, task_id
)
148 __field(unsigned int, client_id
)
149 __field(const void *, mr
)
158 __entry
->task_id
= task
->tk_pid
;
159 __entry
->client_id
= task
->tk_client
->cl_clid
;
161 __entry
->nents
= mr
->mr_nents
;
162 __entry
->handle
= mr
->mr_handle
;
163 __entry
->length
= mr
->mr_length
;
164 __entry
->offset
= mr
->mr_offset
;
165 __entry
->nsegs
= nsegs
;
168 TP_printk("task:%u@%u mr=%p %u@0x%016llx:0x%08x (%s)",
169 __entry
->task_id
, __entry
->client_id
, __entry
->mr
,
170 __entry
->length
, (unsigned long long)__entry
->offset
,
172 __entry
->nents
< __entry
->nsegs
? "more" : "last"
176 #define DEFINE_WRCH_EVENT(name) \
177 DEFINE_EVENT(xprtrdma_wrch_event, name, \
179 const struct rpc_task *task, \
180 struct rpcrdma_mr *mr, \
183 TP_ARGS(task, mr, nsegs))
185 TRACE_DEFINE_ENUM(FRWR_IS_INVALID
);
186 TRACE_DEFINE_ENUM(FRWR_IS_VALID
);
187 TRACE_DEFINE_ENUM(FRWR_FLUSHED_FR
);
188 TRACE_DEFINE_ENUM(FRWR_FLUSHED_LI
);
190 #define xprtrdma_show_frwr_state(x) \
191 __print_symbolic(x, \
192 { FRWR_IS_INVALID, "INVALID" }, \
193 { FRWR_IS_VALID, "VALID" }, \
194 { FRWR_FLUSHED_FR, "FLUSHED_FR" }, \
195 { FRWR_FLUSHED_LI, "FLUSHED_LI" })
197 DECLARE_EVENT_CLASS(xprtrdma_frwr_done
,
199 const struct ib_wc
*wc
,
200 const struct rpcrdma_frwr
*frwr
206 __field(const void *, mr
)
207 __field(unsigned int, state
)
208 __field(unsigned int, status
)
209 __field(unsigned int, vendor_err
)
213 __entry
->mr
= container_of(frwr
, struct rpcrdma_mr
, frwr
);
214 __entry
->state
= frwr
->fr_state
;
215 __entry
->status
= wc
->status
;
216 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
220 "mr=%p state=%s: %s (%u/0x%x)",
221 __entry
->mr
, xprtrdma_show_frwr_state(__entry
->state
),
222 rdma_show_wc_status(__entry
->status
),
223 __entry
->status
, __entry
->vendor_err
227 #define DEFINE_FRWR_DONE_EVENT(name) \
228 DEFINE_EVENT(xprtrdma_frwr_done, name, \
230 const struct ib_wc *wc, \
231 const struct rpcrdma_frwr *frwr \
235 DECLARE_EVENT_CLASS(xprtrdma_mr
,
237 const struct rpcrdma_mr
*mr
243 __field(const void *, mr
)
251 __entry
->handle
= mr
->mr_handle
;
252 __entry
->length
= mr
->mr_length
;
253 __entry
->offset
= mr
->mr_offset
;
256 TP_printk("mr=%p %u@0x%016llx:0x%08x",
257 __entry
->mr
, __entry
->length
,
258 (unsigned long long)__entry
->offset
,
263 #define DEFINE_MR_EVENT(name) \
264 DEFINE_EVENT(xprtrdma_mr, name, \
266 const struct rpcrdma_mr *mr \
270 DECLARE_EVENT_CLASS(xprtrdma_cb_event
,
272 const struct rpc_rqst
*rqst
278 __field(const void *, rqst
)
279 __field(const void *, rep
)
280 __field(const void *, req
)
285 __entry
->rqst
= rqst
;
286 __entry
->req
= rpcr_to_rdmar(rqst
);
287 __entry
->rep
= rpcr_to_rdmar(rqst
)->rl_reply
;
288 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
291 TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p",
292 __entry
->xid
, __entry
->rqst
, __entry
->req
, __entry
->rep
296 #define DEFINE_CB_EVENT(name) \
297 DEFINE_EVENT(xprtrdma_cb_event, name, \
299 const struct rpc_rqst *rqst \
307 TRACE_EVENT(xprtrdma_conn_upcall
,
309 const struct rpcrdma_xprt
*r_xprt
,
310 struct rdma_cm_event
*event
313 TP_ARGS(r_xprt
, event
),
316 __field(const void *, r_xprt
)
317 __field(unsigned int, event
)
319 __string(addr
, rpcrdma_addrstr(r_xprt
))
320 __string(port
, rpcrdma_portstr(r_xprt
))
324 __entry
->r_xprt
= r_xprt
;
325 __entry
->event
= event
->event
;
326 __entry
->status
= event
->status
;
327 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
328 __assign_str(port
, rpcrdma_portstr(r_xprt
));
331 TP_printk("peer=[%s]:%s r_xprt=%p: %s (%u/%d)",
332 __get_str(addr
), __get_str(port
),
333 __entry
->r_xprt
, rdma_show_cm_event(__entry
->event
),
334 __entry
->event
, __entry
->status
338 TRACE_EVENT(xprtrdma_disconnect
,
340 const struct rpcrdma_xprt
*r_xprt
,
344 TP_ARGS(r_xprt
, status
),
347 __field(const void *, r_xprt
)
349 __field(int, connected
)
350 __string(addr
, rpcrdma_addrstr(r_xprt
))
351 __string(port
, rpcrdma_portstr(r_xprt
))
355 __entry
->r_xprt
= r_xprt
;
356 __entry
->status
= status
;
357 __entry
->connected
= r_xprt
->rx_ep
.rep_connected
;
358 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
359 __assign_str(port
, rpcrdma_portstr(r_xprt
));
362 TP_printk("peer=[%s]:%s r_xprt=%p: status=%d %sconnected",
363 __get_str(addr
), __get_str(port
),
364 __entry
->r_xprt
, __entry
->status
,
365 __entry
->connected
== 1 ? "still " : "dis"
369 DEFINE_RXPRT_EVENT(xprtrdma_conn_start
);
370 DEFINE_RXPRT_EVENT(xprtrdma_conn_tout
);
371 DEFINE_RXPRT_EVENT(xprtrdma_create
);
372 DEFINE_RXPRT_EVENT(xprtrdma_destroy
);
373 DEFINE_RXPRT_EVENT(xprtrdma_remove
);
374 DEFINE_RXPRT_EVENT(xprtrdma_reinsert
);
375 DEFINE_RXPRT_EVENT(xprtrdma_reconnect
);
376 DEFINE_RXPRT_EVENT(xprtrdma_inject_dsc
);
378 TRACE_EVENT(xprtrdma_qp_error
,
380 const struct rpcrdma_xprt
*r_xprt
,
381 const struct ib_event
*event
384 TP_ARGS(r_xprt
, event
),
387 __field(const void *, r_xprt
)
388 __field(unsigned int, event
)
389 __string(name
, event
->device
->name
)
390 __string(addr
, rpcrdma_addrstr(r_xprt
))
391 __string(port
, rpcrdma_portstr(r_xprt
))
395 __entry
->r_xprt
= r_xprt
;
396 __entry
->event
= event
->event
;
397 __assign_str(name
, event
->device
->name
);
398 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
399 __assign_str(port
, rpcrdma_portstr(r_xprt
));
402 TP_printk("peer=[%s]:%s r_xprt=%p: dev %s: %s (%u)",
403 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
404 __get_str(name
), rdma_show_ib_event(__entry
->event
),
413 TRACE_EVENT(xprtrdma_createmrs
,
415 const struct rpcrdma_xprt
*r_xprt
,
419 TP_ARGS(r_xprt
, count
),
422 __field(const void *, r_xprt
)
423 __field(unsigned int, count
)
427 __entry
->r_xprt
= r_xprt
;
428 __entry
->count
= count
;
431 TP_printk("r_xprt=%p: created %u MRs",
432 __entry
->r_xprt
, __entry
->count
436 DEFINE_RXPRT_EVENT(xprtrdma_nomrs
);
438 DEFINE_RDCH_EVENT(xprtrdma_read_chunk
);
439 DEFINE_WRCH_EVENT(xprtrdma_write_chunk
);
440 DEFINE_WRCH_EVENT(xprtrdma_reply_chunk
);
442 TRACE_DEFINE_ENUM(rpcrdma_noch
);
443 TRACE_DEFINE_ENUM(rpcrdma_readch
);
444 TRACE_DEFINE_ENUM(rpcrdma_areadch
);
445 TRACE_DEFINE_ENUM(rpcrdma_writech
);
446 TRACE_DEFINE_ENUM(rpcrdma_replych
);
448 #define xprtrdma_show_chunktype(x) \
449 __print_symbolic(x, \
450 { rpcrdma_noch, "inline" }, \
451 { rpcrdma_readch, "read list" }, \
452 { rpcrdma_areadch, "*read list" }, \
453 { rpcrdma_writech, "write list" }, \
454 { rpcrdma_replych, "reply chunk" })
456 TRACE_EVENT(xprtrdma_marshal
,
458 const struct rpc_rqst
*rqst
,
464 TP_ARGS(rqst
, hdrlen
, rtype
, wtype
),
467 __field(unsigned int, task_id
)
468 __field(unsigned int, client_id
)
470 __field(unsigned int, hdrlen
)
471 __field(unsigned int, headlen
)
472 __field(unsigned int, pagelen
)
473 __field(unsigned int, taillen
)
474 __field(unsigned int, rtype
)
475 __field(unsigned int, wtype
)
479 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
480 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
481 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
482 __entry
->hdrlen
= hdrlen
;
483 __entry
->headlen
= rqst
->rq_snd_buf
.head
[0].iov_len
;
484 __entry
->pagelen
= rqst
->rq_snd_buf
.page_len
;
485 __entry
->taillen
= rqst
->rq_snd_buf
.tail
[0].iov_len
;
486 __entry
->rtype
= rtype
;
487 __entry
->wtype
= wtype
;
490 TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s",
491 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
493 __entry
->headlen
, __entry
->pagelen
, __entry
->taillen
,
494 xprtrdma_show_chunktype(__entry
->rtype
),
495 xprtrdma_show_chunktype(__entry
->wtype
)
499 TRACE_EVENT(xprtrdma_post_send
,
501 const struct rpcrdma_req
*req
,
505 TP_ARGS(req
, status
),
508 __field(const void *, req
)
509 __field(int, num_sge
)
510 __field(bool, signaled
)
516 __entry
->num_sge
= req
->rl_sendctx
->sc_wr
.num_sge
;
517 __entry
->signaled
= req
->rl_sendctx
->sc_wr
.send_flags
&
519 __entry
->status
= status
;
522 TP_printk("req=%p, %d SGEs%s, status=%d",
523 __entry
->req
, __entry
->num_sge
,
524 (__entry
->signaled
? ", signaled" : ""),
529 TRACE_EVENT(xprtrdma_post_recv
,
531 const struct rpcrdma_rep
*rep
,
535 TP_ARGS(rep
, status
),
538 __field(const void *, rep
)
544 __entry
->status
= status
;
547 TP_printk("rep=%p status=%d",
548 __entry
->rep
, __entry
->status
556 TRACE_EVENT(xprtrdma_wc_send
,
558 const struct rpcrdma_sendctx
*sc
,
559 const struct ib_wc
*wc
565 __field(const void *, req
)
566 __field(unsigned int, unmap_count
)
567 __field(unsigned int, status
)
568 __field(unsigned int, vendor_err
)
572 __entry
->req
= sc
->sc_req
;
573 __entry
->unmap_count
= sc
->sc_unmap_count
;
574 __entry
->status
= wc
->status
;
575 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
578 TP_printk("req=%p, unmapped %u pages: %s (%u/0x%x)",
579 __entry
->req
, __entry
->unmap_count
,
580 rdma_show_wc_status(__entry
->status
),
581 __entry
->status
, __entry
->vendor_err
585 TRACE_EVENT(xprtrdma_wc_receive
,
587 const struct rpcrdma_rep
*rep
,
588 const struct ib_wc
*wc
594 __field(const void *, rep
)
595 __field(unsigned int, byte_len
)
596 __field(unsigned int, status
)
597 __field(unsigned int, vendor_err
)
602 __entry
->byte_len
= wc
->byte_len
;
603 __entry
->status
= wc
->status
;
604 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
607 TP_printk("rep=%p, %u bytes: %s (%u/0x%x)",
608 __entry
->rep
, __entry
->byte_len
,
609 rdma_show_wc_status(__entry
->status
),
610 __entry
->status
, __entry
->vendor_err
614 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg
);
615 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li
);
616 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake
);
618 DEFINE_MR_EVENT(xprtrdma_localinv
);
619 DEFINE_MR_EVENT(xprtrdma_dma_unmap
);
620 DEFINE_MR_EVENT(xprtrdma_remoteinv
);
621 DEFINE_MR_EVENT(xprtrdma_recover_mr
);
627 TRACE_EVENT(xprtrdma_reply
,
629 const struct rpc_task
*task
,
630 const struct rpcrdma_rep
*rep
,
631 const struct rpcrdma_req
*req
,
635 TP_ARGS(task
, rep
, req
, credits
),
638 __field(unsigned int, task_id
)
639 __field(unsigned int, client_id
)
640 __field(const void *, rep
)
641 __field(const void *, req
)
643 __field(unsigned int, credits
)
647 __entry
->task_id
= task
->tk_pid
;
648 __entry
->client_id
= task
->tk_client
->cl_clid
;
651 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
652 __entry
->credits
= credits
;
655 TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p",
656 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
657 __entry
->credits
, __entry
->rep
, __entry
->req
661 TRACE_EVENT(xprtrdma_defer_cmp
,
663 const struct rpcrdma_rep
*rep
669 __field(unsigned int, task_id
)
670 __field(unsigned int, client_id
)
671 __field(const void *, rep
)
676 __entry
->task_id
= rep
->rr_rqst
->rq_task
->tk_pid
;
677 __entry
->client_id
= rep
->rr_rqst
->rq_task
->tk_client
->cl_clid
;
679 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
682 TP_printk("task:%u@%u xid=0x%08x rep=%p",
683 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
688 DEFINE_REPLY_EVENT(xprtrdma_reply_vers
);
689 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst
);
690 DEFINE_REPLY_EVENT(xprtrdma_reply_short
);
691 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr
);
693 TRACE_EVENT(xprtrdma_fixup
,
695 const struct rpc_rqst
*rqst
,
700 TP_ARGS(rqst
, len
, hdrlen
),
703 __field(unsigned int, task_id
)
704 __field(unsigned int, client_id
)
705 __field(const void *, base
)
711 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
712 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
713 __entry
->base
= rqst
->rq_rcv_buf
.head
[0].iov_base
;
715 __entry
->hdrlen
= hdrlen
;
718 TP_printk("task:%u@%u base=%p len=%d hdrlen=%d",
719 __entry
->task_id
, __entry
->client_id
,
720 __entry
->base
, __entry
->len
, __entry
->hdrlen
724 TRACE_EVENT(xprtrdma_fixup_pg
,
726 const struct rpc_rqst
*rqst
,
733 TP_ARGS(rqst
, pageno
, pos
, len
, curlen
),
736 __field(unsigned int, task_id
)
737 __field(unsigned int, client_id
)
738 __field(const void *, pos
)
745 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
746 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
748 __entry
->pageno
= pageno
;
750 __entry
->curlen
= curlen
;
753 TP_printk("task:%u@%u pageno=%d pos=%p len=%d curlen=%d",
754 __entry
->task_id
, __entry
->client_id
,
755 __entry
->pageno
, __entry
->pos
, __entry
->len
, __entry
->curlen
759 TRACE_EVENT(xprtrdma_decode_seg
,
766 TP_ARGS(handle
, length
, offset
),
775 __entry
->handle
= handle
;
776 __entry
->length
= length
;
777 __entry
->offset
= offset
;
780 TP_printk("%u@0x%016llx:0x%08x",
781 __entry
->length
, (unsigned long long)__entry
->offset
,
787 ** Allocation/release of rpcrdma_reqs and rpcrdma_reps
790 TRACE_EVENT(xprtrdma_allocate
,
792 const struct rpc_task
*task
,
793 const struct rpcrdma_req
*req
799 __field(unsigned int, task_id
)
800 __field(unsigned int, client_id
)
801 __field(const void *, req
)
802 __field(const void *, rep
)
803 __field(size_t, callsize
)
804 __field(size_t, rcvsize
)
808 __entry
->task_id
= task
->tk_pid
;
809 __entry
->client_id
= task
->tk_client
->cl_clid
;
811 __entry
->rep
= req
? req
->rl_reply
: NULL
;
812 __entry
->callsize
= task
->tk_rqstp
->rq_callsize
;
813 __entry
->rcvsize
= task
->tk_rqstp
->rq_rcvsize
;
816 TP_printk("task:%u@%u req=%p rep=%p (%zu, %zu)",
817 __entry
->task_id
, __entry
->client_id
,
818 __entry
->req
, __entry
->rep
,
819 __entry
->callsize
, __entry
->rcvsize
823 TRACE_EVENT(xprtrdma_rpc_done
,
825 const struct rpc_task
*task
,
826 const struct rpcrdma_req
*req
832 __field(unsigned int, task_id
)
833 __field(unsigned int, client_id
)
834 __field(const void *, req
)
835 __field(const void *, rep
)
839 __entry
->task_id
= task
->tk_pid
;
840 __entry
->client_id
= task
->tk_client
->cl_clid
;
842 __entry
->rep
= req
->rl_reply
;
845 TP_printk("task:%u@%u req=%p rep=%p",
846 __entry
->task_id
, __entry
->client_id
,
847 __entry
->req
, __entry
->rep
851 DEFINE_RXPRT_EVENT(xprtrdma_noreps
);
857 TRACE_EVENT(xprtrdma_cb_setup
,
859 const struct rpcrdma_xprt
*r_xprt
,
863 TP_ARGS(r_xprt
, reqs
),
866 __field(const void *, r_xprt
)
867 __field(unsigned int, reqs
)
868 __string(addr
, rpcrdma_addrstr(r_xprt
))
869 __string(port
, rpcrdma_portstr(r_xprt
))
873 __entry
->r_xprt
= r_xprt
;
874 __entry
->reqs
= reqs
;
875 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
876 __assign_str(port
, rpcrdma_portstr(r_xprt
));
879 TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs",
880 __get_str(addr
), __get_str(port
),
881 __entry
->r_xprt
, __entry
->reqs
885 DEFINE_CB_EVENT(xprtrdma_cb_call
);
886 DEFINE_CB_EVENT(xprtrdma_cb_reply
);
888 #endif /* _TRACE_RPCRDMA_H */
890 #include <trace/define_trace.h>