net/virtio-user: fix eventfd sharing in secondary process
PATCH 1/1 net/virtio-user: fix eventfd sharing in secondary process
virtio_user secondary processes cannot communicate with the vhost
backend: the kick/call eventfds are opened by the primary and never shared, so a secondary's queue notification writes to an invalid fd and traffic stalls.
Share the fds over a dedicated virtio-user multiprocess channel. The primary registers a process-wide MP action that returns a port's kick/call fds (looked up by port name); a secondary requests them at probe time, before the port is announced.
The received fds are stored in eth_dev->process_private, which is per-process, instead of the primary-owned shared dev->kickfds and dev->callfds arrays; the secondary data path notifies the backend using its own kickfd. In the primary, the MP handler reads the fd arrays under dev->mutex, and the teardown path takes the same lock while closing and freeing them, so the two cannot race.
--- .mailmap | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 56 +++- .../net/virtio/virtio_user/virtio_user_dev.h | 20 ++ drivers/net/virtio/virtio_user_ethdev.c | 260 +++++++++++++++++- 4 files changed, 333 insertions(+), 4 deletions(-)
.mailmap +1 -0
@@ -1448,6 +1448,7 @@ Salem Sol <[email protected]> Sam Andrew <[email protected]> Sam Chen <[email protected]> Sam Grove <[email protected]> +Samar Yadav <[email protected]> <[email protected]> Sameer Vaze <[email protected]> Sameh Gobriel <[email protected]> Samik Gupta <[email protected]>
drivers/net/virtio/virtio_user/virtio_user_dev.c +55 -1
70 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.h +20 -0
@@ -11,6 +11,11 @@#include "../virtio.h" #include "../virtio_ring.h" +#include <rte_eal.h> + +/* Max eventfds shareable over the MP channel (bounded by SCM_RIGHTS). */ +#define VIRTIO_USER_MAX_EVENTFDS RTE_MP_MAX_FD_NUM +enum virtio_user_backend_type {VIRTIO_USER_BACKEND_UNKNOWN ,VIRTIO_USER_BACKEND_VHOST_USER ,
@@ -89,5 +94,20 @@ int virtio_user_dev_get_rss_config(struct virtio_user_dev *dev, void *dst, size_ int length);void virtio_user_dev_delayed_disconnect_handler (void *param);int virtio_user_dev_server_reconnect (struct virtio_user_dev *dev); + +/** +* Collect a primary device's kick/call eventfds for sharing with a +* secondary process over the multiprocess channel. +* +* @param dev +* Pointer to the virtio_user device (primary). +* @param fds +* Output array, must hold at least VIRTIO_USER_MAX_EVENTFDS elements. +* @return +* Number of fds written on success, negative errno on error. +*/ +int virtio_user_get_eventfds_from_dev (struct virtio_user_dev *dev, +int fds[VIRTIO_USER_MAX_EVENTFDS ]); +extern const char *const virtio_user_backend_strings[];#endif
drivers/net/virtio/virtio_user_ethdev.c +257 -3
303 lines not on this page · raw message
Signature · 1 line
2.52.0
Quoted 6 lines · On Wed, 24 Jun 2026 08:57:41 +0000 Samar Yadav <[email protected]> wrote:
drivers/net/virtio/virtio_user/virtio_user_dev.c +2
-0@@ -865,9 +913,15 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev)rte_mem_event_callback_unregister (VIRTIO_USER_MEM_EVENT_CLB_NAME , dev); +/* +* Serialize closing/freeing the kick/call fd arrays against the MP
drivers/net/virtio/virtio_user/virtio_user_dev.c virtio_user_dev_uninit(struct virtio_user_dev *dev) · line 926
Quoted 10 lines
drivers/net/virtio/virtio_user/virtio_user_dev.c +5
-1+* handler, which reads them under the same lock to share them with +* secondary processes. +*/ +pthread_mutex_lock (&dev->mutex);virtio_user_dev_uninit_notify (dev); -virtio_user_free_vrings (dev); +pthread_mutex_unlock (&dev->mutex);free (dev->ifname);
Related bug. virtio_user is not initializing mutex as safe between processes. See rte_thread_mutex_init_shared() vs pthread_mutex_init()
Agreed on the related pthread_mutex_init bug.
In this patch dev->mutex is only ever locked by the primary process:
the MP handler runs in the primary's EAL dispatch thread, and the teardown path in virtio_user_dev_uninit() is primary-only. The secondary communicates via rte_mp_request_sync() over the EAL socket and never calls pthread_mutex_lock() on dev->mutex directly.
That said, POSIX requires PTHREAD_PROCESS_SHARED for a mutex stored in shared memory regardless of which processes actually lock it, and other DPDK multiprocess-aware code already uses rte_thread_mutex_init_shared()
for shared-memory mutexes. The pthread_mutex_init(&dev->mutex, NULL) call
predates this
patch but since this patch explicitly documents the lock's role I will fix the
initialisation in v2:
- pthread_mutex_init(&dev->mutex, NULL);
+ rte_thread_mutex_init_shared(&dev->mutex);
Quoted 24 lines · Stephen Hemminger
Review virtio_user_dev_uninit(struct virtio_user_dev *dev) · line 914
Quoted 3 lines · On Wed, 24 Jun 2026 08:57:41 +0000 Samar Yadav <[email protected]> wrote:
(quoted diff) +0
-0@@ -865,9 +913,15 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev) rte_mem_event_callback_unregister(VIRTIO_USER_MEM_EVENT_CLB_NAME,dev);
drivers/net/virtio/virtio_user/virtio_user_dev.c virtio_user_dev_uninit(struct virtio_user_dev *dev) · line 926
Quoted 13 lines
drivers/net/virtio/virtio_user/virtio_user_dev.c +7
-1+/* +* Serialize closing/freeing the kick/call fd arrays against the MP +* handler, which reads them under the same lock to share them with +* secondary processes. +*/ +pthread_mutex_lock (&dev->mutex);virtio_user_dev_uninit_notify (dev); -virtio_user_free_vrings (dev); +pthread_mutex_unlock (&dev->mutex);free (dev->ifname);Related bug.
virtio_useris not initializing mutex as safe between processes. Seerte_thread_mutex_init_shared()vspthread_mutex_init()
Quoted 5 lines · On Wed, 24 Jun 2026 08:16:10 -0700 Stephen Hemminger…
Quoted 5 lines
drivers/net/virtio/virtio_user/virtio_user_dev.c +5
-0+/* +* Serialize closing/freeing the kick/call fd arrays against the MP +* handler, which reads them under the same lock to share them with +* secondary processes. +*/
Quoted 8 lines
drivers/net/virtio/virtio_user/virtio_user_dev.c virtio_user_dev_uninit(struct virtio_user_dev *dev) · line 924
Quoted 5 lines
drivers/net/virtio/virtio_user/virtio_user_dev.c +2
-1+pthread_mutex_lock (&dev->mutex);virtio_user_dev_uninit_notify (dev); -virtio_user_free_vrings (dev); +pthread_mutex_unlock (&dev->mutex);Related bug.
virtio_useris not initializing mutex as safe between processes. Seerte_thread_mutex_init_shared()vspthread_mutex_init()
Agreed on the related pthread_mutex_init bug.
In this patch dev->mutex is only ever locked by the primary process:
the MP handler runs in the primary's EAL dispatch thread, and the teardown path in virtio_user_dev_uninit() is primary-only. The secondary communicates via rte_mp_request_sync() over the EAL socket and never calls pthread_mutex_lock() on dev->mutex directly.
That said, POSIX requires PTHREAD_PROCESS_SHARED for a mutex stored in shared memory regardless of which processes actually lock it, and other DPDK multiprocess-aware code already uses rte_thread_mutex_init_shared()
for shared-memory mutexes. The pthread_mutex_init(&dev->mutex, NULL) call predates this
patch but since this patch explicitly documents the lock's role I will fix the initialisation in v2:
- pthread_mutex_init(&dev->mutex, NULL);
+ rte_thread_mutex_init_shared(&dev->mutex);
Samar Yadav
PATCH v2 1/1 net/virtio-user: fix eventfd sharing in secondary process
virtio_user secondary processes cannot communicate with the vhost
backend: the kick/call eventfds are opened by the primary and never shared, so a secondary's queue notification writes to an invalid fd and traffic stalls.
Share the fds over a dedicated virtio-user multiprocess channel. The primary registers a process-wide MP action that returns a port's kick/call fds (looked up by port name); a secondary requests them at probe time, before the port is announced.
The received fds are stored in eth_dev->process_private, which is per-process, instead of the primary-owned shared dev->kickfds and dev->callfds arrays; the secondary data path notifies the backend using its own kickfd. In the primary, the MP handler reads the fd arrays under dev->mutex, and the teardown path takes the same lock while closing and freeing them, so the two cannot race.
Also fix the pre-existing pthread_mutex_init(&dev->mutex, NULL) call in virtio_user_dev_init(): POSIX requires PTHREAD_PROCESS_SHARED for a mutex stored in shared memory regardless of which processes actually lock it; use rte_thread_mutex_init_shared() as other multiprocess-aware drivers do.
---
v2:
- Use rte_calloc() instead of rte_malloc() for the kick/call fd arrays in virtio_user_sync_eventfds() so allocation failures are cleaner and unset entries are zero-initialised before the explicit -1 sentinel loop. (Stephen Hemminger)
- Fix the pre-existing pthread_mutex_init(&dev->mutex, NULL) call in virtio_user_dev_init() to use rte_thread_mutex_init_shared(), which sets PTHREAD_PROCESS_SHARED as POSIX requires for a mutex in shared memory. Add #include <rte_thread.h> to pull in the declaration. (Stephen Hemminger)
.mailmap | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 59 +++- .../net/virtio/virtio_user/virtio_user_dev.h | 20 ++ drivers/net/virtio/virtio_user_ethdev.c | 260 +++++++++++++++++- 4 files changed, 335 insertions(+), 5 deletions(-)
.mailmap +1 -0
@@ -1448,6 +1448,7 @@ Salem Sol <[email protected]> Sam Andrew <[email protected]> Sam Chen <[email protected]> Sam Grove <[email protected]> +Samar Yadav <[email protected]> <[email protected]> Sameer Vaze <[email protected]> Sameh Gobriel <[email protected]> Samik Gupta <[email protected]>
drivers/net/virtio/virtio_user/virtio_user_dev.c +57 -2
85 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.h +20 -0
@@ -11,6 +11,11 @@#include "../virtio.h" #include "../virtio_ring.h" +#include <rte_eal.h> + +/* Max eventfds shareable over the MP channel (bounded by SCM_RIGHTS). */ +#define VIRTIO_USER_MAX_EVENTFDS RTE_MP_MAX_FD_NUM +enum virtio_user_backend_type {VIRTIO_USER_BACKEND_UNKNOWN ,VIRTIO_USER_BACKEND_VHOST_USER ,
@@ -89,5 +94,20 @@ int virtio_user_dev_get_rss_config(struct virtio_user_dev *dev, void *dst, size_ int length);void virtio_user_dev_delayed_disconnect_handler (void *param);int virtio_user_dev_server_reconnect (struct virtio_user_dev *dev); + +/** +* Collect a primary device's kick/call eventfds for sharing with a +* secondary process over the multiprocess channel. +* +* @param dev +* Pointer to the virtio_user device (primary). +* @param fds +* Output array, must hold at least VIRTIO_USER_MAX_EVENTFDS elements. +* @return +* Number of fds written on success, negative errno on error. +*/ +int virtio_user_get_eventfds_from_dev (struct virtio_user_dev *dev, +int fds[VIRTIO_USER_MAX_EVENTFDS ]); +extern const char *const virtio_user_backend_strings[];#endif
drivers/net/virtio/virtio_user_ethdev.c +257 -3
303 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v3 1/1 net/virtio-user: fix eventfd sharing in secondary process
virtio_user secondary processes cannot communicate with the vhost
backend: the kick/call eventfds are opened by the primary and never shared, so a secondary's queue notification writes to an invalid fd and traffic stalls.
Share the fds over a dedicated virtio-user multiprocess channel. The primary registers a process-wide MP action that returns a port's kick/call fds (looked up by port name); a secondary requests them at probe time, before the port is announced.
The received fds are stored in eth_dev->process_private, which is per-process, instead of the primary-owned shared dev->kickfds and dev->callfds arrays; the secondary data path notifies the backend using its own kickfd. In the primary, the MP handler reads the fd arrays under dev->mutex, and the teardown path takes the same lock while closing and freeing them, so the two cannot race.
Also fix the pre-existing pthread_mutex_init(&dev->mutex, NULL) call in virtio_user_dev_init(): POSIX requires PTHREAD_PROCESS_SHARED for a mutex stored in shared memory regardless of which processes actually lock it; use rte_thread_mutex_init_shared() as other multiprocess-aware drivers do.
---
v3:
- Reorder new #includes: system headers first, then DPDK lib headers (alphabetized), then local virtio_* headers, per project convention.
- Name the "2" in eventfd count/index arithmetic (kick + call per queue) as VIRTIO_USER_EVENTFDS_PER_QUEUE instead of a bare literal. Leaves the pre-existing max_queue_pairs * 2 vring math untouched, since that is a different multiplier (vrings per queue pair) and already matches this file's existing style.
- Name the 5-second MP reply timeout in virtio_user_sync_eventfds() as VIRTIO_USER_MP_TIMEOUT_SEC with a comment on the rationale.
v2:
- Use rte_calloc() instead of rte_malloc() for the kick/call fd arrays in virtio_user_sync_eventfds() so allocation failures are cleaner and unset entries are zero-initialised before the explicit -1 sentinel loop. (Stephen Hemminger)
- Fix the pre-existing pthread_mutex_init(&dev->mutex, NULL) call in virtio_user_dev_init() to use rte_thread_mutex_init_shared(), which sets PTHREAD_PROCESS_SHARED as POSIX requires for a mutex in shared memory. Add #include <rte_thread.h> to pull in the declaration. (Stephen Hemminger)
.mailmap | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 59 +++- .../net/virtio/virtio_user/virtio_user_dev.h | 23 ++ drivers/net/virtio/virtio_user_ethdev.c | 276 +++++++++++++++++- 4 files changed, 350 insertions(+), 9 deletions(-)
.mailmap +1 -0
@@ -1448,6 +1448,7 @@ Salem Sol <[email protected]> Sam Andrew <[email protected]> Sam Chen <[email protected]> Sam Grove <[email protected]> +Samar Yadav <[email protected]> <[email protected]> Sameer Vaze <[email protected]> Sameh Gobriel <[email protected]> Samik Gupta <[email protected]>
drivers/net/virtio/virtio_user/virtio_user_dev.c +57 -2
85 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.h +23 -0
@@ -11,6 +11,14 @@#include "../virtio.h" #include "../virtio_ring.h" +#include <rte_eal.h> + +/* Max eventfds shareable over the MP channel (bounded by SCM_RIGHTS). */ +#define VIRTIO_USER_MAX_EVENTFDS RTE_MP_MAX_FD_NUM + +/* Each queue contributes one kick fd and one call fd to the MP channel. */ +#define VIRTIO_USER_EVENTFDS_PER_QUEUE 2 +enum virtio_user_backend_type {VIRTIO_USER_BACKEND_UNKNOWN ,VIRTIO_USER_BACKEND_VHOST_USER ,
@@ -89,5 +97,20 @@ int virtio_user_dev_get_rss_config(struct virtio_user_dev *dev, void *dst, size_ int length);void virtio_user_dev_delayed_disconnect_handler (void *param);int virtio_user_dev_server_reconnect (struct virtio_user_dev *dev); + +/** +* Collect a primary device's kick/call eventfds for sharing with a +* secondary process over the multiprocess channel. +* +* @param dev +* Pointer to the virtio_user device (primary). +* @param fds +* Output array, must hold at least VIRTIO_USER_MAX_EVENTFDS elements. +* @return +* Number of fds written on success, negative errno on error. +*/ +int virtio_user_get_eventfds_from_dev (struct virtio_user_dev *dev, +int fds[VIRTIO_USER_MAX_EVENTFDS ]); +extern const char *const virtio_user_backend_strings[];#endif
drivers/net/virtio/virtio_user_ethdev.c +269 -7
334 lines not on this page · raw message
Signature · 1 line
2.43.0
Hi Maxime, Stephen,
Gentle ping on this one. v2 addressed the rte_calloc() and rte_thread_mutex_init_shared() feedback from the initial review, and v3 cleaned up a few style items (include ordering, named constants) flagged by the automated review. CI is green apart from the automated review warning, which I've checked against the actual code and don't believe blocks anything.
Let me know if there's anything else needed on my end.
Thanks,
Samar Yadav
Hi Maxime,
Following up again — it's been about a month since the original report and a couple of weeks since my last ping, with no review comments on v2 or v3 yet. CI has stayed green throughout (aside from an automated review warning I've already checked against the code and don't believe is blocking).
Happy to rebase, resend, or address anything else needed — just let me know.
Thanks,
Samar Yadav
Hi all,
Widening the Cc a bit, this has been open since June 24 with no review comments on v2 or v3, and I haven't seen activity from Maxime or Chenbo on the list in the last while, so looping in David in case he has bandwidth to take a look or redirect it to someone who does.
Quick recap: the patch fixes a real bug (secondary virtio_user processes can't kick the vhost backend at all), both of Stephen's v1 review comments were addressed in v2, and v3 cleaned up a few style items from CI feedback. All CI checks are green aside from an automated review warning I've verified against the code and don't believe is blocking.
Happy to rebase, resend, or address anything else needed.
Thanks,
Samar Yadav
Hello Samar,
Quoted 51 lines · Samar Yadav
virtio_usersecondary processes cannot communicate with the vhost
backend: the kick/call eventfds are opened by the primary and never shared, so a secondary's queue notification writes to an invalid fd and traffic stalls.Share the fds over a dedicated virtio-user multiprocess channel. The primary registers a process-wide MP action that returns a port's kick/call fds (looked up by port name); a secondary requests them at probe time, before the port is announced.
The received fds are stored in
eth_dev->process_private, which is per-process, instead of the primary-owned shareddev->kickfdsanddev->callfdsarrays; the secondary data path notifies the backend using its own kickfd. In the primary, the MP handler reads the fd arrays underdev->mutex, and the teardown path takes the same lock while closing and freeing them, so the two cannot race.Also fix the pre-existing
pthread_mutex_init(&dev->mutex, NULL)call invirtio_user_dev_init(): POSIX requiresPTHREAD_PROCESS_SHAREDfor a mutex stored in shared memory regardless of which processes actually lock it; userte_thread_mutex_init_shared()as other multiprocess-aware drivers do.Fixes 1c8489da561b ("net/virtio-user: fix multi-process support")Signed-off-by Samar Yadav <[email protected]>---
v3:
- Reorder new #includes: system headers first, then DPDK lib headers (alphabetized), then local virtio_* headers, per project convention.
- Name the "2" in eventfd count/index arithmetic (kick + call per queue) asVIRTIO_USER_EVENTFDS_PER_QUEUEinstead of a bare literal. Leaves the pre-existingmax_queue_pairs* 2 vring math untouched, since that is a different multiplier (vrings per queue pair) and already matches this file's existing style.
- Name the 5-second MP reply timeout invirtio_user_sync_eventfds()asVIRTIO_USER_MP_TIMEOUT_SECwith a comment on the rationale.v2:
- Userte_calloc()instead ofrte_malloc()for the kick/call fd arrays invirtio_user_sync_eventfds()so allocation failures are cleaner and unset entries are zero-initialised before the explicit -1 sentinel loop. (Stephen Hemminger)
- Fix the pre-existingpthread_mutex_init(&dev->mutex, NULL)call invirtio_user_dev_init()to userte_thread_mutex_init_shared(), which setsPTHREAD_PROCESS_SHAREDas POSIX requires for a mutex in shared memory. Add #include <rte_thread.h> to pull in the declaration. (Stephen Hemminger)
Quoted 6 lines
.mailmap | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 59 +++- .../net/virtio/virtio_user/virtio_user_dev.h | 23 ++ drivers/net/virtio/virtio_user_ethdev.c | 276 +++++++++++++++++- 4 files changed, 350 insertions(+), 9 deletions(-)
The patch looks good to me.
Thanks,
Maxime
Maxime Coquelin
AppliedQuoted 50 lines · Samar Yadav
virtio_usersecondary processes cannot communicate with the vhost
backend: the kick/call eventfds are opened by the primary and never shared, so a secondary's queue notification writes to an invalid fd and traffic stalls.Share the fds over a dedicated virtio-user multiprocess channel. The primary registers a process-wide MP action that returns a port's kick/call fds (looked up by port name); a secondary requests them at probe time, before the port is announced.
The received fds are stored in
eth_dev->process_private, which is per-process, instead of the primary-owned shareddev->kickfdsanddev->callfdsarrays; the secondary data path notifies the backend using its own kickfd. In the primary, the MP handler reads the fd arrays underdev->mutex, and the teardown path takes the same lock while closing and freeing them, so the two cannot race.Also fix the pre-existing
pthread_mutex_init(&dev->mutex, NULL)call invirtio_user_dev_init(): POSIX requiresPTHREAD_PROCESS_SHAREDfor a mutex stored in shared memory regardless of which processes actually lock it; userte_thread_mutex_init_shared()as other multiprocess-aware drivers do.Fixes 1c8489da561b ("net/virtio-user: fix multi-process support")Signed-off-by Samar Yadav <[email protected]>---
v3:
- Reorder new #includes: system headers first, then DPDK lib headers (alphabetized), then local virtio_* headers, per project convention.
- Name the "2" in eventfd count/index arithmetic (kick + call per queue) asVIRTIO_USER_EVENTFDS_PER_QUEUEinstead of a bare literal. Leaves the pre-existingmax_queue_pairs* 2 vring math untouched, since that is a different multiplier (vrings per queue pair) and already matches this file's existing style.
- Name the 5-second MP reply timeout invirtio_user_sync_eventfds()asVIRTIO_USER_MP_TIMEOUT_SECwith a comment on the rationale.v2:
- Userte_calloc()instead ofrte_malloc()for the kick/call fd arrays invirtio_user_sync_eventfds()so allocation failures are cleaner and unset entries are zero-initialised before the explicit -1 sentinel loop. (Stephen Hemminger)
- Fix the pre-existingpthread_mutex_init(&dev->mutex, NULL)call invirtio_user_dev_init()to userte_thread_mutex_init_shared(), which setsPTHREAD_PROCESS_SHAREDas POSIX requires for a mutex in shared memory. Add #include <rte_thread.h> to pull in the declaration. (Stephen Hemminger)
Quoted 6 lines
.mailmap | 1 + .../net/virtio/virtio_user/virtio_user_dev.c | 59 +++- .../net/virtio/virtio_user/virtio_user_dev.h | 23 ++ drivers/net/virtio/virtio_user_ethdev.c | 276 +++++++++++++++++- 4 files changed, 350 insertions(+), 9 deletions(-)
Applied to next-virtio/for-next-net.
Thanks,
Maxime
drivers/net/virtio/virtio_user_ethdev.c virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev) · line 650
Quoted 8 lines · On Wed, 24 Jun 2026 08:57:41 +0000 Samar Yadav <[email protected]> wrote:
drivers/net/virtio/virtio_user_ethdev.c +8
-0+ pp =rte_zmalloc ("virtio_user_proc_priv" ,sizeof (*pp),0 ); +if (pp ==NULL ) +return -ENOMEM ; + + pp->kickfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 ); + pp->callfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 );
Better to use rte_calloc.
Agreed Stephen, will switch to rte_calloc in patch v2:
- pp->kickfds = rte_malloc("virtio_user_proc_priv",
- total_queues * sizeof(int), 0);
- pp->callfds = rte_malloc("virtio_user_proc_priv",
- total_queues * sizeof(int), 0);
+ pp->kickfds = rte_calloc("virtio_user_proc_priv",
+ total_queues, sizeof(int), 0);
+ pp->callfds = rte_calloc("virtio_user_proc_priv",
+ total_queues, sizeof(int), 0);
Quoted 14 lines · Stephen Hemminger
drivers/net/virtio/virtio_user_ethdev.c virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev) · line 650
Quoted 8 lines · On Wed, 24 Jun 2026 08:57:41 +0000 Samar Yadav <[email protected]> wrote:
drivers/net/virtio/virtio_user_ethdev.c +8
-0+ pp =rte_zmalloc ("virtio_user_proc_priv" ,sizeof (*pp),0 ); +if (pp ==NULL ) +return -ENOMEM ; + + pp->kickfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 ); + pp->callfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 );Better to use
rte_calloc.
Quoted 10 lines · On Wed, 24 Jun 2026 08:10:36 -0700 Stephen Hemminger…
drivers/net/virtio/virtio_user_ethdev.c virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev) · line 650
Quoted 8 lines
drivers/net/virtio/virtio_user_ethdev.c +8
-0+ pp =rte_zmalloc ("virtio_user_proc_priv" ,sizeof (*pp),0 ); +if (pp ==NULL ) +return -ENOMEM ; + + pp->kickfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 ); + pp->callfds =rte_malloc ("virtio_user_proc_priv" , + total_queues *sizeof (int ),0 );Better to use
rte_calloc.
Agreed Stephen, will switch to rte_calloc in patch v2:
- pp->kickfds = rte_malloc("virtio_user_proc_priv",
- total_queues * sizeof(int), 0);
- pp->callfds = rte_malloc("virtio_user_proc_priv",
- total_queues * sizeof(int), 0);
+ pp->kickfds = rte_calloc("virtio_user_proc_priv",
+ total_queues, sizeof(int), 0);
+ pp->callfds = rte_calloc("virtio_user_proc_priv",
+ total_queues, sizeof(int), 0);
Samar Yadav