Skip to content

Commit f7bd657

Browse files
committed
svcrdma: Introduce infrastructure to support completion IDs
The goal is to replace CQE kernel memory addresses in completion- related tracepoints. Each completion ID matches an incoming Send or Receive completion to a Completion Queue and to a previous ib_post_*(). The ID can then be displayed in an error message or recorded in a trace record. Signed-off-by: Chuck Lever <[email protected]>
1 parent 379c3bc commit f7bd657

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

include/linux/sunrpc/rpc_rdma_cid.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* * Copyright (c) 2020, Oracle and/or its affiliates.
4+
*/
5+
6+
#ifndef RPC_RDMA_CID_H
7+
#define RPC_RDMA_CID_H
8+
9+
/*
10+
* The rpc_rdma_cid struct records completion ID information. A
11+
* completion ID matches an incoming Send or Receive completion
12+
* to a Completion Queue and to a previous ib_post_*(). The ID
13+
* can then be displayed in an error message or recorded in a
14+
* trace record.
15+
*
16+
* This struct is shared between the server and client RPC/RDMA
17+
* transport implementations.
18+
*/
19+
struct rpc_rdma_cid {
20+
u32 ci_queue_id;
21+
int ci_completion_id;
22+
};
23+
24+
#endif /* RPC_RDMA_CID_H */

include/trace/events/rpcrdma.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,56 @@
1111
#define _TRACE_RPCRDMA_H
1212

1313
#include <linux/scatterlist.h>
14+
#include <linux/sunrpc/rpc_rdma_cid.h>
1415
#include <linux/tracepoint.h>
1516
#include <trace/events/rdma.h>
1617

1718
/**
1819
** Event classes
1920
**/
2021

22+
DECLARE_EVENT_CLASS(rpcrdma_completion_class,
23+
TP_PROTO(
24+
const struct ib_wc *wc,
25+
const struct rpc_rdma_cid *cid
26+
),
27+
28+
TP_ARGS(wc, cid),
29+
30+
TP_STRUCT__entry(
31+
__field(u32, cq_id)
32+
__field(int, completion_id)
33+
__field(unsigned long, status)
34+
__field(unsigned int, vendor_err)
35+
),
36+
37+
TP_fast_assign(
38+
__entry->cq_id = cid->ci_queue_id;
39+
__entry->completion_id = cid->ci_completion_id;
40+
__entry->status = wc->status;
41+
if (wc->status)
42+
__entry->vendor_err = wc->vendor_err;
43+
else
44+
__entry->vendor_err = 0;
45+
),
46+
47+
TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
48+
__entry->cq_id, __entry->completion_id,
49+
rdma_show_wc_status(__entry->status),
50+
__entry->status, __entry->vendor_err
51+
)
52+
);
53+
54+
#define DEFINE_COMPLETION_EVENT(name) \
55+
DEFINE_EVENT(rpcrdma_completion_class, name, \
56+
TP_PROTO( \
57+
const struct ib_wc *wc, \
58+
const struct rpc_rdma_cid *cid \
59+
), \
60+
TP_ARGS(wc, cid))
61+
62+
DEFINE_COMPLETION_EVENT(dummy);
63+
2164
DECLARE_EVENT_CLASS(xprtrdma_reply_event,
2265
TP_PROTO(
2366
const struct rpcrdma_rep *rep

0 commit comments

Comments
 (0)