xprtrdma: Add an xprtrdma_post_send_err tracepoint
authorChuck Lever <chuck.lever@oracle.com>
Mon, 2 Aug 2021 18:44:36 +0000 (14:44 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 9 Aug 2021 20:42:18 +0000 (16:42 -0400)
Unlike xprtrdma_post_send(), this one can be left enabled all the
time, and should almost never fire. But we do want to know about
immediate errors when they happen.

Note that there is already a similar post_linv_err tracepoint.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/trace/events/rpcrdma.h
net/sunrpc/xprtrdma/frwr_ops.c

index d65a84bd040ce03f82c91a005a3aef68ffc44669..de41954995926de1ff021f7d16ffecd174779ddf 100644 (file)
@@ -793,6 +793,39 @@ TRACE_EVENT(xprtrdma_post_send,
        )
 );
 
+TRACE_EVENT(xprtrdma_post_send_err,
+       TP_PROTO(
+               const struct rpcrdma_xprt *r_xprt,
+               const struct rpcrdma_req *req,
+               int rc
+       ),
+
+       TP_ARGS(r_xprt, req, rc),
+
+       TP_STRUCT__entry(
+               __field(u32, cq_id)
+               __field(unsigned int, task_id)
+               __field(unsigned int, client_id)
+               __field(int, rc)
+       ),
+
+       TP_fast_assign(
+               const struct rpc_rqst *rqst = &req->rl_slot;
+               const struct rpcrdma_ep *ep = r_xprt->rx_ep;
+
+               __entry->cq_id = ep ? ep->re_attr.recv_cq->res.id : 0;
+               __entry->task_id = rqst->rq_task->tk_pid;
+               __entry->client_id = rqst->rq_task->tk_client ?
+                                    rqst->rq_task->tk_client->cl_clid : -1;
+               __entry->rc = rc;
+       ),
+
+       TP_printk("task:%u@%u cq.id=%u rc=%d",
+               __entry->task_id, __entry->client_id,
+               __entry->cq_id, __entry->rc
+       )
+);
+
 TRACE_EVENT(xprtrdma_post_recv,
        TP_PROTO(
                const struct rpcrdma_rep *rep
index 754c5dffe1272e12a3c8e661e4b2bac21e2853db..f700b34a5bfd24d8260b0b3641a29195368ef48c 100644 (file)
@@ -394,6 +394,7 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
        struct rpcrdma_ep *ep = r_xprt->rx_ep;
        struct rpcrdma_mr *mr;
        unsigned int num_wrs;
+       int ret;
 
        num_wrs = 1;
        post_wr = send_wr;
@@ -420,7 +421,10 @@ int frwr_send(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
        }
 
        trace_xprtrdma_post_send(req);
-       return ib_post_send(ep->re_id->qp, post_wr, NULL);
+       ret = ib_post_send(ep->re_id->qp, post_wr, NULL);
+       if (ret)
+               trace_xprtrdma_post_send_err(r_xprt, req, ret);
+       return ret;
 }
 
 /**