Skip to contentSkip to conversation

PCI/MSI: Simplify pci_irq_get_affinity()

PATCH Guenter Roeck 1 participant 1 message Jan 31, 2022

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author Tested-by
#0 lore raw
Quoted 29 lines · Thomas Gleixner

Guenter,

Quoted 2 lines · Guenter Roeck

Sure. Please see http://server.roeck-us.net/qemu/x86/.
The logs are generated with with v5.16.4.

thanks for providing the data. It definitely helped me to leave the state of not seeing the wood for the trees. Fix below.

Thanks,

tglx
---
Subject: PCI/MSI: Remove bogus warning in pci_irq_get_affinity()
From: Thomas Gleixner <[email protected]>
Date: Mon, 31 Jan 2022 22:02:46 +0100

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.

Quoted 5 lines

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

Fixes f48235900182 ("PCI/MSI: Simplify pci_irq_get_affinity()")

Guenter

Quoted 16 lines
---
 drivers/pci/msi/msi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/msi/msi.c +2 -1
@@ -1111,7 +1111,8 @@ const struct cpumask *pci_irq_get_affini
 	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;
 
 	/*