All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Christoph Hellwig <hch@lst.de>,
	kbusch@kernel.org, lengchao@huawei.com,
	linux-nvme@lists.infradead.org, Gerd Bayer <gbayer@linux.ibm.com>
Subject: Re: [PATCH] nvme: don't call blk_mq_{,un}quiesce_tagset when ctrl->tagset is NULL
Date: Tue, 22 Nov 2022 13:34:09 +0100	[thread overview]
Message-ID: <20221122123409.GA5958@lst.de> (raw)
In-Reply-To: <20221122123154.GA5610@lst.de>

On Tue, Nov 22, 2022 at 01:31:54PM +0100, Christoph Hellwig wrote:
> This would be the queue_count version.  I have to say I much prefer
> the tagset check, as it is self-documenting and matches what
> nvme_queue_scan, nvme_cancel_tagset and nvme_cancel_admin_tagset
> do.

And here is the actual patch:

---
From 167d14d9613014142ee285c2912dadc089d80e86 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Wed, 16 Nov 2022 08:14:46 +0100
Subject: nvme: don't call blk_mq_{,un}quiesce_tagset when ctrl->tagset is NULL

The NVMe drivers support a mode where no tagset is allocated for the I/O
queues and only the admin queue is usable.  In that case
ctrl->queue_count is smaller than two and we must not call the block
per-tagset quiesce helpers that dereference it.

Fixes: 98d81f0df70c ("nvme: use blk_mq_[un]quiesce_tagset")
Reported-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3195ae17df309..6c8a110d6738a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -5215,6 +5215,8 @@ EXPORT_SYMBOL_GPL(nvme_start_freeze);
 
 void nvme_quiesce_io_queues(struct nvme_ctrl *ctrl)
 {
+	if (ctrl->queue_count < 2)
+		return;
 	if (!test_and_set_bit(NVME_CTRL_STOPPED, &ctrl->flags))
 		blk_mq_quiesce_tagset(ctrl->tagset);
 	else
@@ -5224,6 +5226,8 @@ EXPORT_SYMBOL_GPL(nvme_quiesce_io_queues);
 
 void nvme_unquiesce_io_queues(struct nvme_ctrl *ctrl)
 {
+	if (ctrl->queue_count < 2)
+		return;
 	if (test_and_clear_bit(NVME_CTRL_STOPPED, &ctrl->flags))
 		blk_mq_unquiesce_tagset(ctrl->tagset);
 }
-- 
2.30.2



  reply	other threads:[~2022-11-22 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16  7:27 [PATCH] nvme: don't call blk_mq_{,un}quiesce_tagset when ctrl->tagset is NULL Christoph Hellwig
2022-11-16  7:52 ` Chao Leng
2022-11-16 18:38   ` Chaitanya Kulkarni
2022-11-16 13:20 ` Sagi Grimberg
2022-11-16 13:22   ` Christoph Hellwig
2022-11-16 13:23     ` Sagi Grimberg
2022-11-16 13:28       ` Christoph Hellwig
2022-11-20 11:38         ` Sagi Grimberg
2022-11-21  7:04           ` Christoph Hellwig
2022-11-22 12:31           ` Christoph Hellwig
2022-11-22 12:34             ` Christoph Hellwig [this message]
2022-11-29  9:04             ` Christoph Hellwig
2022-11-30  8:27               ` Sagi Grimberg

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=20221122123409.GA5958@lst.de \
    --to=hch@lst.de \
    --cc=gbayer@linux.ibm.com \
    --cc=kbusch@kernel.org \
    --cc=lengchao@huawei.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.