All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Cc: Piotr Stankiewicz <piotr.stankiewicz@intel.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Jian-Hong Pan <jian-hong@endlessm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 01/15] PCI/MSI: Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity()
Date: Wed,  3 Jun 2020 13:44:24 +0200	[thread overview]
Message-ID: <20200603114425.12734-1-piotr.stankiewicz@intel.com> (raw)
In-Reply-To: <20200603114212.12525-1-piotr.stankiewicz@intel.com>

When debugging an issue where I was asking the PCI machinery to enable a
set of MSI-X vectors, without falling back on MSI, I ran across a
behaviour which seems odd. The pci_alloc_irq_vectors_affinity() will
always return -ENOSPC on failure, when allocating MSI-X vectors only,
whereas with MSI fallback it will forward any error returned by
__pci_enable_msi_range(). This is a confusing behaviour, so have the
pci_alloc_irq_vectors_affinity() forward the error code from
__pci_enable_msix_range() when appropriate.

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/pci/msi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6b43a5455c7a..443cc324b196 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1231,8 +1231,9 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 		}
 	}
 
-	if (msix_vecs == -ENOSPC)
-		return -ENOSPC;
+	if (msix_vecs == -ENOSPC ||
+	    (flags & (PCI_IRQ_MSI | PCI_IRQ_MSIX)) == PCI_IRQ_MSIX)
+		return msix_vecs;
 	return msi_vecs;
 }
 EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity);
