Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ming.lei@redhat.com (Ming Lei)
Subject: [PATCH 2/2] nvme pci: try to allocate multiple irq vectors again in case of -EINVAL
Date: Wed, 26 Dec 2018 18:37:55 +0800	[thread overview]
Message-ID: <20181226103755.2101-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20181226103755.2101-1-ming.lei@redhat.com>

It is observed on QEMU that pci_alloc_irq_vectors_affinity() may
returns -EINVAL when the requested number is too big(such as 64).

However, the allocation can be done successfully if we ask for
a smaller number, such as 63.

So reduce queue number and reallocate again in case of -EINVAL.

Cc: Keith Busch <keith.busch at intel.com>
Cc: Jens Axboe <axboe at fb.com>
Signed-off-by: Ming Lei <ming.lei at redhat.com>
---
 drivers/nvme/host/pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 584ea7a57122..d839bbe408c3 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2121,14 +2121,11 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)
 		 * to decrease our ask. If we get EINVAL, the platform
 		 * likely does not. Back down to ask for just one vector.
 		 */
-		if (result == -ENOSPC) {
+		if (result == -ENOSPC || result == -EINVAL) {
 			irq_queues--;
 			if (!irq_queues)
 				return result;
 			continue;
-		} else if (result == -EINVAL) {
-			irq_queues = 1;
-			continue;
 		} else if (result <= 0)
 			return -EIO;
 		break;
-- 
2.9.5

  parent reply	other threads:[~2018-12-26 10:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 10:37 [PATCH 0/2] nvme pci: two fixes on nvme_setup_irqs Ming Lei
2018-12-26 10:37 ` [PATCH 1/2] nvme pci: fix nvme_setup_irqs() Ming Lei
2018-12-26 10:37 ` Ming Lei [this message]
2018-12-26 18:20   ` [PATCH 2/2] nvme pci: try to allocate multiple irq vectors again in case of -EINVAL Christoph Hellwig
2018-12-27  8:21     ` Ming Lei
2018-12-27 13:08       ` Christoph Hellwig
2018-12-27 22:16         ` Ming Lei
2018-12-31 21:51         ` Bjorn Helgaas

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=20181226103755.2101-3-ming.lei@redhat.com \
    --to=ming.lei@redhat.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