From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Samar Yadav <samaryadav5@gmail.com>, dev@dpdk.org
Cc: chenbox@nvidia.com, stable@dpdk.org, stephen@networkplumber.org,
tiwei.bie@intel.com
Subject: Re: [PATCH v3] net/virtio-user: fix eventfd sharing in secondary process
Date: Thu, 15 Oct 2026 19:19:23 +0200 [thread overview]
Message-ID: <2423e4d7-0342-4461-819f-3219a2daa3cd@redhat.com> (raw)
In-Reply-To: <20260703102530.133813-1-samaryadav5@gmail.com>
On 7/3/26 12:25 PM, Samar Yadav wrote:
> 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.
>
> Fixes: 1c8489da561b ("net/virtio-user: fix multi-process support")
> Cc: tiwei.bie@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Samar Yadav <samaryadav5@gmail.com>
> ---
> 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(-)
>
Applied to next-virtio/for-next-net.
Thanks,
Maxime
prev parent reply other threads:[~2026-10-15 17:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 8:57 [PATCH] net/virtio-user: fix eventfd sharing in secondary process Samar Yadav
2026-06-24 15:10 ` Stephen Hemminger
2026-06-26 7:41 ` Samar Yadav
2026-06-26 8:04 ` samar yadav
2026-06-24 15:16 ` Stephen Hemminger
2026-06-26 7:37 ` Samar Yadav
2026-06-26 8:05 ` samar yadav
2026-06-29 12:06 ` [PATCH v2] " Samar Yadav
2026-07-03 10:25 ` [PATCH v3] " Samar Yadav
2026-07-13 9:25 ` Samar Yadav
2026-07-29 11:06 ` Samar Yadav
2026-08-10 6:14 ` Samar Yadav
2026-08-18 9:03 ` Maxime Coquelin
2026-10-15 17:19 ` Maxime Coquelin [this message]
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=2423e4d7-0342-4461-819f-3219a2daa3cd@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=samaryadav5@gmail.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=tiwei.bie@intel.com \
/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