Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chuck Lever and committed by
Anna Schumaker
ae724676 643cf323

+74 -9
+67
include/trace/events/rpcrdma.h
··· 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 854 ** Callback events 788 855 **/ 789 856
+5 -7
net/sunrpc/xprtrdma/transport.c
··· 640 640 641 641 req = rpcrdma_buffer_get(&r_xprt->rx_buf); 642 642 if (req == NULL) 643 - return -ENOMEM; 643 + goto out_get; 644 644 645 645 flags = RPCRDMA_DEF_GFP; 646 646 if (RPC_IS_SWAPPER(task)) ··· 653 653 if (!rpcrdma_get_recvbuf(r_xprt, req, rqst->rq_rcvsize, flags)) 654 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 656 req->rl_cpu = smp_processor_id(); 661 657 req->rl_connect_cookie = 0; /* our reserved value */ 662 658 rpcrdma_set_xprtdata(rqst, req); 663 659 rqst->rq_buffer = req->rl_sendbuf->rg_base; 664 660 rqst->rq_rbuffer = req->rl_recvbuf->rg_base; 661 + trace_xprtrdma_allocate(task, req); 665 662 return 0; 666 663 667 664 out_fail: 668 665 rpcrdma_buffer_put(req); 666 + out_get: 667 + trace_xprtrdma_allocate(task, NULL); 669 668 return -ENOMEM; 670 669 } 671 670 ··· 681 682 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); 682 683 struct rpcrdma_req *req = rpcr_to_rdmar(rqst); 683 684 684 - dprintk("RPC: %s: called on 0x%p\n", __func__, req->rl_reply); 685 - 686 685 if (test_bit(RPCRDMA_REQ_F_PENDING, &req->rl_flags)) 687 686 rpcrdma_release_rqst(r_xprt, req); 687 + trace_xprtrdma_rpc_done(task, req); 688 688 rpcrdma_buffer_put(req); 689 689 } 690 690
+2 -2
net/sunrpc/xprtrdma/verbs.c
··· 1385 1385 req = rpcrdma_buffer_get_req_locked(buffers); 1386 1386 req->rl_reply = rpcrdma_buffer_get_rep(buffers); 1387 1387 spin_unlock(&buffers->rb_lock); 1388 + 1388 1389 return req; 1389 1390 1390 1391 out_reqbuf: 1391 1392 spin_unlock(&buffers->rb_lock); 1392 - pr_warn("RPC: %s: out of request buffers\n", __func__); 1393 1393 return NULL; 1394 1394 } 1395 1395 ··· 1612 1612 1613 1613 out_reqbuf: 1614 1614 spin_unlock(&buffers->rb_lock); 1615 - pr_warn("%s: no extra receive buffers\n", __func__); 1615 + trace_xprtrdma_noreps(r_xprt); 1616 1616 return -ENOMEM; 1617 1617 1618 1618 out_rc: