From: Xiao Liang <shaw.leon@gmail.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbox@nvidia.com>
Cc: dev@dpdk.org, stable@dpdk.org,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH] net/virtio-user: fix interrupt handle cleanup
Date: Thu, 3 Dec 2026 16:12:21 +0800 [thread overview]
Message-ID: <20261203081223.1350-1-shaw.leon@gmail.com> (raw)
Clear event FDs before freeing the interrupt handle to avoid false leak
warnings since 67813957d876 ("interrupts: warn on leaked event FDs").
Use the same cleanup on dev init failure, so the allocated handle is
released.
Fixes: 3d4fb6fd2505 ("net/virtio-user: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
---
.../net/virtio/virtio_user/virtio_user_dev.c | 27 ++++++++++++++++---
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index c38ac059df..bf2e6e9d76 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -582,6 +582,27 @@ virtio_user_fill_intr_handle(struct virtio_user_dev *dev)
return 0;
}
+static void
+virtio_user_free_intr_handle(struct rte_eth_dev *eth_dev)
+{
+ struct rte_intr_handle *intr_handle = eth_dev->intr_handle;
+ int i, nb_intr;
+
+ if (intr_handle == NULL)
+ return;
+
+ /* fd is not owned by the driver, only clear reference here. */
+ rte_intr_fd_set(intr_handle, -1);
+
+ /* Clear event FD references before freeing the interrupt handle. */
+ nb_intr = rte_intr_nb_intr_get(intr_handle);
+ for (i = 0; i < nb_intr; i++)
+ rte_intr_efds_index_set(intr_handle, i, -1);
+
+ rte_intr_instance_free(intr_handle);
+ eth_dev->intr_handle = NULL;
+}
+
static void
virtio_user_mem_event_cb(enum rte_mem_event type __rte_unused,
const void *addr,
@@ -893,6 +914,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
return 0;
notify_uninit:
+ virtio_user_free_intr_handle(&rte_eth_devices[dev->hw.port_id]);
virtio_user_dev_uninit_notify(dev);
free_vrings:
virtio_user_free_vrings(dev);
@@ -907,10 +929,7 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev)
{
struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->hw.port_id];
- /* fd is not owned by the driver, only clear reference here. */
- rte_intr_fd_set(eth_dev->intr_handle, -1);
- rte_intr_instance_free(eth_dev->intr_handle);
- eth_dev->intr_handle = NULL;
+ virtio_user_free_intr_handle(eth_dev);
virtio_user_stop_device(dev);
--
2.25.1
reply other threads:[~2026-12-04 14:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261203081223.1350-1-shaw.leon@gmail.com \
--to=shaw.leon@gmail.com \
--cc=anatoly.burakov@intel.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.