Skip to content

Commit 6787f0b

Browse files
committed
svcrdma: Display chunk completion ID when posting a rw_ctxt
Re-use the post_rw tracepoint (safely) to trace cc_info lifetime events, including completion IDs. Signed-off-by: Chuck Lever <[email protected]>
1 parent 17f70f8 commit 6787f0b

File tree

2 files changed

+24
-46
lines changed

2 files changed

+24
-46
lines changed

include/trace/events/rpcrdma.h

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,41 +1802,6 @@ TRACE_EVENT(svcrdma_send_err,
18021802
)
18031803
);
18041804

1805-
DECLARE_EVENT_CLASS(svcrdma_sendcomp_event,
1806-
TP_PROTO(
1807-
const struct ib_wc *wc
1808-
),
1809-
1810-
TP_ARGS(wc),
1811-
1812-
TP_STRUCT__entry(
1813-
__field(const void *, cqe)
1814-
__field(unsigned int, status)
1815-
__field(unsigned int, vendor_err)
1816-
),
1817-
1818-
TP_fast_assign(
1819-
__entry->cqe = wc->wr_cqe;
1820-
__entry->status = wc->status;
1821-
if (wc->status)
1822-
__entry->vendor_err = wc->vendor_err;
1823-
else
1824-
__entry->vendor_err = 0;
1825-
),
1826-
1827-
TP_printk("cqe=%p status=%s (%u/0x%x)",
1828-
__entry->cqe, rdma_show_wc_status(__entry->status),
1829-
__entry->status, __entry->vendor_err
1830-
)
1831-
);
1832-
1833-
#define DEFINE_SENDCOMP_EVENT(name) \
1834-
DEFINE_EVENT(svcrdma_sendcomp_event, svcrdma_wc_##name, \
1835-
TP_PROTO( \
1836-
const struct ib_wc *wc \
1837-
), \
1838-
TP_ARGS(wc))
1839-
18401805
TRACE_EVENT(svcrdma_post_send,
18411806
TP_PROTO(
18421807
const struct svc_rdma_send_ctxt *ctxt
@@ -1916,31 +1881,34 @@ TRACE_EVENT(svcrdma_rq_post_err,
19161881
)
19171882
);
19181883

1919-
TRACE_EVENT(svcrdma_post_rw,
1884+
TRACE_EVENT(svcrdma_post_chunk,
19201885
TP_PROTO(
1921-
const void *cqe,
1886+
const struct rpc_rdma_cid *cid,
19221887
int sqecount
19231888
),
19241889

1925-
TP_ARGS(cqe, sqecount),
1890+
TP_ARGS(cid, sqecount),
19261891

19271892
TP_STRUCT__entry(
1928-
__field(const void *, cqe)
1893+
__field(u32, cq_id)
1894+
__field(int, completion_id)
19291895
__field(int, sqecount)
19301896
),
19311897

19321898
TP_fast_assign(
1933-
__entry->cqe = cqe;
1899+
__entry->cq_id = cid->ci_queue_id;
1900+
__entry->completion_id = cid->ci_completion_id;
19341901
__entry->sqecount = sqecount;
19351902
),
19361903

1937-
TP_printk("cqe=%p sqecount=%d",
1938-
__entry->cqe, __entry->sqecount
1904+
TP_printk("cq.id=%u cid=%d sqecount=%d",
1905+
__entry->cq_id, __entry->completion_id,
1906+
__entry->sqecount
19391907
)
19401908
);
19411909

1942-
DEFINE_SENDCOMP_EVENT(read);
1943-
DEFINE_SENDCOMP_EVENT(write);
1910+
DEFINE_COMPLETION_EVENT(svcrdma_wc_read);
1911+
DEFINE_COMPLETION_EVENT(svcrdma_wc_write);
19441912

19451913
TRACE_EVENT(svcrdma_qp_error,
19461914
TP_PROTO(

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,24 @@ static int svc_rdma_rw_ctx_init(struct svcxprt_rdma *rdma,
145145
* demand, and not cached.
146146
*/
147147
struct svc_rdma_chunk_ctxt {
148+
struct rpc_rdma_cid cc_cid;
148149
struct ib_cqe cc_cqe;
149150
struct svcxprt_rdma *cc_rdma;
150151
struct list_head cc_rwctxts;
151152
int cc_sqecount;
152153
};
153154

155+
static void svc_rdma_cc_cid_init(struct svcxprt_rdma *rdma,
156+
struct rpc_rdma_cid *cid)
157+
{
158+
cid->ci_queue_id = rdma->sc_sq_cq->res.id;
159+
cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids);
160+
}
161+
154162
static void svc_rdma_cc_init(struct svcxprt_rdma *rdma,
155163
struct svc_rdma_chunk_ctxt *cc)
156164
{
165+
svc_rdma_cc_cid_init(rdma, &cc->cc_cid);
157166
cc->cc_rdma = rdma;
158167
svc_xprt_get(&rdma->sc_xprt);
159168

@@ -237,7 +246,7 @@ static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
237246
struct svc_rdma_write_info *info =
238247
container_of(cc, struct svc_rdma_write_info, wi_cc);
239248

240-
trace_svcrdma_wc_write(wc);
249+
trace_svcrdma_wc_write(wc, &cc->cc_cid);
241250

242251
atomic_add(cc->cc_sqecount, &rdma->sc_sq_avail);
243252
wake_up(&rdma->sc_send_wait);
@@ -295,7 +304,7 @@ static void svc_rdma_wc_read_done(struct ib_cq *cq, struct ib_wc *wc)
295304
struct svc_rdma_read_info *info =
296305
container_of(cc, struct svc_rdma_read_info, ri_cc);
297306

298-
trace_svcrdma_wc_read(wc);
307+
trace_svcrdma_wc_read(wc, &cc->cc_cid);
299308

300309
atomic_add(cc->cc_sqecount, &rdma->sc_sq_avail);
301310
wake_up(&rdma->sc_send_wait);
@@ -351,6 +360,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
351360
do {
352361
if (atomic_sub_return(cc->cc_sqecount,
353362
&rdma->sc_sq_avail) > 0) {
363+
trace_svcrdma_post_chunk(&cc->cc_cid, cc->cc_sqecount);
354364
ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr);
355365
if (ret)
356366
break;

0 commit comments

Comments
 (0)