svcrdma: Introduce infrastructure to support completion IDs
authorChuck Lever <chuck.lever@oracle.com>
Tue, 19 May 2020 13:30:32 +0000 (09:30 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 13 Jul 2020 21:28:24 +0000 (17:28 -0400)
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 <chuck.lever@oracle.com>
include/linux/sunrpc/rpc_rdma_cid.h [new file with mode: 0644]
include/trace/events/rpcrdma.h

diff --git a/include/linux/sunrpc/rpc_rdma_cid.h b/include/linux/sunrpc/rpc_rdma_cid.h
new file mode 100644 (file)
index 0000000..be24ab2
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * * Copyright (c) 2020, Oracle and/or its affiliates.
+ */
+
+#ifndef RPC_RDMA_CID_H
+#define RPC_RDMA_CID_H
+
+/*
+ * The rpc_rdma_cid struct records completion ID information. A
+ * 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.
+ *
+ * This struct is shared between the server and client RPC/RDMA
+ * transport implementations.
+ */
+struct rpc_rdma_cid {
+       u32                     ci_queue_id;
+       int                     ci_completion_id;
+};
+
+#endif /* RPC_RDMA_CID_H */
index 0eff80dee06661d1da7c7adba03b26b5503f992c..70ab989aa3b7a3bf4171d04738358f7c53c433a5 100644 (file)
@@ -11,6 +11,7 @@
 #define _TRACE_RPCRDMA_H
 
 #include <linux/scatterlist.h>
+#include <linux/sunrpc/rpc_rdma_cid.h>
 #include <linux/tracepoint.h>
 #include <trace/events/rdma.h>
 
  ** Event classes
  **/
 
+DECLARE_EVENT_CLASS(rpcrdma_completion_class,
+       TP_PROTO(
+               const struct ib_wc *wc,
+               const struct rpc_rdma_cid *cid
+       ),
+
+       TP_ARGS(wc, cid),
+
+       TP_STRUCT__entry(
+               __field(u32, cq_id)
+               __field(int, completion_id)
+               __field(unsigned long, status)
+               __field(unsigned int, vendor_err)
+       ),
+
+       TP_fast_assign(
+               __entry->cq_id = cid->ci_queue_id;
+               __entry->completion_id = cid->ci_completion_id;
+               __entry->status = wc->status;
+               if (wc->status)
+                       __entry->vendor_err = wc->vendor_err;
+               else
+                       __entry->vendor_err = 0;
+       ),
+
+       TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
+               __entry->cq_id, __entry->completion_id,
+               rdma_show_wc_status(__entry->status),
+               __entry->status, __entry->vendor_err
+       )
+);
+
+#define DEFINE_COMPLETION_EVENT(name)                                  \
+               DEFINE_EVENT(rpcrdma_completion_class, name,            \
+                               TP_PROTO(                               \
+                                       const struct ib_wc *wc,         \
+                                       const struct rpc_rdma_cid *cid  \
+                               ),                                      \
+                               TP_ARGS(wc, cid))
+
+DEFINE_COMPLETION_EVENT(dummy);
+
 DECLARE_EVENT_CLASS(xprtrdma_reply_event,
        TP_PROTO(
                const struct rpcrdma_rep *rep