xprtrdma: Clean up of xprtrdma chunk trace points
authorChuck Lever <chuck.lever@oracle.com>
Wed, 19 Dec 2018 15:59:49 +0000 (10:59 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 2 Jan 2019 17:05:18 +0000 (12:05 -0500)
The chunk-related trace points capture nearly the same information
as the MR-related trace points.

Also, rename them so globbing can be used to enable or disable
these trace points more easily.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/trace/events/rpcrdma.h
net/sunrpc/xprtrdma/rpc_rdma.c

index 2efe2d7d6683a5fa5ed622e5b4e1f059d190d22c..e9fbf7dbc16faef731a9b397b91d9a4c30c353e4 100644 (file)
@@ -97,7 +97,6 @@ DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
        TP_STRUCT__entry(
                __field(unsigned int, task_id)
                __field(unsigned int, client_id)
-               __field(const void *, mr)
                __field(unsigned int, pos)
                __field(int, nents)
                __field(u32, handle)
@@ -109,7 +108,6 @@ DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
        TP_fast_assign(
                __entry->task_id = task->tk_pid;
                __entry->client_id = task->tk_client->cl_clid;
-               __entry->mr = mr;
                __entry->pos = pos;
                __entry->nents = mr->mr_nents;
                __entry->handle = mr->mr_handle;
@@ -118,8 +116,8 @@ DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
                __entry->nsegs = nsegs;
        ),
 
-       TP_printk("task:%u@%u mr=%p pos=%u %u@0x%016llx:0x%08x (%s)",
-               __entry->task_id, __entry->client_id, __entry->mr,
+       TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)",
+               __entry->task_id, __entry->client_id,
                __entry->pos, __entry->length,
                (unsigned long long)__entry->offset, __entry->handle,
                __entry->nents < __entry->nsegs ? "more" : "last"
@@ -127,7 +125,7 @@ DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
 );
 
 #define DEFINE_RDCH_EVENT(name)                                                \
-               DEFINE_EVENT(xprtrdma_rdch_event, name,                 \
+               DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\
                                TP_PROTO(                               \
                                        const struct rpc_task *task,    \
                                        unsigned int pos,               \
@@ -148,7 +146,6 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
        TP_STRUCT__entry(
                __field(unsigned int, task_id)
                __field(unsigned int, client_id)
-               __field(const void *, mr)
                __field(int, nents)
                __field(u32, handle)
                __field(u32, length)
@@ -159,7 +156,6 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
        TP_fast_assign(
                __entry->task_id = task->tk_pid;
                __entry->client_id = task->tk_client->cl_clid;
-               __entry->mr = mr;
                __entry->nents = mr->mr_nents;
                __entry->handle = mr->mr_handle;
                __entry->length = mr->mr_length;
@@ -167,8 +163,8 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
                __entry->nsegs = nsegs;
        ),
 
-       TP_printk("task:%u@%u mr=%p %u@0x%016llx:0x%08x (%s)",
-               __entry->task_id, __entry->client_id, __entry->mr,
+       TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)",
+               __entry->task_id, __entry->client_id,
                __entry->length, (unsigned long long)__entry->offset,
                __entry->handle,
                __entry->nents < __entry->nsegs ? "more" : "last"
@@ -176,7 +172,7 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
 );
 
 #define DEFINE_WRCH_EVENT(name)                                                \
-               DEFINE_EVENT(xprtrdma_wrch_event, name,                 \
+               DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\
                                TP_PROTO(                               \
                                        const struct rpc_task *task,    \
                                        struct rpcrdma_mr *mr,          \
@@ -234,6 +230,18 @@ DECLARE_EVENT_CLASS(xprtrdma_frwr_done,
                                ),                                      \
                                TP_ARGS(wc, frwr))
 
+TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL);
+TRACE_DEFINE_ENUM(DMA_TO_DEVICE);
+TRACE_DEFINE_ENUM(DMA_FROM_DEVICE);
+TRACE_DEFINE_ENUM(DMA_NONE);
+
+#define xprtrdma_show_direction(x)                                     \
+               __print_symbolic(x,                                     \
+                               { DMA_BIDIRECTIONAL, "BIDIR" },         \
+                               { DMA_TO_DEVICE, "TO_DEVICE" },         \
+                               { DMA_FROM_DEVICE, "FROM_DEVICE" },     \
+                               { DMA_NONE, "NONE" })
+
 DECLARE_EVENT_CLASS(xprtrdma_mr,
        TP_PROTO(
                const struct rpcrdma_mr *mr
@@ -246,6 +254,7 @@ DECLARE_EVENT_CLASS(xprtrdma_mr,
                __field(u32, handle)
                __field(u32, length)
                __field(u64, offset)
+               __field(u32, dir)
        ),
 
        TP_fast_assign(
@@ -253,12 +262,13 @@ DECLARE_EVENT_CLASS(xprtrdma_mr,
                __entry->handle = mr->mr_handle;
                __entry->length = mr->mr_length;
                __entry->offset = mr->mr_offset;
+               __entry->dir    = mr->mr_dir;
        ),
 
-       TP_printk("mr=%p %u@0x%016llx:0x%08x",
+       TP_printk("mr=%p %u@0x%016llx:0x%08x (%s)",
                __entry->mr, __entry->length,
-               (unsigned long long)__entry->offset,
-               __entry->handle
+               (unsigned long long)__entry->offset, __entry->handle,
+               xprtrdma_show_direction(__entry->dir)
        )
 );
 
@@ -437,9 +447,9 @@ TRACE_EVENT(xprtrdma_createmrs,
 
 DEFINE_RXPRT_EVENT(xprtrdma_nomrs);
 
-DEFINE_RDCH_EVENT(xprtrdma_read_chunk);
-DEFINE_WRCH_EVENT(xprtrdma_write_chunk);
-DEFINE_WRCH_EVENT(xprtrdma_reply_chunk);
+DEFINE_RDCH_EVENT(read);
+DEFINE_WRCH_EVENT(write);
+DEFINE_WRCH_EVENT(reply);
 
 TRACE_DEFINE_ENUM(rpcrdma_noch);
 TRACE_DEFINE_ENUM(rpcrdma_readch);
index 5a587698c8857470e1c325e671038161ce88294b..54fbd70c661c3fdd0c0d29c1b4e7f51865b1ae5c 100644 (file)
@@ -365,7 +365,7 @@ rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
                if (encode_read_segment(xdr, mr, pos) < 0)
                        return -EMSGSIZE;
 
-               trace_xprtrdma_read_chunk(rqst->rq_task, pos, mr, nsegs);
+               trace_xprtrdma_chunk_read(rqst->rq_task, pos, mr, nsegs);
                r_xprt->rx_stats.read_chunk_count++;
                nsegs -= mr->mr_nents;
        } while (nsegs);
@@ -422,7 +422,7 @@ rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
                if (encode_rdma_segment(xdr, mr) < 0)
                        return -EMSGSIZE;
 
-               trace_xprtrdma_write_chunk(rqst->rq_task, mr, nsegs);
+               trace_xprtrdma_chunk_write(rqst->rq_task, mr, nsegs);
                r_xprt->rx_stats.write_chunk_count++;
                r_xprt->rx_stats.total_rdma_request += mr->mr_length;
                nchunks++;
@@ -479,7 +479,7 @@ rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
                if (encode_rdma_segment(xdr, mr) < 0)
                        return -EMSGSIZE;
 
-               trace_xprtrdma_reply_chunk(rqst->rq_task, mr, nsegs);
+               trace_xprtrdma_chunk_reply(rqst->rq_task, mr, nsegs);
                r_xprt->rx_stats.reply_chunk_count++;
                r_xprt->rx_stats.total_rdma_request += mr->mr_length;
                nchunks++;