All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return
@ 2017-08-23 11:54 Christoph Hellwig
  2017-08-23 14:24 ` Meelis Roos
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-08-23 11:54 UTC (permalink / raw)
  To: helgaas; +Cc: davem, mroos, linux-pci

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/pci/msi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 253d92409bb3..2225afc1cbbb 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -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);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return
  2017-08-23 11:54 [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return Christoph Hellwig
@ 2017-08-23 14:24 ` Meelis Roos
  2017-08-23 18:47 ` David Miller
  2017-08-26  0:00 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Meelis Roos @ 2017-08-23 14:24 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: helgaas, davem, linux-pci

> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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


> ---
>  drivers/pci/msi.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 253d92409bb3..2225afc1cbbb 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -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);
> 

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return
  2017-08-23 11:54 [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return Christoph Hellwig
  2017-08-23 14:24 ` Meelis Roos
@ 2017-08-23 18:47 ` David Miller
  2017-08-26  0:00 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-08-23 18:47 UTC (permalink / raw)
  To: hch; +Cc: helgaas, mroos, linux-pci

From: Christoph Hellwig <hch@lst.de>
Date: Wed, 23 Aug 2017 13:54:59 +0200

> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return
  2017-08-23 11:54 [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return Christoph Hellwig
  2017-08-23 14:24 ` Meelis Roos
  2017-08-23 18:47 ` David Miller
@ 2017-08-26  0:00 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2017-08-26  0:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: davem, mroos, linux-pci

On Wed, Aug 23, 2017 at 01:54:59PM +0200, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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.

> ---
>  drivers/pci/msi.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 253d92409bb3..2225afc1cbbb 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -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);
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-26  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 11:54 [PATCH] PCI/msi: don't warn on irq_create_affinity_masks NULL return Christoph Hellwig
2017-08-23 14:24 ` Meelis Roos
2017-08-23 18:47 ` David Miller
2017-08-26  0:00 ` Bjorn Helgaas

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.