Skip to content

Commit 62a8950

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Enhance MR-related trace points
Two changes: - Show the number of SG entries that were mapped. This helps debug DMA-related problems. - Record the MR's resource ID instead of its memory address. This groups each MR with its associated rdma-tool output, and reduces needless exposure of memory addresses. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent fb33c65 commit 62a8950

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

include/trace/events/rpcrdma.h

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,20 @@ DECLARE_EVENT_CLASS(xprtrdma_frwr_done,
228228
TP_ARGS(wc, frwr),
229229

230230
TP_STRUCT__entry(
231-
__field(const void *, mr)
231+
__field(u32, mr_id)
232232
__field(unsigned int, status)
233233
__field(unsigned int, vendor_err)
234234
),
235235

236236
TP_fast_assign(
237-
__entry->mr = container_of(frwr, struct rpcrdma_mr, frwr);
237+
__entry->mr_id = frwr->fr_mr->res.id;
238238
__entry->status = wc->status;
239239
__entry->vendor_err = __entry->status ? wc->vendor_err : 0;
240240
),
241241

242242
TP_printk(
243-
"mr=%p: %s (%u/0x%x)",
244-
__entry->mr, rdma_show_wc_status(__entry->status),
243+
"mr.id=%u: %s (%u/0x%x)",
244+
__entry->mr_id, rdma_show_wc_status(__entry->status),
245245
__entry->status, __entry->vendor_err
246246
)
247247
);
@@ -274,23 +274,25 @@ DECLARE_EVENT_CLASS(xprtrdma_mr,
274274
TP_ARGS(mr),
275275

276276
TP_STRUCT__entry(
277-
__field(const void *, mr)
277+
__field(u32, mr_id)
278+
__field(int, nents)
278279
__field(u32, handle)
279280
__field(u32, length)
280281
__field(u64, offset)
281282
__field(u32, dir)
282283
),
283284

284285
TP_fast_assign(
285-
__entry->mr = mr;
286+
__entry->mr_id = mr->frwr.fr_mr->res.id;
287+
__entry->nents = mr->mr_nents;
286288
__entry->handle = mr->mr_handle;
287289
__entry->length = mr->mr_length;
288290
__entry->offset = mr->mr_offset;
289291
__entry->dir = mr->mr_dir;
290292
),
291293

292-
TP_printk("mr=%p %u@0x%016llx:0x%08x (%s)",
293-
__entry->mr, __entry->length,
294+
TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
295+
__entry->mr_id, __entry->nents, __entry->length,
294296
(unsigned long long)__entry->offset, __entry->handle,
295297
xprtrdma_show_direction(__entry->dir)
296298
)
@@ -920,17 +922,17 @@ TRACE_EVENT(xprtrdma_frwr_alloc,
920922
TP_ARGS(mr, rc),
921923

922924
TP_STRUCT__entry(
923-
__field(const void *, mr)
925+
__field(u32, mr_id)
924926
__field(int, rc)
925927
),
926928

927929
TP_fast_assign(
928-
__entry->mr = mr;
929-
__entry->rc = rc;
930+
__entry->mr_id = mr->frwr.fr_mr->res.id;
931+
__entry->rc = rc;
930932
),
931933

932-
TP_printk("mr=%p: rc=%d",
933-
__entry->mr, __entry->rc
934+
TP_printk("mr.id=%u: rc=%d",
935+
__entry->mr_id, __entry->rc
934936
)
935937
);
936938

@@ -943,7 +945,8 @@ TRACE_EVENT(xprtrdma_frwr_dereg,
943945
TP_ARGS(mr, rc),
944946

945947
TP_STRUCT__entry(
946-
__field(const void *, mr)
948+
__field(u32, mr_id)
949+
__field(int, nents)
947950
__field(u32, handle)
948951
__field(u32, length)
949952
__field(u64, offset)
@@ -952,16 +955,17 @@ TRACE_EVENT(xprtrdma_frwr_dereg,
952955
),
953956

954957
TP_fast_assign(
955-
__entry->mr = mr;
958+
__entry->mr_id = mr->frwr.fr_mr->res.id;
959+
__entry->nents = mr->mr_nents;
956960
__entry->handle = mr->mr_handle;
957961
__entry->length = mr->mr_length;
958962
__entry->offset = mr->mr_offset;
959963
__entry->dir = mr->mr_dir;
960964
__entry->rc = rc;
961965
),
962966

963-
TP_printk("mr=%p %u@0x%016llx:0x%08x (%s): rc=%d",
964-
__entry->mr, __entry->length,
967+
TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s): rc=%d",
968+
__entry->mr_id, __entry->nents, __entry->length,
965969
(unsigned long long)__entry->offset, __entry->handle,
966970
xprtrdma_show_direction(__entry->dir),
967971
__entry->rc
@@ -977,21 +981,21 @@ TRACE_EVENT(xprtrdma_frwr_sgerr,
977981
TP_ARGS(mr, sg_nents),
978982

979983
TP_STRUCT__entry(
980-
__field(const void *, mr)
984+
__field(u32, mr_id)
981985
__field(u64, addr)
982986
__field(u32, dir)
983987
__field(int, nents)
984988
),
985989

986990
TP_fast_assign(
987-
__entry->mr = mr;
991+
__entry->mr_id = mr->frwr.fr_mr->res.id;
988992
__entry->addr = mr->mr_sg->dma_address;
989993
__entry->dir = mr->mr_dir;
990994
__entry->nents = sg_nents;
991995
),
992996

993-
TP_printk("mr=%p dma addr=0x%llx (%s) sg_nents=%d",
994-
__entry->mr, __entry->addr,
997+
TP_printk("mr.id=%u DMA addr=0x%llx (%s) sg_nents=%d",
998+
__entry->mr_id, __entry->addr,
995999
xprtrdma_show_direction(__entry->dir),
9961000
__entry->nents
9971001
)
@@ -1006,23 +1010,23 @@ TRACE_EVENT(xprtrdma_frwr_maperr,
10061010
TP_ARGS(mr, num_mapped),
10071011

10081012
TP_STRUCT__entry(
1009-
__field(const void *, mr)
1013+
__field(u32, mr_id)
10101014
__field(u64, addr)
10111015
__field(u32, dir)
10121016
__field(int, num_mapped)
10131017
__field(int, nents)
10141018
),
10151019

10161020
TP_fast_assign(
1017-
__entry->mr = mr;
1021+
__entry->mr_id = mr->frwr.fr_mr->res.id;
10181022
__entry->addr = mr->mr_sg->dma_address;
10191023
__entry->dir = mr->mr_dir;
10201024
__entry->num_mapped = num_mapped;
10211025
__entry->nents = mr->mr_nents;
10221026
),
10231027

1024-
TP_printk("mr=%p dma addr=0x%llx (%s) nents=%d of %d",
1025-
__entry->mr, __entry->addr,
1028+
TP_printk("mr.id=%u DMA addr=0x%llx (%s) nents=%d of %d",
1029+
__entry->mr_id, __entry->addr,
10261030
xprtrdma_show_direction(__entry->dir),
10271031
__entry->num_mapped, __entry->nents
10281032
)
@@ -1031,7 +1035,7 @@ TRACE_EVENT(xprtrdma_frwr_maperr,
10311035
DEFINE_MR_EVENT(localinv);
10321036
DEFINE_MR_EVENT(map);
10331037
DEFINE_MR_EVENT(unmap);
1034-
DEFINE_MR_EVENT(remoteinv);
1038+
DEFINE_MR_EVENT(reminv);
10351039
DEFINE_MR_EVENT(recycle);
10361040

10371041
TRACE_EVENT(xprtrdma_dma_maperr,

net/sunrpc/xprtrdma/frwr_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs)
419419
list_for_each_entry(mr, mrs, mr_list)
420420
if (mr->mr_handle == rep->rr_inv_rkey) {
421421
list_del_init(&mr->mr_list);
422-
trace_xprtrdma_mr_remoteinv(mr);
422+
trace_xprtrdma_mr_reminv(mr);
423423
rpcrdma_mr_put(mr);
424424
break; /* only one invalidated MR per RPC */
425425
}

0 commit comments

Comments
 (0)