History

Merge tag 'nfs-rdma-for-5.11-1' of git://git.linux-nfs.org/projects/anna/linux-nfs into linux-next

NFSoRDmA Client updates for Linux 5.11 Cleanups and improvements: - Remove use of raw kernel memory addresses in tracepoints - Replace dprintk() call sites in ERR_CHUNK path - Trace unmap sync calls - Optimize MR DMA-unmapping

Trond Myklebust committed 5 years ago

Commit edffb842 parents 5c3485b 7a03aeb7 files · +302 −313Browse files

Unified · Split

7 files
  1. include/trace/events/rpcrdma.h +212 −238
  2. net/sunrpc/xprtrdma/backchannel.c +3 −3
  3. net/sunrpc/xprtrdma/frwr_ops.c +55 −26
  4. net/sunrpc/xprtrdma/rpc_rdma.c +11 −21
  5. net/sunrpc/xprtrdma/transport.c +4 −3
  6. net/sunrpc/xprtrdma/verbs.c +9 −21
  7. net/sunrpc/xprtrdma/xprt_rdma.h +8 −1
include/trace/events/rpcrdma.h+212−238
@@ -60,7 +60,7 @@ DECLARE_EVENT_CLASS(rpcrdma_completion_class, · 59 unmodified lines
6060 ), \
6161 TP_ARGS(wc, cid))
6262
63−DECLARE_EVENT_CLASS(xprtrdma_reply_event,
63+DECLARE_EVENT_CLASS(xprtrdma_reply_class,
6464 TP_PROTO(
6565 const struct rpcrdma_rep *rep
6666 ),
@@ -68,29 +68,30 @@ DECLARE_EVENT_CLASS(xprtrdma_reply_event, · 1 unmodified line
6868 TP_ARGS(rep),
6969
7070 TP_STRUCT__entry(
71− __field(const void *, rep)
72− __field(const void *, r_xprt)
7371 __field(u32, xid)
7472 __field(u32, version)
7573 __field(u32, proc)
74+ __string(addr, rpcrdma_addrstr(rep->rr_rxprt))
75+ __string(port, rpcrdma_portstr(rep->rr_rxprt))
7676 ),
7777
7878 TP_fast_assign(
79− __entry->rep = rep;
80− __entry->r_xprt = rep->rr_rxprt;
8179 __entry->xid = be32_to_cpu(rep->rr_xid);
8280 __entry->version = be32_to_cpu(rep->rr_vers);
8381 __entry->proc = be32_to_cpu(rep->rr_proc);
82+ __assign_str(addr, rpcrdma_addrstr(rep->rr_rxprt));
83+ __assign_str(port, rpcrdma_portstr(rep->rr_rxprt));
8484 ),
8585
86− TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u",
87− __entry->r_xprt, __entry->xid, __entry->rep,
88− __entry->version, __entry->proc
86+ TP_printk("peer=[%s]:%s xid=0x%08x version=%u proc=%u",
87+ __get_str(addr), __get_str(port),
88+ __entry->xid, __entry->version, __entry->proc
8989 )
9090 );
9191
9292 #define DEFINE_REPLY_EVENT(name) \
93− DEFINE_EVENT(xprtrdma_reply_event, name, \
93+ DEFINE_EVENT(xprtrdma_reply_class, \
94+ xprtrdma_reply_##name##_err, \
9495 TP_PROTO( \
9596 const struct rpcrdma_rep *rep \
9697 ), \
@@ -261,54 +262,67 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event, · 164 unmodified lines
261262 ), \
262263 TP_ARGS(task, mr, nsegs))
263264
264−DECLARE_EVENT_CLASS(xprtrdma_frwr_done,
265+TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL);
266+TRACE_DEFINE_ENUM(DMA_TO_DEVICE);
267+TRACE_DEFINE_ENUM(DMA_FROM_DEVICE);
268+TRACE_DEFINE_ENUM(DMA_NONE);
269+
270+#define xprtrdma_show_direction(x) \
271+ __print_symbolic(x, \
272+ { DMA_BIDIRECTIONAL, "BIDIR" }, \
273+ { DMA_TO_DEVICE, "TO_DEVICE" }, \
274+ { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
275+ { DMA_NONE, "NONE" })
276+
277+DECLARE_EVENT_CLASS(xprtrdma_mr_class,
265278 TP_PROTO(
266− const struct ib_wc *wc,
267− const struct rpcrdma_frwr *frwr
279+ const struct rpcrdma_mr *mr
268280 ),
269281
270− TP_ARGS(wc, frwr),
282+ TP_ARGS(mr),
271283
272284 TP_STRUCT__entry(
285+ __field(unsigned int, task_id)
286+ __field(unsigned int, client_id)
273287 __field(u32, mr_id)
274− __field(unsigned int, status)
275− __field(unsigned int, vendor_err)
288+ __field(int, nents)
289+ __field(u32, handle)
290+ __field(u32, length)
291+ __field(u64, offset)
292+ __field(u32, dir)
276293 ),
277294
278295 TP_fast_assign(
279− __entry->mr_id = frwr->fr_mr->res.id;
280− __entry->status = wc->status;
281− __entry->vendor_err = __entry->status ? wc->vendor_err : 0;
296+ const struct rpcrdma_req *req = mr->mr_req;
297+ const struct rpc_task *task = req->rl_slot.rq_task;
298+
299+ __entry->task_id = task->tk_pid;
300+ __entry->client_id = task->tk_client->cl_clid;
301+ __entry->mr_id = mr->frwr.fr_mr->res.id;
302+ __entry->nents = mr->mr_nents;
303+ __entry->handle = mr->mr_handle;
304+ __entry->length = mr->mr_length;
305+ __entry->offset = mr->mr_offset;
306+ __entry->dir = mr->mr_dir;
282307 ),
283308
284− TP_printk(
285− "mr.id=%u: %s (%u/0x%x)",
286− __entry->mr_id, rdma_show_wc_status(__entry->status),
287− __entry->status, __entry->vendor_err
309+ TP_printk("task:%u@%u mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
310+ __entry->task_id, __entry->client_id,
311+ __entry->mr_id, __entry->nents, __entry->length,
312+ (unsigned long long)__entry->offset, __entry->handle,
313+ xprtrdma_show_direction(__entry->dir)
288314 )
289315 );
290316
291−#define DEFINE_FRWR_DONE_EVENT(name) \
292− DEFINE_EVENT(xprtrdma_frwr_done, name, \
317+#define DEFINE_MR_EVENT(name) \
318+ DEFINE_EVENT(xprtrdma_mr_class, \
319+ xprtrdma_mr_##name, \
293320 TP_PROTO( \
294− const struct ib_wc *wc, \
295− const struct rpcrdma_frwr *frwr \
321+ const struct rpcrdma_mr *mr \
296322 ), \
297− TP_ARGS(wc, frwr))
298−
299−TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL);
300−TRACE_DEFINE_ENUM(DMA_TO_DEVICE);
301−TRACE_DEFINE_ENUM(DMA_FROM_DEVICE);
302−TRACE_DEFINE_ENUM(DMA_NONE);
303−
304−#define xprtrdma_show_direction(x) \
305− __print_symbolic(x, \
306− { DMA_BIDIRECTIONAL, "BIDIR" }, \
307− { DMA_TO_DEVICE, "TO_DEVICE" }, \
308− { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
309− { DMA_NONE, "NONE" })
323+ TP_ARGS(mr))
310324
311−DECLARE_EVENT_CLASS(xprtrdma_mr,
325+DECLARE_EVENT_CLASS(xprtrdma_anonymous_mr_class,
312326 TP_PROTO(
313327 const struct rpcrdma_mr *mr
314328 ),
@@ -340,45 +354,47 @@ DECLARE_EVENT_CLASS(xprtrdma_mr, · 25 unmodified lines
340354 )
341355 );
342356
343−#define DEFINE_MR_EVENT(name) \
344− DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \
345− TP_PROTO( \
346− const struct rpcrdma_mr *mr \
347− ), \
357+#define DEFINE_ANON_MR_EVENT(name) \
358+ DEFINE_EVENT(xprtrdma_anonymous_mr_class, \
359+ xprtrdma_mr_##name, \
360+ TP_PROTO( \
361+ const struct rpcrdma_mr *mr \
362+ ), \
348363 TP_ARGS(mr))
349364
350−DECLARE_EVENT_CLASS(xprtrdma_cb_event,
365+DECLARE_EVENT_CLASS(xprtrdma_callback_class,
351366 TP_PROTO(
367+ const struct rpcrdma_xprt *r_xprt,
352368 const struct rpc_rqst *rqst
353369 ),
354370
355− TP_ARGS(rqst),
371+ TP_ARGS(r_xprt, rqst),
356372
357373 TP_STRUCT__entry(
358− __field(const void *, rqst)
359− __field(const void *, rep)
360− __field(const void *, req)
361374 __field(u32, xid)
375+ __string(addr, rpcrdma_addrstr(r_xprt))
376+ __string(port, rpcrdma_portstr(r_xprt))
362377 ),
363378
364379 TP_fast_assign(
365− __entry->rqst = rqst;
366− __entry->req = rpcr_to_rdmar(rqst);
367− __entry->rep = rpcr_to_rdmar(rqst)->rl_reply;
368380 __entry->xid = be32_to_cpu(rqst->rq_xid);
381+ __assign_str(addr, rpcrdma_addrstr(r_xprt));
382+ __assign_str(port, rpcrdma_portstr(r_xprt));
369383 ),
370384
371− TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p",
372− __entry->xid, __entry->rqst, __entry->req, __entry->rep
385+ TP_printk("peer=[%s]:%s xid=0x%08x",
386+ __get_str(addr), __get_str(port), __entry->xid
373387 )
374388 );
375389
376−#define DEFINE_CB_EVENT(name) \
377− DEFINE_EVENT(xprtrdma_cb_event, name, \
390+#define DEFINE_CALLBACK_EVENT(name) \
391+ DEFINE_EVENT(xprtrdma_callback_class, \
392+ xprtrdma_cb_##name, \
378393 TP_PROTO( \
394+ const struct rpcrdma_xprt *r_xprt, \
379395 const struct rpc_rqst *rqst \
380396 ), \
381− TP_ARGS(rqst))
397+ TP_ARGS(r_xprt, rqst))
382398
383399 /**
384400 ** Connection events
@@ -549,61 +565,33 @@ TRACE_EVENT(xprtrdma_createmrs, · 164 unmodified lines
549565 )
550566 );
551567
552−TRACE_EVENT(xprtrdma_mr_get,
553− TP_PROTO(
554− const struct rpcrdma_req *req
555− ),
556−
557− TP_ARGS(req),
558−
559− TP_STRUCT__entry(
560− __field(const void *, req)
561− __field(unsigned int, task_id)
562− __field(unsigned int, client_id)
563− __field(u32, xid)
564− ),
565−
566− TP_fast_assign(
567− const struct rpc_rqst *rqst = &req->rl_slot;
568−
569− __entry->req = req;
570− __entry->task_id = rqst->rq_task->tk_pid;
571− __entry->client_id = rqst->rq_task->tk_client->cl_clid;
572− __entry->xid = be32_to_cpu(rqst->rq_xid);
573− ),
574−
575− TP_printk("task:%u@%u xid=0x%08x req=%p",
576− __entry->task_id, __entry->client_id, __entry->xid,
577− __entry->req
578− )
579−);
580−
581−TRACE_EVENT(xprtrdma_nomrs,
568+TRACE_EVENT(xprtrdma_nomrs_err,
582569 TP_PROTO(
570+ const struct rpcrdma_xprt *r_xprt,
583571 const struct rpcrdma_req *req
584572 ),
585573
586− TP_ARGS(req),
574+ TP_ARGS(r_xprt, req),
587575
588576 TP_STRUCT__entry(
589− __field(const void *, req)
590577 __field(unsigned int, task_id)
591578 __field(unsigned int, client_id)
592− __field(u32, xid)
579+ __string(addr, rpcrdma_addrstr(r_xprt))
580+ __string(port, rpcrdma_portstr(r_xprt))
593581 ),
594582
595583 TP_fast_assign(
596584 const struct rpc_rqst *rqst = &req->rl_slot;
597585
598− __entry->req = req;
599586 __entry->task_id = rqst->rq_task->tk_pid;
600587 __entry->client_id = rqst->rq_task->tk_client->cl_clid;
601− __entry->xid = be32_to_cpu(rqst->rq_xid);
588+ __assign_str(addr, rpcrdma_addrstr(r_xprt));
589+ __assign_str(port, rpcrdma_portstr(r_xprt));
602590 ),
603591
604− TP_printk("task:%u@%u xid=0x%08x req=%p",
605− __entry->task_id, __entry->client_id, __entry->xid,
606− __entry->req
592+ TP_printk("peer=[%s]:%s task:%u@%u",
593+ __get_str(addr), __get_str(port),
594+ __entry->task_id, __entry->client_id
607595 )
608596 );
609597
@@ -735,8 +723,8 @@ TRACE_EVENT(xprtrdma_post_send, · 125 unmodified lines
735723 TP_ARGS(req),
736724
737725 TP_STRUCT__entry(
738− __field(const void *, req)
739− __field(const void *, sc)
726+ __field(u32, cq_id)
727+ __field(int, completion_id)
740728 __field(unsigned int, task_id)
741729 __field(unsigned int, client_id)
742730 __field(int, num_sge)
@@ -745,20 +733,21 @@ TRACE_EVENT(xprtrdma_post_send, · 2 unmodified lines
745733
746734 TP_fast_assign(
747735 const struct rpc_rqst *rqst = &req->rl_slot;
736+ const struct rpcrdma_sendctx *sc = req->rl_sendctx;
748737
738+ __entry->cq_id = sc->sc_cid.ci_queue_id;
739+ __entry->completion_id = sc->sc_cid.ci_completion_id;
749740 __entry->task_id = rqst->rq_task->tk_pid;
750741 __entry->client_id = rqst->rq_task->tk_client ?
751742 rqst->rq_task->tk_client->cl_clid : -1;
752− __entry->req = req;
753− __entry->sc = req->rl_sendctx;
754743 __entry->num_sge = req->rl_wr.num_sge;
755744 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
756745 ),
757746
758− TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s",
747+ TP_printk("task:%u@%u cq.id=%u cid=%d (%d SGE%s) %s",
759748 __entry->task_id, __entry->client_id,
760− __entry->req, __entry->sc, __entry->num_sge,
761− (__entry->num_sge == 1 ? "" : "s"),
749+ __entry->cq_id, __entry->completion_id,
750+ __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"),
762751 (__entry->signaled ? "signaled" : "")
763752 )
764753 );
@@ -771,15 +760,17 @@ TRACE_EVENT(xprtrdma_post_recv, · 6 unmodified lines
771760 TP_ARGS(rep),
772761
773762 TP_STRUCT__entry(
774− __field(const void *, rep)
763+ __field(u32, cq_id)
764+ __field(int, completion_id)
775765 ),
776766
777767 TP_fast_assign(
778− __entry->rep = rep;
768+ __entry->cq_id = rep->rr_cid.ci_queue_id;
769+ __entry->completion_id = rep->rr_cid.ci_completion_id;
779770 ),
780771
781− TP_printk("rep=%p",
782− __entry->rep
772+ TP_printk("cq.id=%d cid=%d",
773+ __entry->cq_id, __entry->completion_id
783774 )
784775 );
785776
@@ -816,7 +807,7 @@ TRACE_EVENT(xprtrdma_post_recvs, · 30 unmodified lines
816807 )
817808 );
818809
819−TRACE_EVENT(xprtrdma_post_linv,
810+TRACE_EVENT(xprtrdma_post_linv_err,
820811 TP_PROTO(
821812 const struct rpcrdma_req *req,
822813 int status
@@ -825,19 +816,21 @@ TRACE_EVENT(xprtrdma_post_linv, · 2 unmodified lines
825816 TP_ARGS(req, status),
826817
827818 TP_STRUCT__entry(
828− __field(const void *, req)
819+ __field(unsigned int, task_id)
820+ __field(unsigned int, client_id)
829821 __field(int, status)
830− __field(u32, xid)
831822 ),
832823
833824 TP_fast_assign(
834− __entry->req = req;
825+ const struct rpc_task *task = req->rl_slot.rq_task;
826+
827+ __entry->task_id = task->tk_pid;
828+ __entry->client_id = task->tk_client->cl_clid;
835829 __entry->status = status;
836− __entry->xid = be32_to_cpu(req->rl_slot.rq_xid);
837830 ),
838831
839− TP_printk("req=%p xid=0x%08x status=%d",
840− __entry->req, __entry->xid, __entry->status
832+ TP_printk("task:%u@%u status=%d",
833+ __entry->task_id, __entry->client_id, __entry->status
841834 )
842835 );
843836
@@ -845,75 +838,12 @@ TRACE_EVENT(xprtrdma_post_linv, · 1 unmodified line
845838 ** Completion events
846839 **/
847840
848−TRACE_EVENT(xprtrdma_wc_send,
849− TP_PROTO(
850− const struct rpcrdma_sendctx *sc,
851− const struct ib_wc *wc
852− ),
853−
854− TP_ARGS(sc, wc),
855−
856− TP_STRUCT__entry(
857− __field(const void *, req)
858− __field(const void *, sc)
859− __field(unsigned int, unmap_count)
860− __field(unsigned int, status)
861− __field(unsigned int, vendor_err)
862− ),
863−
864− TP_fast_assign(
865− __entry->req = sc->sc_req;
866− __entry->sc = sc;
867− __entry->unmap_count = sc->sc_unmap_count;
868− __entry->status = wc->status;
869− __entry->vendor_err = __entry->status ? wc->vendor_err : 0;
870− ),
871−
872− TP_printk("req=%p sc=%p unmapped=%u: %s (%u/0x%x)",
873− __entry->req, __entry->sc, __entry->unmap_count,
874− rdma_show_wc_status(__entry->status),
875− __entry->status, __entry->vendor_err
876− )
877−);
878−
879−TRACE_EVENT(xprtrdma_wc_receive,
880− TP_PROTO(
881− const struct ib_wc *wc
882− ),
883−
884− TP_ARGS(wc),
885−
886− TP_STRUCT__entry(
887− __field(const void *, rep)
888− __field(u32, byte_len)
889− __field(unsigned int, status)
890− __field(u32, vendor_err)
891− ),
892−
893− TP_fast_assign(
894− __entry->rep = container_of(wc->wr_cqe, struct rpcrdma_rep,
895− rr_cqe);
896− __entry->status = wc->status;
897− if (wc->status) {
898− __entry->byte_len = 0;
899− __entry->vendor_err = wc->vendor_err;
900− } else {
901− __entry->byte_len = wc->byte_len;
902− __entry->vendor_err = 0;
903− }
904− ),
905−
906− TP_printk("rep=%p %u bytes: %s (%u/0x%x)",
907− __entry->rep, __entry->byte_len,
908− rdma_show_wc_status(__entry->status),
909− __entry->status, __entry->vendor_err
910− )
911−);
912−
913−DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg);
914−DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li);
915−DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake);
916−DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_done);
841+DEFINE_COMPLETION_EVENT(xprtrdma_wc_receive);
842+DEFINE_COMPLETION_EVENT(xprtrdma_wc_send);
843+DEFINE_COMPLETION_EVENT(xprtrdma_wc_fastreg);
844+DEFINE_COMPLETION_EVENT(xprtrdma_wc_li);
845+DEFINE_COMPLETION_EVENT(xprtrdma_wc_li_wake);
846+DEFINE_COMPLETION_EVENT(xprtrdma_wc_li_done);
917847
918848 TRACE_EVENT(xprtrdma_frwr_alloc,
919849 TP_PROTO(
@@ -1036,9 +966,9 @@ TRACE_EVENT(xprtrdma_frwr_maperr, · 116 unmodified lines
1036966
1037967 DEFINE_MR_EVENT(localinv);
1038968 DEFINE_MR_EVENT(map);
1039−DEFINE_MR_EVENT(unmap);
1040−DEFINE_MR_EVENT(reminv);
1041−DEFINE_MR_EVENT(recycle);
969+
970+DEFINE_ANON_MR_EVENT(unmap);
971+DEFINE_ANON_MR_EVENT(recycle);
1042972
1043973 TRACE_EVENT(xprtrdma_dma_maperr,
1044974 TP_PROTO(
@@ -1066,17 +996,14 @@ TRACE_EVENT(xprtrdma_reply, · 21 unmodified lines
1066996 TP_PROTO(
1067997 const struct rpc_task *task,
1068998 const struct rpcrdma_rep *rep,
1069− const struct rpcrdma_req *req,
1070999 unsigned int credits
10711000 ),
10721001
1073− TP_ARGS(task, rep, req, credits),
1002+ TP_ARGS(task, rep, credits),
10741003
10751004 TP_STRUCT__entry(
10761005 __field(unsigned int, task_id)
10771006 __field(unsigned int, client_id)
1078− __field(const void *, rep)
1079− __field(const void *, req)
10801007 __field(u32, xid)
10811008 __field(unsigned int, credits)
10821009 ),
@@ -1084,49 +1011,102 @@ TRACE_EVENT(xprtrdma_reply, · 1 unmodified line
10841011 TP_fast_assign(
10851012 __entry->task_id = task->tk_pid;
10861013 __entry->client_id = task->tk_client->cl_clid;
1087− __entry->rep = rep;
1088− __entry->req = req;
10891014 __entry->xid = be32_to_cpu(rep->rr_xid);
10901015 __entry->credits = credits;
10911016 ),
10921017
1093− TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p",
1018+ TP_printk("task:%u@%u xid=0x%08x credits=%u",
10941019 __entry->task_id, __entry->client_id, __entry->xid,
1095− __entry->credits, __entry->rep, __entry->req
1020+ __entry->credits
10961021 )
10971022 );
10981023
1099−TRACE_EVENT(xprtrdma_defer_cmp,
1024+DEFINE_REPLY_EVENT(vers);
1025+DEFINE_REPLY_EVENT(rqst);
1026+DEFINE_REPLY_EVENT(short);
1027+DEFINE_REPLY_EVENT(hdr);
1028+
1029+TRACE_EVENT(xprtrdma_err_vers,
11001030 TP_PROTO(
1101− const struct rpcrdma_rep *rep
1031+ const struct rpc_rqst *rqst,
1032+ __be32 *min,
1033+ __be32 *max
11021034 ),
11031035
1104− TP_ARGS(rep),
1036+ TP_ARGS(rqst, min, max),
11051037
11061038 TP_STRUCT__entry(
11071039 __field(unsigned int, task_id)
11081040 __field(unsigned int, client_id)
1109− __field(const void *, rep)
11101041 __field(u32, xid)
1042+ __field(u32, min)
1043+ __field(u32, max)
11111044 ),
11121045
11131046 TP_fast_assign(
1114− __entry->task_id = rep->rr_rqst->rq_task->tk_pid;
1115− __entry->client_id = rep->rr_rqst->rq_task->tk_client->cl_clid;
1116− __entry->rep = rep;
1117− __entry->xid = be32_to_cpu(rep->rr_xid);
1047+ __entry->task_id = rqst->rq_task->tk_pid;
1048+ __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1049+ __entry->xid = be32_to_cpu(rqst->rq_xid);
1050+ __entry->min = be32_to_cpup(min);
1051+ __entry->max = be32_to_cpup(max);
11181052 ),
11191053
1120− TP_printk("task:%u@%u xid=0x%08x rep=%p",
1054+ TP_printk("task:%u@%u xid=0x%08x versions=[%u, %u]",
11211055 __entry->task_id, __entry->client_id, __entry->xid,
1122− __entry->rep
1056+ __entry->min, __entry->max
1057+ )
1058+);
1059+
1060+TRACE_EVENT(xprtrdma_err_chunk,
1061+ TP_PROTO(
1062+ const struct rpc_rqst *rqst
1063+ ),
1064+
1065+ TP_ARGS(rqst),
1066+
1067+ TP_STRUCT__entry(
1068+ __field(unsigned int, task_id)
1069+ __field(unsigned int, client_id)
1070+ __field(u32, xid)
1071+ ),
1072+
1073+ TP_fast_assign(
1074+ __entry->task_id = rqst->rq_task->tk_pid;
1075+ __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1076+ __entry->xid = be32_to_cpu(rqst->rq_xid);
1077+ ),
1078+
1079+ TP_printk("task:%u@%u xid=0x%08x",
1080+ __entry->task_id, __entry->client_id, __entry->xid
11231081 )
11241082 );
11251083
1126−DEFINE_REPLY_EVENT(xprtrdma_reply_vers);
1127−DEFINE_REPLY_EVENT(xprtrdma_reply_rqst);
1128−DEFINE_REPLY_EVENT(xprtrdma_reply_short);
1129−DEFINE_REPLY_EVENT(xprtrdma_reply_hdr);
1084+TRACE_EVENT(xprtrdma_err_unrecognized,
1085+ TP_PROTO(
1086+ const struct rpc_rqst *rqst,
1087+ __be32 *procedure
1088+ ),
1089+
1090+ TP_ARGS(rqst, procedure),
1091+
1092+ TP_STRUCT__entry(
1093+ __field(unsigned int, task_id)
1094+ __field(unsigned int, client_id)
1095+ __field(u32, xid)
1096+ __field(u32, procedure)
1097+ ),
1098+
1099+ TP_fast_assign(
1100+ __entry->task_id = rqst->rq_task->tk_pid;
1101+ __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1102+ __entry->procedure = be32_to_cpup(procedure);
1103+ ),
1104+
1105+ TP_printk("task:%u@%u xid=0x%08x procedure=%u",
1106+ __entry->task_id, __entry->client_id, __entry->xid,
1107+ __entry->procedure
1108+ )
1109+);
11301110
11311111 TRACE_EVENT(xprtrdma_fixup,
11321112 TP_PROTO(
@@ -1187,6 +1167,28 @@ TRACE_EVENT(xprtrdma_decode_seg, · 54 unmodified lines
11871167 )
11881168 );
11891169
1170+TRACE_EVENT(xprtrdma_mrs_zap,
1171+ TP_PROTO(
1172+ const struct rpc_task *task
1173+ ),
1174+
1175+ TP_ARGS(task),
1176+
1177+ TP_STRUCT__entry(
1178+ __field(unsigned int, task_id)
1179+ __field(unsigned int, client_id)
1180+ ),
1181+
1182+ TP_fast_assign(
1183+ __entry->task_id = task->tk_pid;
1184+ __entry->client_id = task->tk_client->cl_clid;
1185+ ),
1186+
1187+ TP_printk("task:%u@%u",
1188+ __entry->task_id, __entry->client_id
1189+ )
1190+);
1191+
11901192 /**
11911193 ** Callback events
11921194 **/
@@ -1219,36 +1221,8 @@ TRACE_EVENT(xprtrdma_cb_setup, · 26 unmodified lines
12191221 )
12201222 );
12211223
1222−DEFINE_CB_EVENT(xprtrdma_cb_call);
1223−DEFINE_CB_EVENT(xprtrdma_cb_reply);
1224−
1225−TRACE_EVENT(xprtrdma_leaked_rep,
1226− TP_PROTO(
1227− const struct rpc_rqst *rqst,
1228− const struct rpcrdma_rep *rep
1229− ),
1230−
1231− TP_ARGS(rqst, rep),
1232−
1233− TP_STRUCT__entry(
1234− __field(unsigned int, task_id)
1235− __field(unsigned int, client_id)
1236− __field(u32, xid)
1237− __field(const void *, rep)
1238− ),
1239−
1240− TP_fast_assign(
1241− __entry->task_id = rqst->rq_task->tk_pid;
1242− __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1243− __entry->xid = be32_to_cpu(rqst->rq_xid);
1244− __entry->rep = rep;
1245− ),
1246−
1247− TP_printk("task:%u@%u xid=0x%08x rep=%p",
1248− __entry->task_id, __entry->client_id, __entry->xid,
1249− __entry->rep
1250− )
1251−);
1224+DEFINE_CALLBACK_EVENT(call);
1225+DEFINE_CALLBACK_EVENT(reply);
12521226
12531227 /**
12541228 ** Server-side RPC/RDMA events
net/sunrpc/xprtrdma/backchannel.c+3−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3− * Copyright (c) 2015 Oracle. All rights reserved.
3+ * Copyright (c) 2015-2020, Oracle and/or its affiliates.
44 *
55 * Support for backward direction RPCs on RPC/RDMA.
66 */
@@ -82,7 +82,7 @@ static int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst) · 75 unmodified lines
8282 &rqst->rq_snd_buf, rpcrdma_noch_pullup))
8383 return -EIO;
8484
85− trace_xprtrdma_cb_reply(rqst);
85+ trace_xprtrdma_cb_reply(r_xprt, rqst);
8686 return 0;
8787 }
8888
@@ -260,7 +260,7 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt, · 171 unmodified lines
260260 */
261261 req = rpcr_to_rdmar(rqst);
262262 req->rl_reply = rep;
263− trace_xprtrdma_cb_call(rqst);
263+ trace_xprtrdma_cb_call(r_xprt, rqst);
264264
265265 /* Queue rqst for ULP's callback service */
266266 bc_serv = xprt->bc_serv;
net/sunrpc/xprtrdma/frwr_ops.c+55−26
@@ -65,18 +65,23 @@ void frwr_release_mr(struct rpcrdma_mr *mr) · 64 unmodified lines
6565 kfree(mr);
6666 }
6767
68+static void frwr_mr_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
69+{
70+ if (mr->mr_device) {
71+ trace_xprtrdma_mr_unmap(mr);
72+ ib_dma_unmap_sg(mr->mr_device, mr->mr_sg, mr->mr_nents,
73+ mr->mr_dir);
74+ mr->mr_device = NULL;
75+ }
76+}
77+
6878 static void frwr_mr_recycle(struct rpcrdma_mr *mr)
6979 {
7080 struct rpcrdma_xprt *r_xprt = mr->mr_xprt;
7181
7282 trace_xprtrdma_mr_recycle(mr);
7383
74− if (mr->mr_dir != DMA_NONE) {
75− trace_xprtrdma_mr_unmap(mr);
76− ib_dma_unmap_sg(r_xprt->rx_ep->re_id->device,
77− mr->mr_sg, mr->mr_nents, mr->mr_dir);
78− mr->mr_dir = DMA_NONE;
79− }
84+ frwr_mr_unmap(r_xprt, mr);
8085
8186 spin_lock(&r_xprt->rx_buf.rb_lock);
8287 list_del(&mr->mr_all);
@@ -86,6 +91,16 @@ static void frwr_mr_recycle(struct rpcrdma_mr *mr) · 3 unmodified lines
8691 frwr_release_mr(mr);
8792 }
8893
94+static void frwr_mr_put(struct rpcrdma_mr *mr)
95+{
96+ frwr_mr_unmap(mr->mr_xprt, mr);
97+
98+ /* The MR is returned to the req's MR free list instead
99+ * of to the xprt's MR free list. No spinlock is needed.
100+ */
101+ rpcrdma_mr_push(mr, &mr->mr_req->rl_free_mrs);
102+}
103+
89104 /* frwr_reset - Place MRs back on the free list
90105 * @req: request to reset
91106 *
@@ -101,7 +116,7 @@ void frwr_reset(struct rpcrdma_req *req) · 9 unmodified lines
101116 struct rpcrdma_mr *mr;
102117
103118 while ((mr = rpcrdma_mr_pop(&req->rl_registered)))
104− rpcrdma_mr_put(mr);
119+ frwr_mr_put(mr);
105120 }
106121
107122 /**
@@ -130,7 +145,7 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr) · 22 unmodified lines
130145
131146 mr->mr_xprt = r_xprt;
132147 mr->frwr.fr_mr = frmr;
133− mr->mr_dir = DMA_NONE;
148+ mr->mr_device = NULL;
134149 INIT_LIST_HEAD(&mr->mr_list);
135150 init_completion(&mr->frwr.fr_linv_done);
136151
@@ -315,6 +330,7 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, · 178 unmodified lines
315330 mr->mr_dir);
316331 if (!dma_nents)
317332 goto out_dmamap_err;
333+ mr->mr_device = ep->re_id->device;
318334
319335 ibmr = mr->frwr.fr_mr;
320336 n = ib_map_mr_sg(ibmr, mr->mr_sg, dma_nents, NULL, PAGE_SIZE);
@@ -341,7 +357,6 @@ struct rpcrdma_mr_seg *frwr_map(struct rpcrdma_xprt *r_xprt, · 20 unmodified lines
341357 return seg;
342358
343359 out_dmamap_err:
344− mr->mr_dir = DMA_NONE;
345360 trace_xprtrdma_frwr_sgerr(mr, i);
346361 return ERR_PTR(-EIO);
347362
@@ -363,12 +378,21 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) · 15 unmodified lines
363378 container_of(cqe, struct rpcrdma_frwr, fr_cqe);
364379
365380 /* WARNING: Only wr_cqe and status are reliable at this point */
366− trace_xprtrdma_wc_fastreg(wc, frwr);
381+ trace_xprtrdma_wc_fastreg(wc, &frwr->fr_cid);
367382 /* The MR will get recycled when the associated req is retransmitted */
368383
369384 rpcrdma_flush_disconnect(cq->cq_context, wc);
370385 }
371386
387+static void frwr_cid_init(struct rpcrdma_ep *ep,
388+ struct rpcrdma_frwr *frwr)
389+{
390+ struct rpc_rdma_cid *cid = &frwr->fr_cid;
391+
392+ cid->ci_queue_id = ep->re_attr.send_cq->res.id;
393+ cid->ci_completion_id = frwr->fr_mr->res.id;
394+}
395+
372396 /**
373397 * frwr_send - post Send WRs containing the RPC Call message
374398 * @r_xprt: controlling transport instance
@@ -385,6 +409,7 @@ static void frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) · 10 unmodified lines
385409 */
386410 int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
387411 {
412+ struct rpcrdma_ep *ep = r_xprt->rx_ep;
388413 struct ib_send_wr *post_wr;
389414 struct rpcrdma_mr *mr;
390415
@@ -395,6 +420,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 4 unmodified lines
395420 frwr = &mr->frwr;
396421
397422 frwr->fr_cqe.done = frwr_wc_fastreg;
423+ frwr_cid_init(ep, frwr);
398424 frwr->fr_regwr.wr.next = post_wr;
399425 frwr->fr_regwr.wr.wr_cqe = &frwr->fr_cqe;
400426 frwr->fr_regwr.wr.num_sge = 0;
@@ -404,7 +430,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 3 unmodified lines
404430 post_wr = &frwr->fr_regwr.wr;
405431 }
406432
407− return ib_post_send(r_xprt->rx_ep->re_id->qp, post_wr, NULL);
433+ return ib_post_send(ep->re_id->qp, post_wr, NULL);
408434 }
409435
410436 /**
@@ -420,18 +446,17 @@ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs) · 9 unmodified lines
420446 list_for_each_entry(mr, mrs, mr_list)
421447 if (mr->mr_handle == rep->rr_inv_rkey) {
422448 list_del_init(&mr->mr_list);
423− trace_xprtrdma_mr_reminv(mr);
424− rpcrdma_mr_put(mr);
449+ frwr_mr_put(mr);
425450 break; /* only one invalidated MR per RPC */
426451 }
427452 }
428453
429−static void __frwr_release_mr(struct ib_wc *wc, struct rpcrdma_mr *mr)
454+static void frwr_mr_done(struct ib_wc *wc, struct rpcrdma_mr *mr)
430455 {
431456 if (wc->status != IB_WC_SUCCESS)
432457 frwr_mr_recycle(mr);
433458 else
434− rpcrdma_mr_put(mr);
459+ frwr_mr_put(mr);
435460 }
436461
437462 /**
@@ -448,8 +473,8 @@ static void frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc) · 10 unmodified lines
448473 struct rpcrdma_mr *mr = container_of(frwr, struct rpcrdma_mr, frwr);
449474
450475 /* WARNING: Only wr_cqe and status are reliable at this point */
451− trace_xprtrdma_wc_li(wc, frwr);
452− __frwr_release_mr(wc, mr);
476+ trace_xprtrdma_wc_li(wc, &frwr->fr_cid);
477+ frwr_mr_done(wc, mr);
453478
454479 rpcrdma_flush_disconnect(cq->cq_context, wc);
455480 }
@@ -469,8 +494,8 @@ static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) · 13 unmodified lines
469494 struct rpcrdma_mr *mr = container_of(frwr, struct rpcrdma_mr, frwr);
470495
471496 /* WARNING: Only wr_cqe and status are reliable at this point */
472− trace_xprtrdma_wc_li_wake(wc, frwr);
473− __frwr_release_mr(wc, mr);
497+ trace_xprtrdma_wc_li_wake(wc, &frwr->fr_cid);
498+ frwr_mr_done(wc, mr);
474499 complete(&frwr->fr_linv_done);
475500
476501 rpcrdma_flush_disconnect(cq->cq_context, wc);
@@ -490,6 +515,7 @@ static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) · 13 unmodified lines
490515 void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
491516 {
492517 struct ib_send_wr *first, **prev, *last;
518+ struct rpcrdma_ep *ep = r_xprt->rx_ep;
493519 const struct ib_send_wr *bad_wr;
494520 struct rpcrdma_frwr *frwr;
495521 struct rpcrdma_mr *mr;
@@ -509,6 +535,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 13 unmodified lines
509535
510536 frwr = &mr->frwr;
511537 frwr->fr_cqe.done = frwr_wc_localinv;
538+ frwr_cid_init(ep, frwr);
512539 last = &frwr->fr_invwr;
513540 last->next = NULL;
514541 last->wr_cqe = &frwr->fr_cqe;
@@ -534,7 +561,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 19 unmodified lines
534561 * unless re_id->qp is a valid pointer.
535562 */
536563 bad_wr = NULL;
537− rc = ib_post_send(r_xprt->rx_ep->re_id->qp, first, &bad_wr);
564+ rc = ib_post_send(ep->re_id->qp, first, &bad_wr);
538565
539566 /* The final LOCAL_INV WR in the chain is supposed to
540567 * do the wake. If it was never posted, the wake will
@@ -547,7 +574,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 6 unmodified lines
547574
548575 /* Recycle MRs in the LOCAL_INV chain that did not get posted.
549576 */
550− trace_xprtrdma_post_linv(req, rc);
577+ trace_xprtrdma_post_linv_err(req, rc);
551578 while (bad_wr) {
552579 frwr = container_of(bad_wr, struct rpcrdma_frwr,
553580 fr_invwr);
@@ -574,10 +601,10 @@ static void frwr_wc_localinv_done(struct ib_cq *cq, struct ib_wc *wc) · 20 unmodified lines
574601 struct rpcrdma_rep *rep = mr->mr_req->rl_reply;
575602
576603 /* WARNING: Only wr_cqe and status are reliable at this point */
577− trace_xprtrdma_wc_li_done(wc, frwr);
578− __frwr_release_mr(wc, mr);
604+ trace_xprtrdma_wc_li_done(wc, &frwr->fr_cid);
605+ frwr_mr_done(wc, mr);
579606
580− /* Ensure @rep is generated before __frwr_release_mr */
607+ /* Ensure @rep is generated before frwr_mr_done */
581608 smp_rmb();
582609 rpcrdma_complete_rqst(rep);
583610
@@ -597,6 +624,7 @@ static void frwr_wc_localinv_done(struct ib_cq *cq, struct ib_wc *wc) · 13 unmodified lines
597624 void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
598625 {
599626 struct ib_send_wr *first, *last, **prev;
627+ struct rpcrdma_ep *ep = r_xprt->rx_ep;
600628 const struct ib_send_wr *bad_wr;
601629 struct rpcrdma_frwr *frwr;
602630 struct rpcrdma_mr *mr;
@@ -614,6 +642,7 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 11 unmodified lines
614642
615643 frwr = &mr->frwr;
616644 frwr->fr_cqe.done = frwr_wc_localinv;
645+ frwr_cid_init(ep, frwr);
617646 last = &frwr->fr_invwr;
618647 last->next = NULL;
619648 last->wr_cqe = &frwr->fr_cqe;
@@ -639,13 +668,13 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 19 unmodified lines
639668 * unless re_id->qp is a valid pointer.
640669 */
641670 bad_wr = NULL;
642− rc = ib_post_send(r_xprt->rx_ep->re_id->qp, first, &bad_wr);
671+ rc = ib_post_send(ep->re_id->qp, first, &bad_wr);
643672 if (!rc)
644673 return;
645674
646675 /* Recycle MRs in the LOCAL_INV chain that did not get posted.
647676 */
648− trace_xprtrdma_post_linv(req, rc);
677+ trace_xprtrdma_post_linv_err(req, rc);
649678 while (bad_wr) {
650679 frwr = container_of(bad_wr, struct rpcrdma_frwr, fr_invwr);
651680 mr = container_of(frwr, struct rpcrdma_mr, frwr);
net/sunrpc/xprtrdma/rpc_rdma.c+11−21
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (c) 2014-2017 Oracle. All rights reserved.
3+ * Copyright (c) 2014-2020, Oracle and/or its affiliates.
44 * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
55 *
66 * This software is available to you under a choice of one of two
@@ -331,7 +331,6 @@ static struct rpcrdma_mr_seg *rpcrdma_mr_prepare(struct rpcrdma_xprt *r_xprt, · 324 unmodified lines
331331 *mr = rpcrdma_mr_get(r_xprt);
332332 if (!*mr)
333333 goto out_getmr_err;
334− trace_xprtrdma_mr_get(req);
335334 (*mr)->mr_req = req;
336335 }
337336
@@ -339,7 +338,7 @@ static struct rpcrdma_mr_seg *rpcrdma_mr_prepare(struct rpcrdma_xprt *r_xprt, · 1 unmodified line
339338 return frwr_map(r_xprt, seg, nsegs, writing, req->rl_slot.rq_xid, *mr);
340339
341340 out_getmr_err:
342− trace_xprtrdma_nomrs(req);
341+ trace_xprtrdma_nomrs_err(r_xprt, req);
343342 xprt_wait_for_buffer_space(&r_xprt->rx_xprt);
344343 rpcrdma_mrs_refresh(r_xprt);
345344 return ERR_PTR(-EAGAIN);
@@ -1344,20 +1343,13 @@ rpcrdma_decode_error(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep, · 998 unmodified lines
13441343 p = xdr_inline_decode(xdr, 2 * sizeof(*p));
13451344 if (!p)
13461345 break;
1347− dprintk("RPC: %s: server reports "
1348− "version error (%u-%u), xid %08x\n", __func__,
1349− be32_to_cpup(p), be32_to_cpu(*(p + 1)),
1350− be32_to_cpu(rep->rr_xid));
1346+ trace_xprtrdma_err_vers(rqst, p, p + 1);
13511347 break;
13521348 case err_chunk:
1353− dprintk("RPC: %s: server reports "
1354− "header decoding error, xid %08x\n", __func__,
1355− be32_to_cpu(rep->rr_xid));
1349+ trace_xprtrdma_err_chunk(rqst);
13561350 break;
13571351 default:
1358− dprintk("RPC: %s: server reports "
1359− "unrecognized error %d, xid %08x\n", __func__,
1360− be32_to_cpup(p), be32_to_cpu(rep->rr_xid));
1352+ trace_xprtrdma_err_unrecognized(rqst, p);
13611353 }
13621354
13631355 return -EIO;
@@ -1398,7 +1390,7 @@ out: · 34 unmodified lines
13981390 return;
13991391
14001392 out_badheader:
1401− trace_xprtrdma_reply_hdr(rep);
1393+ trace_xprtrdma_reply_hdr_err(rep);
14021394 r_xprt->rx_stats.bad_reply_count++;
14031395 rqst->rq_task->tk_status = status;
14041396 status = 0;
@@ -1472,14 +1464,12 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) · 67 unmodified lines
14721464 rpcrdma_post_recvs(r_xprt, false);
14731465
14741466 req = rpcr_to_rdmar(rqst);
1475− if (req->rl_reply) {
1476− trace_xprtrdma_leaked_rep(rqst, req->rl_reply);
1467+ if (unlikely(req->rl_reply))
14771468 rpcrdma_recv_buffer_put(req->rl_reply);
1478− }
14791469 req->rl_reply = rep;
14801470 rep->rr_rqst = rqst;
14811471
1482− trace_xprtrdma_reply(rqst->rq_task, rep, req, credits);
1472+ trace_xprtrdma_reply(rqst->rq_task, rep, credits);
14831473
14841474 if (rep->rr_wc_flags & IB_WC_WITH_INVALIDATE)
14851475 frwr_reminv(rep, &req->rl_registered);
@@ -1491,16 +1481,16 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) · 5 unmodified lines
14911481 return;
14921482
14931483 out_badversion:
1494− trace_xprtrdma_reply_vers(rep);
1484+ trace_xprtrdma_reply_vers_err(rep);
14951485 goto out;
14961486
14971487 out_norqst:
14981488 spin_unlock(&xprt->queue_lock);
1499− trace_xprtrdma_reply_rqst(rep);
1489+ trace_xprtrdma_reply_rqst_err(rep);
15001490 goto out;
15011491
15021492 out_shortreply:
1503− trace_xprtrdma_reply_short(rep);
1493+ trace_xprtrdma_reply_short_err(rep);
15041494
15051495 out:
15061496 rpcrdma_recv_buffer_put(rep);
net/sunrpc/xprtrdma/transport.c+4−3
@@ -599,11 +599,12 @@ static void · 598 unmodified lines
599599 xprt_rdma_free(struct rpc_task *task)
600600 {
601601 struct rpc_rqst *rqst = task->tk_rqstp;
602− struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
603602 struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
604603
605− if (!list_empty(&req->rl_registered))
606− frwr_unmap_sync(r_xprt, req);
604+ if (unlikely(!list_empty(&req->rl_registered))) {
605+ trace_xprtrdma_mrs_zap(task);
606+ frwr_unmap_sync(rpcx_to_rdmax(rqst->rq_xprt), req);
607+ }
607608
608609 /* XXX: If the RPC is completing because of a signal and
609610 * not because a reply was received, we ought to ensure
net/sunrpc/xprtrdma/verbs.c+9−21
@@ -167,7 +167,7 @@ static void rpcrdma_wc_send(struct ib_cq *cq, struct ib_wc *wc) · 166 unmodified lines
167167 struct rpcrdma_xprt *r_xprt = cq->cq_context;
168168
169169 /* WARNING: Only wr_cqe and status are reliable at this point */
170− trace_xprtrdma_wc_send(sc, wc);
170+ trace_xprtrdma_wc_send(wc, &sc->sc_cid);
171171 rpcrdma_sendctx_put_locked(r_xprt, sc);
172172 rpcrdma_flush_disconnect(r_xprt, wc);
173173 }
@@ -186,7 +186,7 @@ static void rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) · 12 unmodified lines
186186 struct rpcrdma_xprt *r_xprt = cq->cq_context;
187187
188188 /* WARNING: Only wr_cqe and status are reliable at this point */
189− trace_xprtrdma_wc_receive(wc);
189+ trace_xprtrdma_wc_receive(wc, &rep->rr_cid);
190190 --r_xprt->rx_ep->re_receive_count;
191191 if (wc->status != IB_WC_SUCCESS)
192192 goto out_flushed;
@@ -643,6 +643,9 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep) · 450 unmodified lines
643643 return NULL;
644644
645645 sc->sc_cqe.done = rpcrdma_wc_send;
646+ sc->sc_cid.ci_queue_id = ep->re_attr.send_cq->res.id;
647+ sc->sc_cid.ci_completion_id =
648+ atomic_inc_return(&ep->re_completion_ids);
646649 return sc;
647650 }
648651
@@ -972,6 +975,9 @@ struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt, · 323 unmodified lines
972975 if (!rpcrdma_regbuf_dma_map(r_xprt, rep->rr_rdmabuf))
973976 goto out_free_regbuf;
974977
978+ rep->rr_cid.ci_completion_id =
979+ atomic_inc_return(&r_xprt->rx_ep->re_completion_ids);
980+
975981 xdr_buf_init(&rep->rr_hdrbuf, rdmab_data(rep->rr_rdmabuf),
976982 rdmab_length(rep->rr_rdmabuf));
977983 rep->rr_cqe.done = rpcrdma_wc_receive;
@@ -1178,25 +1184,6 @@ rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt) · 200 unmodified lines
11781184 return mr;
11791185 }
11801186
1181−/**
1182− * rpcrdma_mr_put - DMA unmap an MR and release it
1183− * @mr: MR to release
1184− *
1185− */
1186−void rpcrdma_mr_put(struct rpcrdma_mr *mr)
1187−{
1188− struct rpcrdma_xprt *r_xprt = mr->mr_xprt;
1189−
1190− if (mr->mr_dir != DMA_NONE) {
1191− trace_xprtrdma_mr_unmap(mr);
1192− ib_dma_unmap_sg(r_xprt->rx_ep->re_id->device,
1193− mr->mr_sg, mr->mr_nents, mr->mr_dir);
1194− mr->mr_dir = DMA_NONE;
1195− }
1196−
1197− rpcrdma_mr_push(mr, &mr->mr_req->rl_free_mrs);
1198−}
1199−
12001187 /**
12011188 * rpcrdma_buffer_get - Get a request buffer
12021189 * @buffers: Buffer pool from which to obtain a buffer
@@ -1411,6 +1398,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) · 208 unmodified lines
14111398 if (!rep)
14121399 break;
14131400
1401+ rep->rr_cid.ci_queue_id = ep->re_attr.recv_cq->res.id;
14141402 trace_xprtrdma_post_recv(rep);
14151403 rep->rr_recv_wr.next = wr;
14161404 wr = &rep->rr_recv_wr;
net/sunrpc/xprtrdma/xprt_rdma.h+8−1
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353 #include <rdma/ib_verbs.h> /* RDMA verbs api */
5454
5555 #include <linux/sunrpc/clnt.h> /* rpc_xprt */
56+#include <linux/sunrpc/rpc_rdma_cid.h> /* completion IDs */
5657 #include <linux/sunrpc/rpc_rdma.h> /* RPC/RDMA protocol */
5758 #include <linux/sunrpc/xprtrdma.h> /* xprt parameters */
5859
@@ -93,6 +94,8 @@ struct rpcrdma_ep { · 34 unmodified lines
9394 unsigned int re_max_requests; /* depends on device */
9495 unsigned int re_inline_send; /* negotiated */
9596 unsigned int re_inline_recv; /* negotiated */
97+
98+ atomic_t re_completion_ids;
9699 };
97100
98101 /* Pre-allocate extra Work Requests for handling backward receives
@@ -180,6 +183,8 @@ enum { · 81 unmodified lines
180183
181184 struct rpcrdma_rep {
182185 struct ib_cqe rr_cqe;
186+ struct rpc_rdma_cid rr_cid;
187+
183188 __be32 rr_xid;
184189 __be32 rr_vers;
185190 __be32 rr_proc;
@@ -211,6 +216,7 @@ enum { · 25 unmodified lines
211216 struct rpcrdma_req;
212217 struct rpcrdma_sendctx {
213218 struct ib_cqe sc_cqe;
219+ struct rpc_rdma_cid sc_cid;
214220 struct rpcrdma_req *sc_req;
215221 unsigned int sc_unmap_count;
216222 struct ib_sge sc_sges[];
@@ -225,6 +231,7 @@ struct rpcrdma_sendctx { · 8 unmodified lines
225231 struct rpcrdma_frwr {
226232 struct ib_mr *fr_mr;
227233 struct ib_cqe fr_cqe;
234+ struct rpc_rdma_cid fr_cid;
228235 struct completion fr_linv_done;
229236 union {
230237 struct ib_reg_wr fr_regwr;
@@ -236,6 +243,7 @@ struct rpcrdma_req; · 5 unmodified lines
236243 struct rpcrdma_mr {
237244 struct list_head mr_list;
238245 struct rpcrdma_req *mr_req;
246+ struct ib_device *mr_device;
239247 struct scatterlist *mr_sg;
240248 int mr_nents;
241249 enum dma_data_direction mr_dir;
@@ -466,7 +474,6 @@ void rpcrdma_buffer_destroy(struct rpcrdma_buffer *); · 224 unmodified lines
466474 struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked(struct rpcrdma_xprt *r_xprt);
467475
468476 struct rpcrdma_mr *rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt);
469−void rpcrdma_mr_put(struct rpcrdma_mr *mr);
470477 void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt);
471478
472479 struct rpcrdma_req *rpcrdma_buffer_get(struct rpcrdma_buffer *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t