On 20/06/2025 13:50, Pekka Riikonen wrote:
> 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.
> 
> Signed-off-by: Pekka Riikonen <[email protected]>
> ---
>   drivers/bus/pci/linux/pci_vfio.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 

Hi Pekka,

just one comment below about logging.

> diff --git a/drivers/bus/pci/linux/pci_vfio.c 
> b/drivers/bus/pci/linux/pci_vfio.c
> index 5317170231..02e7d7e40b 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -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;
> +

This looks functionally correct. It will try the next interrupt type and
in the case where a user has selected a specific interrupt type with the
command line --vfio-intr, then it will return -1 at the end.

It would be nice to be consistent with the eventfd check just above and
add an error log in the case where the user specified the interrupt type.

something like below. what do you think ?

+               /* If no vectors, fail if there is an explicit
+                * interrupt type, otherwise continue */
+               if (irq.count == 0) {
+                       if (intr_mode != RTE_INTR_MODE_NONE) {
+                               PCI_LOG(ERR, "Interrupt has no vectors!");
+                               return -1;
+                       } else
+                               continue;
+               }


>               /* Reallocate the efds and elist fields of intr_handle based
>                * on PCI device MSIX size.
>                */

Reply via email to