All of lore.kernel.org
 help / color / mirror / Atom feed
From: sbradshaw@micron.com (Sam Bradshaw)
Subject: [PATCH] NVMe: Re-attach waitqueue following device reset
Date: Fri, 31 Oct 2014 12:09:57 -0700	[thread overview]
Message-ID: <5453DE85.90407@micron.com> (raw)

Bios queued to sq_cong prior to and during a device reset may not 
get re-issued or may get issued very slowly following the completion 
of the reset sequence.  The waitqueue was detached as part of the 
sequence and never re-attached, forcing all new make_request() bios 
to be queued and the queue to be flushed out without the help of the 
completion path waking the kthread.

This patch re-attaches the waitqueue as part of the reset process.

Signed-off-by: Sam Bradshaw <sbradshaw at micron.com>
---
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index b85a2a0..8133ee8 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2329,6 +2329,23 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
 	nvme_free_queues(dev, nr_io_queues + 1);
 	nvme_assign_io_queues(dev);
 
+	/* Re-attach the waitqueue */
+	for (i = dev->queue_count - 1; i >= 1; i--) {
+		struct nvme_queue *nvmeq = raw_nvmeq(dev, i);
+
+		if (nvmeq) {
+			spin_lock_irq(&nvmeq->q_lock);
+			init_waitqueue_head(&nvmeq->sq_full);
+			init_waitqueue_entry(&nvmeq->sq_cong_wait,
+								nvme_thread);
+			if (bio_list_peek(&nvmeq->sq_cong) ||
+						!list_empty(&nvmeq->iod_bio))
+				add_wait_queue(&nvmeq->sq_full,
+							&nvmeq->sq_cong_wait);
+			spin_unlock_irq(&nvmeq->q_lock);
+		}
+	}
+
 	return 0;
 
  free_queues:

             reply	other threads:[~2014-10-31 19:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 19:09 Sam Bradshaw [this message]
2014-11-04 14:55 ` [PATCH] NVMe: Re-attach waitqueue following device reset Keith Busch
2014-11-04 21:48   ` Sam Bradshaw (sbradshaw)
2014-11-04 23:25     ` Busch, Keith

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=5453DE85.90407@micron.com \
    --to=sbradshaw@micron.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 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.