* PCI irq affinity fix for 4.12
@ 2017-05-20 13:21 Christoph Hellwig
2017-05-20 13:21 ` [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-05-20 13:21 UTC (permalink / raw)
To: bhelgaas; +Cc: linux-pci, linux-kernel
Hi Bjorn,
Steve found a case where the !CONFIG_PCI_MSI stub for pci_alloc_irq_vectors
did the wrong thing when used with the newly converted xhci driver. While
the PCI code has been wrong since day 1 the fact that a newly converted
drivers triggers it makes it a regression in this cycle.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
2017-05-20 13:21 PCI irq affinity fix for 4.12 Christoph Hellwig
@ 2017-05-20 13:21 ` Christoph Hellwig
2017-05-20 16:59 ` [PATCH v2] " Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-05-20 13:21 UTC (permalink / raw)
To: bhelgaas; +Cc: linux-pci, linux-kernel
We need to return an error for any call that asks for MSI / MSI-X
vectors only, so that non-trivial fallback logic can work properly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
---
include/linux/pci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33c2b0b77429..5a7fd3b6a7b9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1342,7 +1342,7 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
unsigned int max_vecs, unsigned int flags,
const struct irq_affinity *aff_desc)
{
- if (min_vecs > 1)
+ if (min_vecs > 1 || !(flags & PCI_IRQ_LEGACY))
return -EINVAL;
return 1;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
2017-05-20 13:21 ` [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub Christoph Hellwig
@ 2017-05-20 16:59 ` Christoph Hellwig
2017-05-26 5:46 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-05-20 16:59 UTC (permalink / raw)
To: bhelgaas, Linus Torvalds; +Cc: linux-pci, linux-kernel
We need to return an error for any call that asks for MSI / MSI-X
vectors only, so that non-trivial fallback logic can work properly.
Also valid dev->irq and use the "correct" errno value based on feedback
from Linus.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
---
Changes from V1:
- use == comparism
- return -ENOSPC
- verify dev->irq
include/linux/pci.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33c2b0b77429..fc2e832d7b9c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1342,9 +1342,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
unsigned int max_vecs, unsigned int flags,
const struct irq_affinity *aff_desc)
{
- if (min_vecs > 1)
- return -EINVAL;
- return 1;
+ if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
+ return 1;
+ return -ENOSPC;
}
static inline void pci_free_irq_vectors(struct pci_dev *dev)
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
2017-05-20 16:59 ` [PATCH v2] " Christoph Hellwig
@ 2017-05-26 5:46 ` Christoph Hellwig
2017-05-26 15:46 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-05-26 5:46 UTC (permalink / raw)
To: bhelgaas, Linus Torvalds; +Cc: linux-pci, linux-kernel
Bjorn,
can you take this regression fix and sent it to Linux before -rc3?
I had hope we could get it into -rc2 but already missed that, and
I haven't heard a comment since..
On Sat, May 20, 2017 at 06:59:54PM +0200, Christoph Hellwig wrote:
> We need to return an error for any call that asks for MSI / MSI-X
> vectors only, so that non-trivial fallback logic can work properly.
>
> Also valid dev->irq and use the "correct" errno value based on feedback
> from Linus.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
> ---
>
> Changes from V1:
> - use == comparism
> - return -ENOSPC
> - verify dev->irq
>
> include/linux/pci.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 33c2b0b77429..fc2e832d7b9c 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1342,9 +1342,9 @@ pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
> unsigned int max_vecs, unsigned int flags,
> const struct irq_affinity *aff_desc)
> {
> - if (min_vecs > 1)
> - return -EINVAL;
> - return 1;
> + if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
> + return 1;
> + return -ENOSPC;
> }
>
> static inline void pci_free_irq_vectors(struct pci_dev *dev)
> --
> 2.11.0
---end quoted text---
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
2017-05-26 5:46 ` Christoph Hellwig
@ 2017-05-26 15:46 ` Linus Torvalds
0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2017-05-26 15:46 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Bjorn Helgaas, linux-pci, Linux Kernel Mailing List
On Thu, May 25, 2017 at 10:46 PM, Christoph Hellwig <hch@lst.de> wrote:
> Bjorn,
>
> can you take this regression fix and sent it to Linux before -rc3?
> I had hope we could get it into -rc2 but already missed that, and
> I haven't heard a comment since..
I took it directly..
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-26 15:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-20 13:21 PCI irq affinity fix for 4.12 Christoph Hellwig
2017-05-20 13:21 ` [PATCH] PCI/msi: fix the pci_alloc_irq_vectors_affinity stub Christoph Hellwig
2017-05-20 16:59 ` [PATCH v2] " Christoph Hellwig
2017-05-26 5:46 ` Christoph Hellwig
2017-05-26 15:46 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).