[tip: irq/urgent] PCI/MSI: Remove bogus warning in pci_irq_get_affinity()

tip-bot2 for Thomas Gleixner posted 1 patch 4 years, 4 months ago
drivers/pci/msi/msi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[tip: irq/urgent] PCI/MSI: Remove bogus warning in pci_irq_get_affinity()
Posted by tip-bot2 for Thomas Gleixner 4 years, 4 months ago
The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     dd7f5a11ac5a6f733f422dc22b4d145d3260304e
Gitweb:        https://git.kernel.org/tip/dd7f5a11ac5a6f733f422dc22b4d145d3260304e
Author:        Thomas Gleixner <tglx@linutronix.de>
AuthorDate:    Mon, 31 Jan 2022 22:02:46 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 04 Feb 2022 09:54:20 +01:00

PCI/MSI: Remove bogus warning in pci_irq_get_affinity()

The recent overhaul of pci_irq_get_affinity() introduced a regression when
pci_irq_get_affinity() is called for an MSI-X interrupt which was not
allocated with affinity descriptor information.

The original code just returned a NULL pointer in that case, but the rework
added a WARN_ON() under the assumption that the corresponding WARN_ON() in
the MSI case can be applied to MSI-X as well.

In fact the MSI warning in the original code does not make sense either
because it's legitimate to invoke pci_irq_get_affinity() for a MSI
interrupt which was not allocated with affinity descriptor information.

Remove it and just return NULL as the original code did.

Fixes: f48235900182 ("PCI/MSI: Simplify pci_irq_get_affinity()")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/87ee4n38sm.ffs@tglx

---
 drivers/pci/msi/msi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index c19c7ca..9037a78 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -1111,7 +1111,8 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
 	if (!desc)
 		return cpu_possible_mask;
 
-	if (WARN_ON_ONCE(!desc->affinity))
+	/* MSI[X] interrupts can be allocated without affinity descriptor */
+	if (!desc->affinity)
 		return NULL;
 
 	/*
Re: [tip: irq/urgent] PCI/MSI: Remove bogus warning in pci_irq_get_affinity()
Posted by Thorsten Leemhuis 4 years, 4 months ago
[stripped the CC list to avoid spamming people, we all get enough mail]

Thx for fixing the regression. Sadly the fix didn't link to all places
where the issue was reported using "Link:" tags, as explained by both
Documentation/process/submitting-patches.rst and
Documentation/process/5.Posting.rst

Please consider placing them in the future, at least one tool is relying
on the presence of such links: my regression tracking bot 'regzbot',
which using them to automatically detect patch posting and commits
fixing tracked regressions -- which makes my my life as the Linux
kernel's regression tracker a lot easier, as otherwise I have to tell
regzbot about fixes manually:

#regzbot fixed-by: dd7f5a11ac5a6f733f422dc22b

tia!

Ciao, Thorsten

On 04.02.22 09:57, tip-bot2 for Thomas Gleixner wrote:
> The following commit has been merged into the irq/urgent branch of tip:
> 
> Commit-ID:     dd7f5a11ac5a6f733f422dc22b4d145d3260304e
> Gitweb:        https://git.kernel.org/tip/dd7f5a11ac5a6f733f422dc22b4d145d3260304e
> Author:        Thomas Gleixner <tglx@linutronix.de>
> AuthorDate:    Mon, 31 Jan 2022 22:02:46 +01:00
> Committer:     Thomas Gleixner <tglx@linutronix.de>
> CommitterDate: Fri, 04 Feb 2022 09:54:20 +01:00
> 
> PCI/MSI: Remove bogus warning in pci_irq_get_affinity()
> 
> The recent overhaul of pci_irq_get_affinity() introduced a regression when
> pci_irq_get_affinity() is called for an MSI-X interrupt which was not
> allocated with affinity descriptor information.
> 
> The original code just returned a NULL pointer in that case, but the rework
> added a WARN_ON() under the assumption that the corresponding WARN_ON() in
> the MSI case can be applied to MSI-X as well.
> 
> In fact the MSI warning in the original code does not make sense either
> because it's legitimate to invoke pci_irq_get_affinity() for a MSI
> interrupt which was not allocated with affinity descriptor information.
> 
> Remove it and just return NULL as the original code did.
> 
> Fixes: f48235900182 ("PCI/MSI: Simplify pci_irq_get_affinity()")
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lore.kernel.org/r/87ee4n38sm.ffs@tglx
> 
> ---
>  drivers/pci/msi/msi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
> index c19c7ca..9037a78 100644
> --- a/drivers/pci/msi/msi.c
> +++ b/drivers/pci/msi/msi.c
> @@ -1111,7 +1111,8 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
>  	if (!desc)
>  		return cpu_possible_mask;
>  
> -	if (WARN_ON_ONCE(!desc->affinity))
> +	/* MSI[X] interrupts can be allocated without affinity descriptor */
> +	if (!desc->affinity)
>  		return NULL;
>  
>  	/*