Skip to contentSkip to conversation

bus/pci: fix automatic interrupt type selection

PATCH Superseded [email protected] 2 participants 4 messages Jun 20, 2025 – Jun 27, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/pci: fix automatic interrupt type selection

Check if kernel returns 0 interrupt vectors and try another interrupt type in that case. Failing to check the vector count can select an interrupt type that's unusable.

---
 drivers/bus/pci/linux/pci_vfio.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bus/pci/linux/pci_vfio.c +4 -0
index 5317170231..02e7d7e40b 100644
@@ -237,6 +237,10 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
                                continue;
                }
 
+               /* If no vectors, try another one */
+               if (irq.count == 0)
+                       continue;
+
                /* Reallocate the efds and elist fields of intr_handle 

based
* on PCI device MSIX size.
*/
--
2.34.1

#1 lore raw

20/06/2025 13:47, [email protected]:

Quoted 5 lines

Check if kernel returns 0 interrupt vectors and try another interrupt type in that case. Failing to check the vector count can select an interrupt type that's unusable.

Please could you be explicit about the use case you are trying to fix?

#2 lore raw
Quoted 8 lines · Thomas Monjalon

20/06/2025 13:47, [email protected]:

Quoted 5 lines

Check if kernel returns 0 interrupt vectors and try another interrupt type in that case. Failing to check the vector count can select an interrupt type that's unusable.

Please could you be explicit about the use case you are trying to fix?

This particular case was with e1000em that only supported INTx, but the function selected MSI-X simply because it's the first one attempted, even though it got 0 vectors. Enabling interrupts then failed. If the function had checked the vector count it would have correctly selected INTx. Now, my setup might have been quite old but it doesn't change that it selected wrong interrupt type.

Pekka

#3 lore raw

27/06/2025 21:33, Pekka Riikonen:

Quoted 8 lines · Thomas Monjalon
Quoted 7 lines

20/06/2025 13:47, [email protected]:

Quoted 5 lines

Check if kernel returns 0 interrupt vectors and try another interrupt type in that case. Failing to check the vector count can select an interrupt type that's unusable.

Quoted 8 lines
Quoted 1 line

Please could you be explicit about the use case you are trying to fix?

This particular case was with e1000em that only supported INTx, but the function selected MSI-X simply because it's the first one attempted, even though it got 0 vectors. Enabling interrupts then failed. If the function had checked the vector count it would have correctly selected INTx. Now, my setup might have been quite old but it doesn't change that it selected wrong interrupt type.

OK thank you, it helps for the review, and could be added to the commit log.

Adding PCI bus maintainers for review.