diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2017-12-20 16:31:53 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-01-23 09:44:38 -0500 |
commit | ae7246762530af00109c3fb8a30031da054c0aa0 (patch) | |
tree | da91efc5273fd37a447c96d83a6b22a25e298990 | |
parent | 643cf3237db83e1443fa61de896449858393cb72 (diff) |
xprtrdma: Instrument allocation/release of rpcrdma_req/rep objects
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | include/trace/events/rpcrdma.h | 67 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/transport.c | 12 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/verbs.c | 4 |
3 files changed, 74 insertions, 9 deletions
diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h index 1e5ae57a4f0d..50ed3f8bf534 100644 --- a/include/trace/events/rpcrdma.h +++ b/include/trace/events/rpcrdma.h | |||
@@ -784,6 +784,73 @@ TRACE_EVENT(xprtrdma_decode_seg, | |||
784 | ); | 784 | ); |
785 | 785 | ||
786 | /** | 786 | /** |
787 | ** Allocation/release of rpcrdma_reqs and rpcrdma_reps | ||
788 | **/ | ||
789 | |||
790 | TRACE_EVENT(xprtrdma_allocate, | ||
791 | TP_PROTO( | ||
792 | const struct rpc_task *task, | ||
793 | const struct rpcrdma_req *req | ||
794 | ), | ||
795 | |||
796 | TP_ARGS(task, req), | ||
797 | |||
798 | TP_STRUCT__entry( | ||
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) | ||
805 | ), | ||
806 | |||
807 | TP_fast_assign( | ||
808 | __entry->task_id = task->tk_pid; | ||
809 | __entry->client_id = task->tk_client->cl_clid; | ||
810 | __entry->req = req; | ||
811 | __entry->rep = req ? req->rl_reply : NULL; | ||
812 | __entry->callsize = task->tk_rqstp->rq_callsize; | ||
813 | __entry->rcvsize = task->tk_rqstp->rq_rcvsize; | ||
814 | ), | ||
815 | |||
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 | ||
820 | ) | ||
821 | ); | ||
822 | |||
823 | TRACE_EVENT(xprtrdma_rpc_done, | ||
824 | TP_PROTO( | ||
825 | const struct rpc_task *task, | ||
826 | const struct rpcrdma_req *req | ||
827 | ), | ||
828 | |||
829 | TP_ARGS(task, req), | ||
830 | |||
831 | TP_STRUCT__entry( | ||
832 | __field(unsigned int, task_id) | ||
833 | __field(unsigned int, client_id) | ||
834 | __field(const void *, req) | ||
835 | __field(const void *, rep) | ||
836 | ), | ||
837 | |||
838 | TP_fast_assign( | ||
839 | __entry->task_id = task->tk_pid; | ||
840 | __entry->client_id = task->tk_client->cl_clid; | ||
841 | __entry->req = req; | ||
842 | __entry->rep = req->rl_reply; | ||
843 | ), | ||
844 | |||
845 | TP_printk("task:%u@%u req=%p rep=%p", | ||
846 | __entry->task_id, __entry->client_id, | ||
847 | __entry->req, __entry->rep | ||
848 | ) | ||
849 | ); | ||
850 | |||
851 | DEFINE_RXPRT_EVENT(xprtrdma_noreps); | ||
852 | |||
853 | /** | ||
787 | ** Callback events | 854 | ** Callback events |
788 | **/ | 855 | **/ |
789 | 856 | ||
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 25d1160dc085..b90179af88bf 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -640,7 +640,7 @@ xprt_rdma_allocate(struct rpc_task *task) | |||
640 | 640 | ||
641 | req = rpcrdma_buffer_get(&r_xprt->rx_buf); | 641 | req = rpcrdma_buffer_get(&r_xprt->rx_buf); |
642 | if (req == NULL) | 642 | if (req == NULL) |
643 | return -ENOMEM; | 643 | goto out_get; |
644 | 644 | ||
645 | flags = RPCRDMA_DEF_GFP; | 645 | flags = RPCRDMA_DEF_GFP; |
646 | if (RPC_IS_SWAPPER(task)) | 646 | if (RPC_IS_SWAPPER(task)) |
@@ -653,19 +653,18 @@ xprt_rdma_allocate(struct rpc_task *task) | |||
653 | if (!rpcrdma_get_recvbuf(r_xprt, req, rqst->rq_rcvsize, flags)) | 653 | if (!rpcrdma_get_recvbuf(r_xprt, req, rqst->rq_rcvsize, flags)) |
654 | goto out_fail; | 654 | goto out_fail; |
655 | 655 | ||
656 | dprintk("RPC: %5u %s: send size = %zd, recv size = %zd, req = %p\n", | ||
657 | task->tk_pid, __func__, rqst->rq_callsize, | ||
658 | rqst->rq_rcvsize, req); | ||
659 | |||
660 | req->rl_cpu = smp_processor_id(); | 656 | req->rl_cpu = smp_processor_id(); |
661 | req->rl_connect_cookie = 0; /* our reserved value */ | 657 | req->rl_connect_cookie = 0; /* our reserved value */ |
662 | rpcrdma_set_xprtdata(rqst, req); | 658 | rpcrdma_set_xprtdata(rqst, req); |
663 | rqst->rq_buffer = req->rl_sendbuf->rg_base; | 659 | rqst->rq_buffer = req->rl_sendbuf->rg_base; |
664 | rqst->rq_rbuffer = req->rl_recvbuf->rg_base; | 660 | rqst->rq_rbuffer = req->rl_recvbuf->rg_base; |
661 | trace_xprtrdma_allocate(task, req); | ||
665 | return 0; | 662 | return 0; |
666 | 663 | ||
667 | out_fail: | 664 | out_fail: |
668 | rpcrdma_buffer_put(req); | 665 | rpcrdma_buffer_put(req); |
666 | out_get: | ||
667 | trace_xprtrdma_allocate(task, NULL); | ||
669 | return -ENOMEM; | 668 | return -ENOMEM; |
670 | } | 669 | } |
671 | 670 | ||
@@ -682,10 +681,9 @@ xprt_rdma_free(struct rpc_task *task) | |||
682 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); | 681 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); |
683 | struct rpcrdma_req *req = rpcr_to_rdmar(rqst); | 682 | struct rpcrdma_req *req = rpcr_to_rdmar(rqst); |
684 | 683 | ||
685 | dprintk("RPC: %s: called on 0x%p\n", __func__, req->rl_reply); | ||
686 | |||
687 | if (test_bit(RPCRDMA_REQ_F_PENDING, &req->rl_flags)) | 684 | if (test_bit(RPCRDMA_REQ_F_PENDING, &req->rl_flags)) |
688 | rpcrdma_release_rqst(r_xprt, req); | 685 | rpcrdma_release_rqst(r_xprt, req); |
686 | trace_xprtrdma_rpc_done(task, req); | ||
689 | rpcrdma_buffer_put(req); | 687 | rpcrdma_buffer_put(req); |
690 | } | 688 | } |
691 | 689 | ||
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index fb81d3a4b0b3..57e1139d85bc 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -1385,11 +1385,11 @@ rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) | |||
1385 | req = rpcrdma_buffer_get_req_locked(buffers); | 1385 | req = rpcrdma_buffer_get_req_locked(buffers); |
1386 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); | 1386 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); |
1387 | spin_unlock(&buffers->rb_lock); | 1387 | spin_unlock(&buffers->rb_lock); |
1388 | |||
1388 | return req; | 1389 | return req; |
1389 | 1390 | ||
1390 | out_reqbuf: | 1391 | out_reqbuf: |
1391 | spin_unlock(&buffers->rb_lock); | 1392 | spin_unlock(&buffers->rb_lock); |
1392 | pr_warn("RPC: %s: out of request buffers\n", __func__); | ||
1393 | return NULL; | 1393 | return NULL; |
1394 | } | 1394 | } |
1395 | 1395 | ||
@@ -1612,7 +1612,7 @@ rpcrdma_ep_post_extra_recv(struct rpcrdma_xprt *r_xprt, unsigned int count) | |||
1612 | 1612 | ||
1613 | out_reqbuf: | 1613 | out_reqbuf: |
1614 | spin_unlock(&buffers->rb_lock); | 1614 | spin_unlock(&buffers->rb_lock); |
1615 | pr_warn("%s: no extra receive buffers\n", __func__); | 1615 | trace_xprtrdma_noreps(r_xprt); |
1616 | return -ENOMEM; | 1616 | return -ENOMEM; |
1617 | 1617 | ||
1618 | out_rc: | 1618 | out_rc: |