From: Isaac Boukris <iboukris@gmail.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbox@nvidia.com>
Cc: dev@dpdk.org, David Marchand <david.marchand@redhat.com>,
Aman Singh <aman.deep.singh@intel.com>,
Luca Vizzarro <luca.vizzarro@arm.com>,
Patrick Robb <patrickrobb1997@gmail.com>,
Isaac Boukris <iboukris@gmail.com>,
stable@dpdk.org
Subject: [PATCH v4 1/8] net/virtio: fix Rx interrupt setup with MSI-X
Date: Wed, 18 Nov 2026 10:27:45 +0200 [thread overview]
Message-ID: <20261118082752.1043794-2-iboukris@gmail.com> (raw)
In-Reply-To: <20261118082752.1043794-1-iboukris@gmail.com>
With Rx interrupts, configuring a port initializes the device, twice
when an offload or RSS is requested. Each initialization enables the
interrupt eventfds. EAL now refuses to enable MSI-X eventfds twice
(before, it leaked the previous ones). So such a configuration fails,
and so does a second configuration:
EAL: Interrupt eventfds are already enabled
virtio_configure_intr(): Fail to create eventfd
ETHDEV: Port0 dev_configure = -16
Enable the eventfds only when they are not enabled. There is one per
Rx queue, so release them first when the number of Rx queues changed.
The application must then register the Rx queue interrupts again.
Release them only for a VFIO MSI-X handle, whose eventfds EAL creates.
A virtio-user handle also gets here. Its eventfds are the backend's
call fds, set once when the device is created. Releasing them would
reset their count for good, 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@dpdk.org
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
---
v4: shorter commit message, no code change.
v2: keep the eventfds unless the number of Rx queues changed (David Marchand).
drivers/net/virtio/virtio_ethdev.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index f2302089ee..8600f3899a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1455,10 +1455,20 @@ virtio_configure_intr(struct rte_eth_dev *dev)
return -ENOTSUP;
}
- ret = rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues);
- if (ret < 0) {
- PMD_INIT_LOG(ERR, "Fail to create eventfd");
- return ret;
+ /* On reinitialization, release the eventfds if the number of Rx queues changed. */
+ if (rte_intr_type_get(dev->intr_handle) == RTE_INTR_HANDLE_VFIO_MSIX &&
+ rte_intr_dp_is_en(dev->intr_handle) &&
+ rte_intr_nb_efd_get(dev->intr_handle) != dev->data->nb_rx_queues) {
+ virtio_intr_disable(dev);
+ rte_intr_efd_disable(dev->intr_handle);
+ }
+
+ 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");
+ return ret;
+ }
}
ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
--
2.56.1
next prev parent reply other threads:[~2026-11-18 8:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:43 [PATCH 0/1] net/virtio: fix Rx interrupts with MSI-X Isaac Boukris
2026-11-17 12:43 ` [PATCH 1/1] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-17 14:29 ` David Marchand
2026-11-17 19:51 ` Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 0/5] net/virtio: fix Rx interrupts " Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 1/5] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 2/5] test/virtio_user: add unit test of Rx interrupts Isaac Boukris
2026-11-17 21:59 ` [PATCH v2 3/5] app/testpmd: add Rx queue interrupts option Isaac Boukris
2026-11-17 22:00 ` [PATCH v2 4/5] dts: support virtio PCI ports Isaac Boukris
2026-11-17 22:00 ` [PATCH v2 5/5] dts: add Rx interrupt test suite Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 0/7] net/virtio: fix Rx interrupts with MSI-X Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 1/7] net/virtio: fix Rx interrupt setup " Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 2/7] net/virtio-user: fix packet loss with unused queue pairs Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 3/7] test/virtio_user: add unit test of " Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 4/7] test/virtio_user: add unit test of Rx interrupts Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 5/7] app/testpmd: add Rx queue interrupts option Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 6/7] dts: support virtio PCI ports Isaac Boukris
2026-11-18 0:19 ` [PATCH v3 7/7] dts: add Rx interrupt test suite Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 0/8] net/virtio: fix Rx interrupts with MSI-X Isaac Boukris
2026-11-18 8:27 ` Isaac Boukris [this message]
2026-11-18 8:27 ` [PATCH v4 2/8] net/virtio-user: fix packet loss with unused queue pairs Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 3/8] net/virtio-user: fix unaligned reads of control commands Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 4/8] test/virtio_user: add unit test of unused queue pairs Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 5/8] test/virtio_user: add unit test of Rx interrupts Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 6/8] app/testpmd: add Rx queue interrupts option Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 7/8] dts: support virtio PCI ports Isaac Boukris
2026-11-18 8:27 ` [PATCH v4 8/8] dts: add Rx interrupt test suite Isaac Boukris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118082752.1043794-2-iboukris@gmail.com \
--to=iboukris@gmail.com \
--cc=aman.deep.singh@intel.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=luca.vizzarro@arm.com \
--cc=maxime.coquelin@redhat.com \
--cc=patrickrobb1997@gmail.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox