Skip to contentSkip to conversation

PCI/msi: don't warn on irq_create_affinity_masks NULL return

PATCH In review Christoph Hellwig 4 participants 4 messages Aug 23, 2017 – Aug 26, 2017 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/msi: don't warn on irq_create_affinity_masks NULL return

irq_create_affinity_masks can easily return NULL when there are not enough "free" vectors available to spread, while the memory allocation failure for the CPU masks not only is unlikely, but also relatively harmless as the system will work just fine except for non-optimally spread vectors. Thus remove the warnings.

---
 drivers/pci/msi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/pci/msi.c +3 -10
index 253d92409bb3..2225afc1cbbb 100644
@@ -538,12 +538,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, const struct irq_affinity *affd)
 	struct msi_desc *entry;
 	u16 control;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI affinity masks for %d vectors\n",
-				nvec);
-	}
+
 
 	/* MSI Entry Initialization */
 	entry = alloc_msi_entry(&dev->dev, nvec, masks);
@@ -679,12 +676,8 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
 	struct msi_desc *entry;
 	int ret, i;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI-X affinity masks for %d vectors\n",
-				nvec);
-	}
 
 	for (i = 0, curmsk = masks; i < nvec; i++) {
 		entry = alloc_msi_entry(&dev->dev, 1, curmsk);
Signature · 1 line
2.11.0
#1 lore raw
Quoted 7 lines

irq_create_affinity_masks can easily return NULL when there are not enough "free" vectors available to spread, while the memory allocation failure for the CPU masks not only is unlikely, but also relatively harmless as the system will work just fine except for non-optimally spread vectors. Thus remove the warnings.

Yes, this makes the warning go away but driver still loads.

Quoted 38 lines
---
 drivers/pci/msi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/pci/msi.c +3 -10
index 253d92409bb3..2225afc1cbbb 100644
@@ -538,12 +538,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, const struct irq_affinity *affd)
 	struct msi_desc *entry;
 	u16 control;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI affinity masks for %d vectors\n",
-				nvec);
-	}
+
 
 	/* MSI Entry Initialization */
 	entry = alloc_msi_entry(&dev->dev, nvec, masks);
@@ -679,12 +676,8 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
 	struct msi_desc *entry;
 	int ret, i;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI-X affinity masks for %d vectors\n",
-				nvec);
-	}
 
 	for (i = 0, curmsk = masks; i < nvec; i++) {
 		entry = alloc_msi_entry(&dev->dev, 1, curmsk);
Signature · 1 line
Meelis Roos ([email protected])
Acked-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig

From: Christoph Hellwig <[email protected]>
Date: Wed, 23 Aug 2017 13:54:59 +0200

Quoted 7 lines

irq_create_affinity_masks can easily return NULL when there are not enough "free" vectors available to spread, while the memory allocation failure for the CPU masks not only is unlikely, but also relatively harmless as the system will work just fine except for non-optimally spread vectors. Thus remove the warnings.

#3 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

irq_create_affinity_masks can easily return NULL when there are not enough "free" vectors available to spread, while the memory allocation failure for the CPU masks not only is unlikely, but also relatively harmless as the system will work just fine except for non-optimally spread vectors. Thus remove the warnings.

I applied this with David's ack to for-linus for v4.13. It's not strictly speaking a bug fix, but I think the warnings would cause needless alarm for v4.13 users.

Quoted 40 lines
---
 drivers/pci/msi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/pci/msi.c +3 -10
index 253d92409bb3..2225afc1cbbb 100644
@@ -538,12 +538,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, const struct irq_affinity *affd)
 	struct msi_desc *entry;
 	u16 control;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI affinity masks for %d vectors\n",
-				nvec);
-	}
+
 
 	/* MSI Entry Initialization */
 	entry = alloc_msi_entry(&dev->dev, nvec, masks);
@@ -679,12 +676,8 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
 	struct msi_desc *entry;
 	int ret, i;
 
-	if (affd) {
+	if (affd)
 		masks = irq_create_affinity_masks(nvec, affd);
-		if (!masks)
-			dev_err(&dev->dev, "can't allocate MSI-X affinity masks for %d vectors\n",
-				nvec);
-	}
 
 	for (i = 0, curmsk = masks; i < nvec; i++) {
 		entry = alloc_msi_entry(&dev->dev, 1, curmsk);
Signature · 1 line
2.11.0