linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCHv4 4/4] nvme-pci: Use controller start work to dispath IO
Date: Fri, 13 Jul 2018 14:56:09 -0600	[thread overview]
Message-ID: <20180713205609.19701-5-keith.busch@intel.com> (raw)
In-Reply-To: <20180713205609.19701-1-keith.busch@intel.com>

We don't want to wait for IO within the reset work because we need that
to context handle IO timeouts. This patch uses the new FROZEN state
to inform the controller start work to handle restarting IO queues and
waiting for their freeze to complete.

Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/pci.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index b9b83a7a5a52..2e12c8a746c7 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2077,10 +2077,7 @@ static void nvme_disable_io_queues(struct nvme_dev *dev)
 	}
 }
 
-/*
- * return error value only when tagset allocation failed
- */
-static int nvme_dev_add(struct nvme_dev *dev)
+static enum nvme_ctrl_state nvme_dev_add(struct nvme_dev *dev)
 {
 	int ret;
 
@@ -2103,19 +2100,18 @@ static int nvme_dev_add(struct nvme_dev *dev)
 		if (ret) {
 			dev_warn(dev->ctrl.device,
 				"IO queues tagset allocation failed %d\n", ret);
-			return ret;
+			return NVME_CTRL_ADMIN_ONLY;
 		}
 		dev->ctrl.tagset = &dev->tagset;
 
 		nvme_dbbuf_set(dev);
 	} else {
-		blk_mq_update_nr_hw_queues(&dev->tagset, dev->online_queues - 1);
-
 		/* Free previously allocated queues that are no longer usable */
 		nvme_free_queues(dev, dev->online_queues);
+		return NVME_CTRL_FROZEN;
 	}
 
-	return 0;
+	return NVME_CTRL_LIVE;
 }
 
 static int nvme_pci_enable(struct nvme_dev *dev)
@@ -2391,12 +2387,7 @@ static void nvme_reset_work(struct work_struct *work)
 		nvme_remove_namespaces(&dev->ctrl);
 		new_state = NVME_CTRL_ADMIN_ONLY;
 	} else {
-		nvme_start_queues(&dev->ctrl);
-		nvme_wait_freeze(&dev->ctrl);
-		/* hit this only when allocate tagset fails */
-		if (nvme_dev_add(dev))
-			new_state = NVME_CTRL_ADMIN_ONLY;
-		nvme_unfreeze(&dev->ctrl);
+		new_state = nvme_dev_add(dev);
 	}
 
 	/*
-- 
2.14.3

  parent reply	other threads:[~2018-07-13 20:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 20:56 [PATCHv4 0/4] nvme timeout updates Keith Busch
2018-07-13 20:56 ` [PATCHv4 1/4] nvme: Sync request queues on reset Keith Busch
2018-07-16  8:52   ` jianchao.wang
2018-07-16 10:39     ` Ming Lei
2018-07-16 13:30       ` Keith Busch
2018-07-17  5:37         ` jianchao.wang
2018-07-16 14:51   ` Sagi Grimberg
2018-07-16 15:37     ` Keith Busch
2018-07-16 16:36       ` Sagi Grimberg
2018-07-16 17:12         ` Keith Busch
2018-07-17 13:40           ` Christoph Hellwig
2018-07-17 14:54             ` Keith Busch
2018-07-18 11:46           ` Sagi Grimberg
2018-07-18 13:52             ` Keith Busch
2018-07-13 20:56 ` [PATCHv4 2/4] nvme: Start controller in own work queue Keith Busch
2018-07-16 15:00   ` Sagi Grimberg
2018-07-16 15:35     ` Keith Busch
2018-07-13 20:56 ` [PATCHv4 3/4] nvme: Introduce frozen controller state Keith Busch
2018-07-16  9:02   ` jianchao.wang
2018-07-16 11:09   ` Ming Lei
2018-07-16 13:36     ` Keith Busch
2018-07-17  1:23       ` Ming Lei
2018-07-17  5:49         ` jianchao.wang
2018-07-17  7:21           ` Ming Lei
2018-07-17  7:28             ` jianchao.wang
2018-07-17 14:32               ` Keith Busch
2018-07-18  2:57                 ` jianchao.wang
2018-07-17 14:06         ` Keith Busch
2018-07-16 16:34   ` Sagi Grimberg
2018-07-17 16:05     ` James Smart
2018-07-17 16:17       ` Keith Busch
2018-07-18 12:20         ` Sagi Grimberg
2018-07-18 13:53           ` Keith Busch
2018-07-13 20:56 ` Keith Busch [this message]
2018-07-19 19:48 ` [PATCHv4 0/4] nvme timeout updates Scott Bauer

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=20180713205609.19701-5-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).