[PATCH 1/1] net/virtio: fix Rx interrupt setup with MSI-X

Isaac Boukris iboukris at gmail.com
Tue Nov 17 20:51:03 CET 2026


Hi David,

On Tue, Nov 17, 2026 at 4:29 PM David Marchand
<david.marchand at redhat.com> wrote:
>
> Hello,
>
> On Tue, 17 Nov 2026 at 13:43, Isaac Boukris <iboukris at gmail.com> wrote:
> >
> > With Rx interrupts enabled, configuring a port initializes the device,
> > and a second time when an offload or RSS is requested. Each
> > initialization enables the interrupt eventfds.
> >
> > EAL now refuses to enable MSI-X eventfds twice, so such a configuration
> > fails, and so does configuring a port a second time:
> >
> >   EAL: Interrupt eventfds are already enabled
> >   virtio_configure_intr(): Fail to create eventfd
> >   ETHDEV: Port0 dev_configure = -16
> >
> > Before that EAL change, the previous eventfds were leaked.
> >
> > Disable the interrupts and release the eventfds before enabling them
> > again.
> >
> > Do it for a VFIO MSI-X handle only, the type whose eventfds EAL
> > creates. The other type that gets here is virtio-user's: its eventfds
> > are the backend's call fds, set once when the device is created.
> > Releasing them would reset their count, which nothing sets again, and
> > registering an Rx queue's interrupt would then fail.
> >
> > To reproduce, with a virtio-net PCI device bound to vfio-pci:
> >
> >   dpdk-l3fwd-power -l 0 -a 0000:0c:00.0 -- -p 1 --interrupt-only \
> >       --parse-ptype --config="(0,0,0)"
> >
> > Fixes: 3ba6b689893f ("eal/linux: fix eventfd leaks when enabling interrupts")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Isaac Boukris <iboukris at gmail.com>
>
> Thank you for the testing and report.
>
>
> > ---
> >  drivers/net/virtio/virtio_ethdev.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > index f2302089ee..37fc896fae 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -1455,6 +1455,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
> >                 return -ENOTSUP;
> >         }
> >
> > +       /* Reinitialization: release the previous eventfds first. */
> > +       if (rte_intr_type_get(dev->intr_handle) == RTE_INTR_HANDLE_VFIO_MSIX &&
> > +           rte_intr_dp_is_en(dev->intr_handle)) {
>
> The rte_intr_cap_multiple() guard right before should enough (for the
> interrupt type check).

Actually this check was added due to a real issue with virtio-user
which also returns true for this guard.

> > +               virtio_intr_disable(dev);
> > +               rte_intr_efd_disable(dev->intr_handle);
> > +       }
> > +
>
> Can the number of rxq change at this point?
> I don't think it is the case.
>
> If it can't, why do we need to release/set up new eventfds?
>
> The fix could be a simple:
>
> + if (rte_intr_dp_is_en(dev->intr_handle)) {
>
> >         ret = rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues);
> >         if (ret < 0) {
> >                 PMD_INIT_LOG(ERR, "Fail to create eventfd");
>
> + }

I think it could change if reconfigure is called multiple times, i'll
try to test it but we could still limit iit to that case, which would
make it even easier on the caller as it doesn't have to get the new
efds if he didn't change rxq number (although for non-virtio drivers
one probably still have to).

> We could probably move the rte_intr_vec_list_alloc call under this
> check too, but iiuc, this helper does nothing when called multiple
> times.
>
>
> --
> David Marchand
>


More information about the dev mailing list