Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2023 22:45:42 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a510dbc848bb - main - nvme: Be less verbose when cancelling I/O or admin commands
Message-ID:  <202308072245.377Mjgsp058675@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a510dbc848bbc89f4e686c15386b5eb4b35c8236

commit a510dbc848bbc89f4e686c15386b5eb4b35c8236
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-08-07 22:35:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-08-07 22:44:31 +0000

    nvme: Be less verbose when cancelling I/O or admin commands
    
    When we're resetting, and there's outstanding I/O that we're cancelling,
    only report we're cancelling the I/O once rather than once per
    I/O. Likewise when we reschedule the I/O. We don't need to say for each
    one that we're cancelling/rescheduling something, and then report the
    I/O that we're doing. Likewise with cancelling admin commands (we never
    retry them here, so a similar change isn't needed).
    
    Sponsored by:           Netflix
    Reviewed by:            chuck, mav
    Differential Revision:  https://reviews.freebsd.org/D41313
---
 sys/dev/nvme/nvme_qpair.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 34a3633fdb2e..0a0115967eef 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -1244,19 +1244,25 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair)
 {
 	struct nvme_tracker		*tr;
 	struct nvme_tracker		*tr_temp;
+	bool				rpt;
 
 	/*
 	 * Manually abort each outstanding admin command.  Do not retry
-	 *  admin commands found here, since they will be left over from
-	 *  a controller reset and its likely the context in which the
-	 *  command was issued no longer applies.
+	 * admin commands found here, since they will be left over from
+	 * a controller reset and its likely the context in which the
+	 * command was issued no longer applies.
 	 */
-	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
+	rpt = !TAILQ_EMPTY(&qpair->outstanding_tr);
+	if (rpt)
 		nvme_printf(qpair->ctrlr,
 		    "aborting outstanding admin command\n");
+	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
 		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL);
 	}
+	if (rpt)
+		nvme_printf(qpair->ctrlr,
+		    "done aborting outstanding admin\n");
 
 	mtx_lock(&qpair->lock);
 	nvme_qpair_enable(qpair);
@@ -1270,17 +1276,22 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair)
 	struct nvme_tracker		*tr;
 	struct nvme_tracker		*tr_temp;
 	struct nvme_request		*req;
+	bool				report;
 
 	/*
 	 * Manually abort each outstanding I/O.  This normally results in a
-	 *  retry, unless the retry count on the associated request has
-	 *  reached its limit.
+	 * retry, unless the retry count on the associated request has
+	 * reached its limit.
 	 */
-	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
+	report = !TAILQ_EMPTY(&qpair->outstanding_tr);
+	if (report)
 		nvme_printf(qpair->ctrlr, "aborting outstanding i/o\n");
+	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
 		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_NO_RETRY);
 	}
+	if (report)
+		nvme_printf(qpair->ctrlr, "done aborting outstanding i/o\n");
 
 	mtx_lock(&qpair->lock);
 
@@ -1289,13 +1300,17 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair)
 	STAILQ_INIT(&temp);
 	STAILQ_SWAP(&qpair->queued_req, &temp, nvme_request);
 
+	report = !STAILQ_EMPTY(&temp);
+	if (report)
+		nvme_printf(qpair->ctrlr, "resubmitting queued i/o\n");
 	while (!STAILQ_EMPTY(&temp)) {
 		req = STAILQ_FIRST(&temp);
 		STAILQ_REMOVE_HEAD(&temp, stailq);
-		nvme_printf(qpair->ctrlr, "resubmitting queued i/o\n");
 		nvme_qpair_print_command(qpair, &req->cmd);
 		_nvme_qpair_submit_request(qpair, req);
 	}
+	if (report)
+		nvme_printf(qpair->ctrlr, "done resubmitting i/o\n");
 
 	mtx_unlock(&qpair->lock);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308072245.377Mjgsp058675>