Skip to content

Commit eef2d8d

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
svcrdma: Split the svcrdma_wc_send() tracepoint
There are currently three separate purposes being served by a single tracepoint here. They need to be split up. svcrdma_wc_send: - status is always zero, so there's no value in recording it. - vendor_err is meaningless unless status is not zero, so there's no value in recording it. - This tracepoint is needed only when developing modifications, so it should be left disabled most of the time. svcrdma_wc_send_flush: - As above, needed only rarely, and not an error. svcrdma_wc_send_err: - This tracepoint can be left persistently enabled because completion errors are run-time problems (except for FLUSHED_ERR). - Tracepoint name now ends in _err to reflect its purpose. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 8dcc572 commit eef2d8d

File tree

2 files changed

+82
-4
lines changed

2 files changed

+82
-4
lines changed

include/trace/events/rpcrdma.h

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,74 @@ DECLARE_EVENT_CLASS(rpcrdma_completion_class,
6060
), \
6161
TP_ARGS(wc, cid))
6262

63+
DECLARE_EVENT_CLASS(rpcrdma_send_completion_class,
64+
TP_PROTO(
65+
const struct ib_wc *wc,
66+
const struct rpc_rdma_cid *cid
67+
),
68+
69+
TP_ARGS(wc, cid),
70+
71+
TP_STRUCT__entry(
72+
__field(u32, cq_id)
73+
__field(int, completion_id)
74+
),
75+
76+
TP_fast_assign(
77+
__entry->cq_id = cid->ci_queue_id;
78+
__entry->completion_id = cid->ci_completion_id;
79+
),
80+
81+
TP_printk("cq.id=%u cid=%d",
82+
__entry->cq_id, __entry->completion_id
83+
)
84+
);
85+
86+
#define DEFINE_SEND_COMPLETION_EVENT(name) \
87+
DEFINE_EVENT(rpcrdma_send_completion_class, name, \
88+
TP_PROTO( \
89+
const struct ib_wc *wc, \
90+
const struct rpc_rdma_cid *cid \
91+
), \
92+
TP_ARGS(wc, cid))
93+
94+
DECLARE_EVENT_CLASS(rpcrdma_send_flush_class,
95+
TP_PROTO(
96+
const struct ib_wc *wc,
97+
const struct rpc_rdma_cid *cid
98+
),
99+
100+
TP_ARGS(wc, cid),
101+
102+
TP_STRUCT__entry(
103+
__field(u32, cq_id)
104+
__field(int, completion_id)
105+
__field(unsigned long, status)
106+
__field(unsigned int, vendor_err)
107+
),
108+
109+
TP_fast_assign(
110+
__entry->cq_id = cid->ci_queue_id;
111+
__entry->completion_id = cid->ci_completion_id;
112+
__entry->status = wc->status;
113+
__entry->vendor_err = wc->vendor_err;
114+
),
115+
116+
TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
117+
__entry->cq_id, __entry->completion_id,
118+
rdma_show_wc_status(__entry->status),
119+
__entry->status, __entry->vendor_err
120+
)
121+
);
122+
123+
#define DEFINE_SEND_FLUSH_EVENT(name) \
124+
DEFINE_EVENT(rpcrdma_send_flush_class, name, \
125+
TP_PROTO( \
126+
const struct ib_wc *wc, \
127+
const struct rpc_rdma_cid *cid \
128+
), \
129+
TP_ARGS(wc, cid))
130+
63131
DECLARE_EVENT_CLASS(rpcrdma_mr_completion_class,
64132
TP_PROTO(
65133
const struct ib_wc *wc,
@@ -1939,7 +2007,9 @@ TRACE_EVENT(svcrdma_post_send,
19392007
)
19402008
);
19412009

1942-
DEFINE_COMPLETION_EVENT(svcrdma_wc_send);
2010+
DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_send);
2011+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush);
2012+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err);
19432013

19442014
TRACE_EVENT(svcrdma_post_recv,
19452015
TP_PROTO(

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,21 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc)
280280
struct svc_rdma_send_ctxt *ctxt =
281281
container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe);
282282

283-
trace_svcrdma_wc_send(wc, &ctxt->sc_cid);
284-
285283
svc_rdma_wake_send_waiters(rdma, 1);
286284
complete(&ctxt->sc_done);
287285

288286
if (unlikely(wc->status != IB_WC_SUCCESS))
289-
svc_xprt_deferred_close(&rdma->sc_xprt);
287+
goto flushed;
288+
289+
trace_svcrdma_wc_send(wc, &ctxt->sc_cid);
290+
return;
291+
292+
flushed:
293+
if (wc->status != IB_WC_WR_FLUSH_ERR)
294+
trace_svcrdma_wc_send_err(wc, &ctxt->sc_cid);
295+
else
296+
trace_svcrdma_wc_send_flush(wc, &ctxt->sc_cid);
297+
svc_xprt_deferred_close(&rdma->sc_xprt);
290298
}
291299

292300
/**

0 commit comments

Comments
 (0)