Skip to content

Commit ae72467

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Instrument allocation/release of rpcrdma_req/rep objects
Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 643cf32 commit ae72467

File tree

3 files changed

+74
-9
lines changed

3 files changed

+74
-9
lines changed

include/trace/events/rpcrdma.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,73 @@ TRACE_EVENT(xprtrdma_decode_seg,
783783
)
784784
);
785785

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+
786853
/**
787854
** Callback events
788855
**/

net/sunrpc/xprtrdma/transport.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ xprt_rdma_allocate(struct rpc_task *task)
640640

641641
req = rpcrdma_buffer_get(&r_xprt->rx_buf);
642642
if (req == NULL)
643-
return -ENOMEM;
643+
goto out_get;
644644

645645
flags = RPCRDMA_DEF_GFP;
646646
if (RPC_IS_SWAPPER(task))
@@ -653,19 +653,18 @@ xprt_rdma_allocate(struct rpc_task *task)
653653
if (!rpcrdma_get_recvbuf(r_xprt, req, rqst->rq_rcvsize, flags))
654654
goto out_fail;
655655

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-
660656
req->rl_cpu = smp_processor_id();
661657
req->rl_connect_cookie = 0; /* our reserved value */
662658
rpcrdma_set_xprtdata(rqst, req);
663659
rqst->rq_buffer = req->rl_sendbuf->rg_base;
664660
rqst->rq_rbuffer = req->rl_recvbuf->rg_base;
661+
trace_xprtrdma_allocate(task, req);
665662
return 0;
666663

667664
out_fail:
668665
rpcrdma_buffer_put(req);
666+
out_get:
667+
trace_xprtrdma_allocate(task, NULL);
669668
return -ENOMEM;
670669
}
671670

@@ -682,10 +681,9 @@ xprt_rdma_free(struct rpc_task *task)
682681
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
683682
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
684683

685-
dprintk("RPC: %s: called on 0x%p\n", __func__, req->rl_reply);
686-
687684
if (test_bit(RPCRDMA_REQ_F_PENDING, &req->rl_flags))
688685
rpcrdma_release_rqst(r_xprt, req);
686+
trace_xprtrdma_rpc_done(task, req);
689687
rpcrdma_buffer_put(req);
690688
}
691689

net/sunrpc/xprtrdma/verbs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,11 +1385,11 @@ rpcrdma_buffer_get(struct rpcrdma_buffer *buffers)
13851385
req = rpcrdma_buffer_get_req_locked(buffers);
13861386
req->rl_reply = rpcrdma_buffer_get_rep(buffers);
13871387
spin_unlock(&buffers->rb_lock);
1388+
13881389
return req;
13891390

13901391
out_reqbuf:
13911392
spin_unlock(&buffers->rb_lock);
1392-
pr_warn("RPC: %s: out of request buffers\n", __func__);
13931393
return NULL;
13941394
}
13951395

@@ -1612,7 +1612,7 @@ rpcrdma_ep_post_extra_recv(struct rpcrdma_xprt *r_xprt, unsigned int count)
16121612

16131613
out_reqbuf:
16141614
spin_unlock(&buffers->rb_lock);
1615-
pr_warn("%s: no extra receive buffers\n", __func__);
1615+
trace_xprtrdma_noreps(r_xprt);
16161616
return -ENOMEM;
16171617

16181618
out_rc:

0 commit comments

Comments
 (0)