[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <166126397621.708021.17666049570505935252.stgit@warthog.procyon.org.uk>
Date: Tue, 23 Aug 2022 15:12:56 +0100
From: David Howells <dhowells@...hat.com>
To: Steve French <smfrench@...il.com>,
Al Viro <viro@...iv.linux.org.uk>
Cc: dhowells@...hat.com, Shyam Prasad N <nspmangalore@...il.com>,
Rohith Surabattula <rohiths.msft@...il.com>,
Jeff Layton <jlayton@...nel.org>, linux-cifs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 7/7] cifs: Add some RDMA send tracepoints
Add some tracepoints to help trace RDMA in cifs.
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/cifs/smbdirect.c | 15 +++++++-
fs/cifs/trace.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
index 578c24d5a941..711beb3722e3 100644
--- a/fs/cifs/smbdirect.c
+++ b/fs/cifs/smbdirect.c
@@ -1945,6 +1945,8 @@ static ssize_t smbd_post_send_iter_scanner(struct iov_iter *iter, const void *p,
ctx->len += len;
log_write(INFO, "sending page i=%d offset=%zu size=%zu remaining_data_length=%d\n",
ix, offset, len, *ctx->_remaining_data_length);
+ trace_smb3_rdma_page(ctx->num_rqst, ctx->rqst_idx, ix, offset, len,
+ iov_iter_count(iter), *ctx->_remaining_data_length);
*ctx->_remaining_data_length -= len;
ctx->nsg++;
return len;
@@ -2043,19 +2045,27 @@ int smbd_send(struct TCP_Server_Info *server,
klen += rqst->rq_iov[i].iov_len;
iov_iter_kvec(&iter, WRITE, rqst->rq_iov, rqst->rq_nvec, klen);
+ trace_smb3_rdma_send(num_rqst, rqst_idx, rqst->rq_nvec, klen,
+ iov_iter_count(&rqst->rq_iter), remaining_data_length);
+
rc = smbd_post_send_iter(info, &iter, num_rqst, rqst_idx,
&remaining_data_length);
- if (rc < 0)
+ if (rc < 0) {
+ trace_smb3_rdma_fail(num_rqst, rqst_idx, 1, rc);
goto done;
+ }
if (iov_iter_count(&rqst->rq_iter) > 0) {
/* And then the data pages if there are any */
rc = smbd_post_send_iter(info, &rqst->rq_iter, num_rqst, rqst_idx,
&remaining_data_length);
- if (rc < 0)
+ if (rc < 0) {
+ trace_smb3_rdma_fail(num_rqst, rqst_idx, 2, rc);
goto done;
+ }
}
+ trace_smb3_rdma_done(num_rqst, rqst_idx, 3);
rqst_idx++;
if (rqst_idx < num_rqst)
goto next_rqst;
@@ -2282,6 +2292,7 @@ static ssize_t smbd_iter_to_mr_scanner(struct iov_iter *iter, const void *p,
sg_set_buf(&ctx->sgl[ix], p, len);
log_write(INFO, "sending page i=%d offset=%zu size=%zu\n",
ix, offset, len);
+ trace_smb3_rdma_page(0, 0, ix, offset, len, iov_iter_count(iter), 0);
ctx->nsg++;
return len;
}
diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h
index 6b88dc2e364f..70640232b572 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -1055,6 +1055,101 @@ DEFINE_SMB3_CREDIT_EVENT(waitff_credits);
DEFINE_SMB3_CREDIT_EVENT(overflow_credits);
DEFINE_SMB3_CREDIT_EVENT(set_credits);
+TRACE_EVENT(smb3_rdma_send,
+ TP_PROTO(unsigned int nr_rqst, unsigned int sub_rqst,
+ unsigned int nr_kvec, unsigned int kvec_len,
+ unsigned int iter_len, unsigned int remaining_len),
+ TP_ARGS(nr_rqst, sub_rqst, nr_kvec, kvec_len, iter_len, remaining_len),
+ TP_STRUCT__entry(
+ __field(u8, nr_rqst)
+ __field(u8, sub_rqst)
+ __field(u8, nr_kvec)
+ __field(unsigned int, kvec_len)
+ __field(unsigned int, iter_len)
+ __field(unsigned int, remaining_len)
+ ),
+ TP_fast_assign(
+ __entry->nr_rqst = nr_rqst;
+ __entry->sub_rqst = sub_rqst;
+ __entry->nr_kvec = nr_kvec;
+ __entry->kvec_len = kvec_len;
+ __entry->iter_len = iter_len;
+ __entry->remaining_len = remaining_len;
+ ),
+ TP_printk("nrq=%u/%u nkv=%u kvl=%u iter=%u rem=%u",
+ __entry->sub_rqst + 1, __entry->nr_rqst,
+ __entry->nr_kvec, __entry->kvec_len,
+ __entry->iter_len, __entry->remaining_len)
+ )
+
+TRACE_EVENT(smb3_rdma_page,
+ TP_PROTO(unsigned int nr_rqst, unsigned int sub_rqst,
+ unsigned int i, size_t offset, ssize_t len,
+ unsigned int iter_len, unsigned int remaining_len),
+ TP_ARGS(nr_rqst, sub_rqst, i, offset, len, iter_len, remaining_len),
+ TP_STRUCT__entry(
+ __field(u8, nr_rqst)
+ __field(u8, sub_rqst)
+ __field(unsigned int, iter_len)
+ __field(unsigned int, remaining_len)
+ __field(unsigned int, i)
+ __field(size_t, offset)
+ __field(ssize_t, len)
+ ),
+ TP_fast_assign(
+ __entry->nr_rqst = nr_rqst;
+ __entry->sub_rqst = sub_rqst;
+ __entry->i = i;
+ __entry->offset = offset;
+ __entry->len = len;
+ __entry->iter_len = iter_len;
+ __entry->remaining_len = remaining_len;
+ ),
+ TP_printk("nrq=%u/%u pg=%u o=%zx l=%zx iter=%u rem=%u",
+ __entry->sub_rqst + 1, __entry->nr_rqst,
+ __entry->i, __entry->offset, __entry->len,
+ __entry->iter_len, __entry->remaining_len)
+ )
+
+TRACE_EVENT(smb3_rdma_done,
+ TP_PROTO(unsigned int nr_rqst, unsigned int sub_rqst,
+ unsigned int where),
+ TP_ARGS(nr_rqst, sub_rqst, where),
+ TP_STRUCT__entry(
+ __field(u8, nr_rqst)
+ __field(u8, sub_rqst)
+ __field(u8, where)
+ ),
+ TP_fast_assign(
+ __entry->nr_rqst = nr_rqst;
+ __entry->sub_rqst = sub_rqst;
+ __entry->where = where;
+ ),
+ TP_printk("nrq=%u/%u where=%u",
+ __entry->sub_rqst + 1, __entry->nr_rqst, __entry->where)
+ )
+
+TRACE_EVENT(smb3_rdma_fail,
+ TP_PROTO(unsigned int nr_rqst, unsigned int sub_rqst,
+ unsigned int where, int rc),
+ TP_ARGS(nr_rqst, sub_rqst, where, rc),
+ TP_STRUCT__entry(
+ __field(u8, nr_rqst)
+ __field(u8, sub_rqst)
+ __field(u8, where)
+ __field(short, rc)
+ ),
+ TP_fast_assign(
+ __entry->nr_rqst = nr_rqst;
+ __entry->sub_rqst = sub_rqst;
+ __entry->where = where;
+ __entry->rc = rc;
+ ),
+ TP_printk("nrq=%u/%u where=%u rc=%d",
+ __entry->sub_rqst + 1, __entry->nr_rqst,
+ __entry->where, __entry->rc)
+ )
+
#endif /* _CIFS_TRACE_H */
#undef TRACE_INCLUDE_PATH
Powered by blists - more mailing lists