mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Mikhak <alan.mikhak@sifive.com>
To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	palmer@sifive.com, paul.walmsley@sifive.com
Cc: Alan Mikhak <alan.mikhak@sifive.com>
Subject: [PATCH] nvme-pci: No IRQ map for read if no read queue allocated
Date: Mon,  8 Jul 2019 10:24:12 -0700	[thread overview]
Message-ID: <1562606652-7618-1-git-send-email-alan.mikhak@sifive.com> (raw)

From: Alan Mikhak <alan.mikhak@sifive.com>

nvme_dev_add() assumes a read queue is always allocated.
That may not be the case on single-interrupt systems for
which pci_assign_irq() would report runtime IRQ mapping
not provided by arch.

This patch makes sure nvme_dev_add() only requests an
IRQ mapping for read queues if at least one read queue
is being allocted.

nvme_pci_map_queues() will later on ignore the unnecessary
mapping request should nvme_dev_add() request such an IRQ
mapping even though no read queues are being allocated.
However, nvme_dev_add() can avoid making the request by
checking the number of read queues without assuming. This
would bring it more in line with nvme_setup_irqs() and
nvme_calc_irq_sets().

Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
---
 drivers/nvme/host/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 524d6bd6d095..86262ebe6fff 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2263,7 +2263,9 @@ static int nvme_dev_add(struct nvme_dev *dev)
 	if (!dev->ctrl.tagset) {
 		dev->tagset.ops = &nvme_mq_ops;
 		dev->tagset.nr_hw_queues = dev->online_queues - 1;
-		dev->tagset.nr_maps = 2; /* default + read */
+		dev->tagset.nr_maps = 1; /* default */
+		if (dev->io_queues[HCTX_TYPE_READ])
+			dev->tagset.nr_maps++;
 		if (dev->io_queues[HCTX_TYPE_POLL])
 			dev->tagset.nr_maps++;
 		dev->tagset.timeout = NVME_IO_TIMEOUT;
-- 
2.7.4


             reply	other threads:[~2019-07-08 17:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 17:24 Alan Mikhak [this message]
2019-07-09 21:22 ` Christoph Hellwig

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=1562606652-7618-1-git-send-email-alan.mikhak@sifive.com \
    --to=alan.mikhak@sifive.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®