All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Steve French <smfrench@gmail.com>
Cc: dhowells@redhat.com, Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 8/9] cifs: Add some RDMA send tracepoints
Date: Fri, 27 May 2022 11:44:53 +0100	[thread overview]
Message-ID: <165364829336.3334034.4053390268201499872.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <165364823513.3334034.11209090728654641458.stgit@warthog.procyon.org.uk>


---

 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 6894fa9c062d..df75ad7a85de 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 d73d3093b67b..5a8fc6645e8d 100644
--- a/fs/cifs/trace.h
+++ b/fs/cifs/trace.h
@@ -1081,6 +1081,101 @@ TRACE_EVENT(smb3_pages_write_requeue,
 		  __entry->wdata_debug_id2)
 )
 
+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



  parent reply	other threads:[~2022-05-27 10:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 10:43 [PATCH v3 0/9] cifs: Use iov_iters down to the network transport David Howells
2022-05-27 10:44 ` [PATCH v3 1/9] iov_iter: Add a function to extract an iter's buffers to a bvec iter David Howells
2022-05-31  6:03   ` Christoph Hellwig
2022-05-27 10:44 ` [PATCH v3 2/9] iov_iter: Add a general purpose iteration function David Howells
2022-05-27 14:33   ` Al Viro
2022-05-27 10:44 ` [PATCH v3 3/9] cifs: Add some helper functions David Howells
2022-05-27 10:44 ` [PATCH v3 4/9] cifs: Add a function to read into an iter from a socket David Howells
2022-05-27 10:44 ` [PATCH v3 5/9] cifs: Change the I/O paths to use an iterator rather than a page list David Howells
2022-05-27 10:44 ` [PATCH v3 6/9] cifs: Remove unused code David Howells
2022-05-27 10:44 ` [PATCH v3 7/9] cifs: Trace writedata page wrangling David Howells
2022-05-27 10:44 ` David Howells [this message]
2022-05-27 10:45 ` [PATCH v3 9/9] cifs, ksmbd: Fix MAX_SGE count for softiwarp David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165364829336.3334034.4053390268201499872.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=rohiths.msft@gmail.com \
    --cc=smfrench@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.