All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion
@ 2019-04-30 15:33 Keith Busch
  2019-04-30 15:33 ` [PATCH 2/2] nvme/pci: Unquiesce admin queue on shutdown Keith Busch
  2019-05-01 13:19 ` [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2019-04-30 15:33 UTC (permalink / raw)


We do not restart a controller in a deleting state for timeout errors.
When in this state, unblock potential request dispatchers with failed
completions by shutting down the controller on timeout detection.

Reported-by: Yufen Yu <yuyufen at huawei.com>
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c1eecde6b853..c5a997727c4f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1276,6 +1276,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	struct nvme_dev *dev = nvmeq->dev;
 	struct request *abort_req;
 	struct nvme_command cmd;
+	bool shutdown = false;
 	u32 csts = readl(dev->bar + NVME_REG_CSTS);
 
 	/* If PCI error recovery process is happening, we cannot reset or
@@ -1312,12 +1313,14 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	 * shutdown, so we return BLK_EH_DONE.
 	 */
 	switch (dev->ctrl.state) {
+	case NVME_CTRL_DELETING:
+		shutdown = true;
 	case NVME_CTRL_CONNECTING:
 	case NVME_CTRL_RESETTING:
 		dev_warn_ratelimited(dev->ctrl.device,
 			 "I/O %d QID %d timeout, disable controller\n",
 			 req->tag, nvmeq->qid);
-		nvme_dev_disable(dev, false);
+		nvme_dev_disable(dev, shutdown);
 		nvme_req(req)->flags |= NVME_REQ_CANCELLED;
 		return BLK_EH_DONE;
 	default:
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] nvme/pci: Unquiesce admin queue on shutdown
  2019-04-30 15:33 [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Keith Busch
@ 2019-04-30 15:33 ` Keith Busch
  2019-05-01 13:19 ` [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2019-04-30 15:33 UTC (permalink / raw)


Just like IO queues, the admin queue also will not be restarted after a
controller shutdown. Unquiesce this queue so that we do not block
request dispatch on a permanently disabled controller.

Reported-by: Yufen Yu <yuyufen at huawei.com>
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c5a997727c4f..46e033b0bb79 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2436,8 +2436,11 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
 	 * must flush all entered requests to their failed completion to avoid
 	 * deadlocking blk-mq hot-cpu notifier.
 	 */
-	if (shutdown)
+	if (shutdown) {
 		nvme_start_queues(&dev->ctrl);
+		if (dev->ctrl.admin_q && !blk_queue_dying(dev->ctrl.admin_q))
+			blk_mq_unquiesce_queue(dev->ctrl.admin_q);
+	}
 	mutex_unlock(&dev->shutdown_lock);
 }
 
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion
  2019-04-30 15:33 [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Keith Busch
  2019-04-30 15:33 ` [PATCH 2/2] nvme/pci: Unquiesce admin queue on shutdown Keith Busch
@ 2019-05-01 13:19 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-05-01 13:19 UTC (permalink / raw)


Thanks,

applied both patches to nvme-5.2.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-01 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30 15:33 [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Keith Busch
2019-04-30 15:33 ` [PATCH 2/2] nvme/pci: Unquiesce admin queue on shutdown Keith Busch
2019-05-01 13:19 ` [PATCH 1/2] nvme/pci: Shutdown on timeout during deletion Christoph Hellwig

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.