Skip to content

Commit 8dcc572

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
svcrdma: Split the svcrdma_wc_receive() tracepoint
There are currently three separate purposes being served by a single tracepoint here. They need to be split up. svcrdma_wc_recv: - 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_recv_flush: - As above, needed only rarely, and not an error. svcrdma_wc_recv_err: - received is always zero, so there's no value in recording it. - This tracepoint can be left 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 dae9a6c commit 8dcc572

File tree

2 files changed

+81
-3
lines changed

2 files changed

+81
-3
lines changed

include/trace/events/rpcrdma.h

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,77 @@ DECLARE_EVENT_CLASS(rpcrdma_receive_completion_class,
145145
), \
146146
TP_ARGS(wc, cid))
147147

148+
DECLARE_EVENT_CLASS(rpcrdma_receive_success_class,
149+
TP_PROTO(
150+
const struct ib_wc *wc,
151+
const struct rpc_rdma_cid *cid
152+
),
153+
154+
TP_ARGS(wc, cid),
155+
156+
TP_STRUCT__entry(
157+
__field(u32, cq_id)
158+
__field(int, completion_id)
159+
__field(u32, received)
160+
),
161+
162+
TP_fast_assign(
163+
__entry->cq_id = cid->ci_queue_id;
164+
__entry->completion_id = cid->ci_completion_id;
165+
__entry->received = wc->byte_len;
166+
),
167+
168+
TP_printk("cq.id=%u cid=%d received=%u",
169+
__entry->cq_id, __entry->completion_id,
170+
__entry->received
171+
)
172+
);
173+
174+
#define DEFINE_RECEIVE_SUCCESS_EVENT(name) \
175+
DEFINE_EVENT(rpcrdma_receive_success_class, name, \
176+
TP_PROTO( \
177+
const struct ib_wc *wc, \
178+
const struct rpc_rdma_cid *cid \
179+
), \
180+
TP_ARGS(wc, cid))
181+
182+
DECLARE_EVENT_CLASS(rpcrdma_receive_flush_class,
183+
TP_PROTO(
184+
const struct ib_wc *wc,
185+
const struct rpc_rdma_cid *cid
186+
),
187+
188+
TP_ARGS(wc, cid),
189+
190+
TP_STRUCT__entry(
191+
__field(u32, cq_id)
192+
__field(int, completion_id)
193+
__field(unsigned long, status)
194+
__field(unsigned int, vendor_err)
195+
),
196+
197+
TP_fast_assign(
198+
__entry->cq_id = cid->ci_queue_id;
199+
__entry->completion_id = cid->ci_completion_id;
200+
__entry->status = wc->status;
201+
__entry->vendor_err = wc->vendor_err;
202+
),
203+
204+
TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
205+
__entry->cq_id, __entry->completion_id,
206+
rdma_show_wc_status(__entry->status),
207+
__entry->status, __entry->vendor_err
208+
)
209+
);
210+
211+
#define DEFINE_RECEIVE_FLUSH_EVENT(name) \
212+
DEFINE_EVENT(rpcrdma_receive_flush_class, name, \
213+
TP_PROTO( \
214+
const struct ib_wc *wc, \
215+
const struct rpc_rdma_cid *cid \
216+
), \
217+
TP_ARGS(wc, cid))
218+
148219
DECLARE_EVENT_CLASS(xprtrdma_reply_class,
149220
TP_PROTO(
150221
const struct rpcrdma_rep *rep
@@ -1892,7 +1963,9 @@ TRACE_EVENT(svcrdma_post_recv,
18921963
)
18931964
);
18941965

1895-
DEFINE_RECEIVE_COMPLETION_EVENT(svcrdma_wc_receive);
1966+
DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv);
1967+
DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush);
1968+
DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_err);
18961969

18971970
TRACE_EVENT(svcrdma_rq_post_err,
18981971
TP_PROTO(

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
330330
/* WARNING: Only wc->wr_cqe and wc->status are reliable */
331331
ctxt = container_of(cqe, struct svc_rdma_recv_ctxt, rc_cqe);
332332

333-
trace_svcrdma_wc_receive(wc, &ctxt->rc_cid);
334333
if (wc->status != IB_WC_SUCCESS)
335334
goto flushed;
335+
trace_svcrdma_wc_recv(wc, &ctxt->rc_cid);
336336

337337
/* If receive posting fails, the connection is about to be
338338
* lost anyway. The server will not be able to send a reply
@@ -345,7 +345,7 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
345345
*/
346346
if (rdma->sc_pending_recvs < rdma->sc_max_requests)
347347
if (!svc_rdma_refresh_recvs(rdma, rdma->sc_recv_batch, false))
348-
goto flushed;
348+
goto dropped;
349349

350350
/* All wc fields are now known to be valid */
351351
ctxt->rc_byte_len = wc->byte_len;
@@ -360,6 +360,11 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
360360
return;
361361

362362
flushed:
363+
if (wc->status == IB_WC_WR_FLUSH_ERR)
364+
trace_svcrdma_wc_recv_flush(wc, &ctxt->rc_cid);
365+
else
366+
trace_svcrdma_wc_recv_err(wc, &ctxt->rc_cid);
367+
dropped:
363368
svc_rdma_recv_ctxt_put(rdma, ctxt);
364369
svc_xprt_deferred_close(&rdma->sc_xprt);
365370
}

0 commit comments

Comments
 (0)