lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200630220428.GA3490187@bjorn-Precision-5520>
Date:   Tue, 30 Jun 2020 17:04:28 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Piotr Stankiewicz <piotr.stankiewicz@...el.com>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Andrew Murray <amurray@...goodpenguin.co.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Logan Gunthorpe <logang@...tatee.com>,
        Jian-Hong Pan <jian-hong@...lessm.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] PCI/MSI: Forward MSI-X vector enable error code in
 pci_alloc_irq_vectors_affinity()

On Tue, Jun 16, 2020 at 09:33:16AM +0200, Piotr Stankiewicz wrote:
> 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@...el.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
> Reviewed-by: Logan Gunthorpe <logang@...tatee.com>
> Reviewed-by: Christoph Hellwig <hch@....de>

Applied to pci/msi for v5.8, thanks!

> ---
>  drivers/pci/msi.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 6b43a5455c7a..cade9be68b09 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1191,8 +1191,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
>  				   struct irq_affinity *affd)
>  {
>  	struct irq_affinity msi_default_affd = {0};
> -	int msix_vecs = -ENOSPC;
> -	int msi_vecs = -ENOSPC;
> +	int nvecs = -ENOSPC;
>  
>  	if (flags & PCI_IRQ_AFFINITY) {
>  		if (!affd)
> @@ -1203,17 +1202,16 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
>  	}
>  
>  	if (flags & PCI_IRQ_MSIX) {
> -		msix_vecs = __pci_enable_msix_range(dev, NULL, min_vecs,
> -						    max_vecs, affd, flags);
> -		if (msix_vecs > 0)
> -			return msix_vecs;
> +		nvecs = __pci_enable_msix_range(dev, NULL, min_vecs, max_vecs,
> +						affd, flags);
> +		if (nvecs > 0)
> +			return nvecs;
>  	}
>  
>  	if (flags & PCI_IRQ_MSI) {
> -		msi_vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs,
> -						  affd);
> -		if (msi_vecs > 0)
> -			return msi_vecs;
> +		nvecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, affd);
> +		if (nvecs > 0)
> +			return nvecs;
>  	}
>  
>  	/* use legacy IRQ if allowed */
> @@ -1231,9 +1229,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
>  		}
>  	}
>  
> -	if (msix_vecs == -ENOSPC)
> -		return -ENOSPC;
> -	return msi_vecs;
> +	return nvecs;
>  }
>  EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity);
>  
> -- 
> 2.17.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