-- 
2.17.2


  reply	other threads:[~2020-06-03 11:45 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  9:16 [PATCH 00/15] forward MSIx vector enable error code in pci_alloc_irq_vectors_affinity Piotr Stankiewicz
2020-06-02  9:16 ` Piotr Stankiewicz
2020-06-02  9:16 ` Piotr Stankiewicz
2020-06-02 23:06 ` Bjorn Helgaas
2020-06-02 23:06   ` Bjorn Helgaas
2020-06-03 11:42   ` [PATCH v2 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
2020-06-03 11:42     ` Piotr Stankiewicz
2020-06-03 11:44     ` Piotr Stankiewicz [this message]
2020-06-03 15:48       ` [PATCH v2 01/15] PCI/MSI: " Logan Gunthorpe
2020-06-03 16:04         ` Stankiewicz, Piotr
2020-06-03 16:22           ` Logan Gunthorpe
2020-06-09  9:27             ` Stankiewicz, Piotr
2020-06-03 11:45     ` [PATCH v2 02/15] PCI: Add shorthand define for message signalled interrupt types Piotr Stankiewicz
2020-06-03 11:45       ` Piotr Stankiewicz
2020-06-03 15:49       ` Logan Gunthorpe
2020-06-03 15:49         ` Logan Gunthorpe
2020-06-04  1:55       ` Luben Tuikov
2020-06-04  1:55         ` Luben Tuikov
2020-06-03 11:46     ` [PATCH v2 03/15] PCI: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
2020-06-03 11:47     ` [PATCH v2 04/15] ahci: " Piotr Stankiewicz
2020-06-03 11:47     ` [PATCH v2 05/15] crypto: inside-secure - " Piotr Stankiewicz
2020-06-03 13:30       ` kernel test robot
2020-06-03 13:30         ` kernel test robot
2020-06-03 11:47     ` [PATCH v2 06/15] dmaengine: dw-edma: " Piotr Stankiewicz
2020-06-03 11:54       ` Gustavo Pimentel
2020-06-03 11:47     ` [PATCH v2 07/15] drm/amdgpu: " Piotr Stankiewicz
2020-06-03 11:47       ` Piotr Stankiewicz
2020-06-03 11:47       ` Piotr Stankiewicz
2020-06-03 13:43       ` Alex Deucher
2020-06-03 13:43         ` Alex Deucher
2020-06-03 13:43         ` Alex Deucher
2020-06-03 11:48     ` [PATCH v2 08/15] IB/qib: " Piotr Stankiewicz
2020-06-03 11:48     ` [PATCH v2 09/15] media: ddbridge: " Piotr Stankiewicz
2020-06-03 11:48     ` [PATCH v2 10/15] vmw_vmci: Use PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-03 11:49     ` [PATCH v2 11/15] mmc: sdhci: Use PCI_IRQ_MSI_TYPES " Piotr Stankiewicz
2020-06-03 11:49     ` [PATCH v2 12/15] amd-xgbe: " Piotr Stankiewicz
2020-06-03 11:49     ` [PATCH v2 13/15] aquantia: atlantic: Use PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-03 11:49     ` [PATCH v2 14/15] net: hns3: Use PCI_IRQ_MSI_TYPES " Piotr Stankiewicz
2020-06-03 11:50     ` [PATCH v2 15/15] scsi: Use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-09  9:11     ` [PATCH v3 00/15] Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
2020-06-09  9:11       ` Piotr Stankiewicz
2020-06-09  9:11       ` Piotr Stankiewicz
2020-06-09  9:14       ` [PATCH v3 01/15] PCI/MSI: " Piotr Stankiewicz
2020-06-09 15:49         ` Logan Gunthorpe
2020-06-09 15:49         ` Christoph Hellwig
2020-06-09  9:15       ` [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types Piotr Stankiewicz
2020-06-09  9:15         ` Piotr Stankiewicz
2020-06-09  9:16       ` [PATCH v3 03/15] PCI: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
2020-06-09 15:51         ` Christoph Hellwig
2020-06-09 16:31           ` Stankiewicz, Piotr
2020-06-09 16:35           ` Logan Gunthorpe
2020-06-09  9:17       ` [PATCH v3 04/15] ahci: " Piotr Stankiewicz
2020-06-09  9:17       ` [PATCH v3 05/15] crypto: inside-secure - " Piotr Stankiewicz
2020-06-09  9:17       ` [PATCH v3 06/15] dmaengine: dw-edma: " Piotr Stankiewicz
2020-06-09 10:01         ` Andy Shevchenko
2020-06-09  9:18       ` [PATCH v3 07/15] drm/amdgpu: " Piotr Stankiewicz
2020-06-09  9:18         ` Piotr Stankiewicz
2020-06-09  9:18         ` Piotr Stankiewicz
2020-06-09 20:23         ` Alex Deucher
2020-06-09 20:23           ` Alex Deucher
2020-06-09 20:23           ` Alex Deucher
2020-06-16  7:49           ` Stankiewicz, Piotr
2020-06-16  7:49             ` Stankiewicz, Piotr
2020-06-16  7:49             ` Stankiewicz, Piotr
2020-06-16  8:42           ` [PATCH] drm/amdgpu: Simplify IRQ vector request logic Piotr Stankiewicz
2020-06-16  8:42             ` Piotr Stankiewicz
2020-06-16  8:42             ` Piotr Stankiewicz
2020-06-09  9:18       ` [PATCH v3 08/15] IB/qib: Use PCI_IRQ_MSI_TYPES where appropriate Piotr Stankiewicz
2020-06-11 13:17         ` Ruhl, Michael J
2020-06-09  9:18       ` [PATCH v3 09/15] media: ddbridge: " Piotr Stankiewicz
2020-06-09  9:19       ` [PATCH v3 10/15] vmw_vmci: Use PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-09  9:19       ` [PATCH v3 11/15] mmc: sdhci: Use PCI_IRQ_MSI_TYPES " Piotr Stankiewicz
2020-06-09  9:19       ` [PATCH v3 12/15] amd-xgbe: " Piotr Stankiewicz
2020-06-09  9:19       ` [PATCH v3 13/15] aquantia: atlantic: Use PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-09  9:20       ` [PATCH v3 14/15] net: hns3: Use PCI_IRQ_MSI_TYPES " Piotr Stankiewicz
2020-06-09  9:20       ` [PATCH v3 15/15] scsi: Use PCI_IRQ_MSI_TYPES and PCI_IRQ_ALL_TYPES " Piotr Stankiewicz
2020-06-09 16:22       ` [PATCH v3 02/15] PCI: Add macro for message signalled interrupt types Piotr Stankiewicz
2020-06-10  7:08         ` Christoph Hellwig
2020-06-16  7:39           ` Stankiewicz, Piotr
2020-06-16  7:33       ` [PATCH v4] PCI/MSI: Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Piotr Stankiewicz
2020-06-30 22:04         ` 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=20200603114425.12734-1-piotr.stankiewicz@intel.com \
    --to=piotr.stankiewicz@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jian-hong@endlessm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=rafael.j.wysocki@intel.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.