From: "Michael S. Tsirkin" <mst@redhat.com>
To: Albert Esteve <aesteve@redhat.com>
Cc: qemu-devel@nongnu.org, dbassey@redhat.com,
manos.pitsidianakis@linaro.org, slp@redhat.com,
stefanha@redhat.com, "Fabiano Rosas" <farosas@suse.de>,
jasowang@redhat.com, "Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
david@redhat.com, hi@alyssa.is, stevensd@chromium.org,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH v11 0/7] vhost-user: Add SHMEM_MAP/UNMAP requests
Date: Tue, 2 Dec 2025 14:50:15 -0500 [thread overview]
Message-ID: <20251202144821-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20251111091058.879669-1-aesteve@redhat.com>
On Tue, Nov 11, 2025 at 10:10:51AM +0100, Albert Esteve wrote:
> Hi all,
>
> v10->v11
> - Rebase to grab commit fde5930cc37175cfcd0f03a089e26f4458a52311
> and explicitly unset reply_ack on the SHMEM_MAP/UNMAP msg.
> - Mention mapping cleanup on device reset in the spec.
> v9->v10
> - Fix transaction_commit invoked without transaction_begin
> on vhost_user_backend_handle_shmem_map() early errors
> - Removed fd tracking on VirtioSharedMemoryMapping, it
> is handled by the RAMBlock
> - Reject invalid BAR configurations when VIRTIO Shared Memory
> Regions are in use by vhost-user-test-device
> v8->v9
> - Fixed vhost-user new handlers to ensure that they always
> reply
> - Made MMAP request flags field u64 everywhere
> - Fixed double memory_region_del_subregion() on UNMAP
> - Add mappings cleaning on virtio_reset()
> - Some small typos and fixes
> - Fixed virtio pci bar mapping for vhost-user-test-device
> v7->v8
> - Unified VhostUserShmemObject and VirtioSharedMemoryMapping
> - Refined shmem_obj lifecycle by transferring ownership
> - Other small improvements
>
> This patch series implements dynamic fd-backed memory mapping support
> for vhost-user backends, enabling backends to dynamically request memory
> mappings and unmappings during runtime through the new
> VHOST_USER_BACKEND_SHMEM_MAP/UNMAP protocol messages.
>
> This feature benefits various VIRTIO devices that require dynamic shared
> memory management, including virtiofs (for DAX mappings), virtio-gpu
> (for resource sharing), and the recently standardized virtio-media.
>
> The implementation introduces a QOM-based architecture for managing
> shared memory lifecycle:
>
> - VirtioSharedMemoryMapping: an intermediate object that manages
> individual memory mappings by acting as generic container for regions
> declared in any vhost-user device type
> - Dynamic Mapping: backends can request mappings via SHMEM_MAP messages,
> with the frontend creating MemoryRegions from the provided file
> descriptors and adding them as subregions
>
> When a SHMEM_MAP request is received, the frontend:
> 1. Creates VirtioSharedMemoryMapping to manage the mapping lifecycle
> 2. Maps the provided fd with memory_region_init_ram_from_fd()
> 3. Creates a MemoryRegion backed by the mapped memory
> 4. Adds it as a subregion of the appropiate VIRTIO Shared Memory Region
>
> The QOM reference counting ensures automatic cleanup when mappings are
> removed or the device is destroyed.
>
> This patch also includes:
> - VHOST_USER_GET_SHMEM_CONFIG: a new frontend request allowing generic
> vhost-user devices to query shared memory configuration from backends
> at device initialization, enabling the generic vhost-user-device
> frontend to work with any backend regardless of specific shared memory
> requirements.
Looks good, we are in freeze so will merge after 10.2.
If it's not too much trouble, pls ping me after the release
to help make sure it's not forgotten.
> The implementation has been tested with rust-vmm based backends.
>
> Albert Esteve (7):
> vhost-user: Add VirtIO Shared Memory map request
> vhost_user.rst: Align VhostUserMsg excerpt members
> vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec
> vhost_user: Add frontend get_shmem_config command
> vhost_user.rst: Add GET_SHMEM_CONFIG message
> qmp: add shmem feature map
> vhost-user-device: Add shared memory BAR
>
> docs/interop/vhost-user.rst | 102 ++++++++
> hw/virtio/vhost-user-base.c | 47 +++-
> hw/virtio/vhost-user-test-device-pci.c | 39 +++-
> hw/virtio/vhost-user.c | 269 ++++++++++++++++++++++
> hw/virtio/virtio-qmp.c | 3 +
> hw/virtio/virtio.c | 199 ++++++++++++++++
> include/hw/virtio/vhost-backend.h | 10 +
> include/hw/virtio/vhost-user.h | 1 +
> include/hw/virtio/virtio.h | 137 +++++++++++
> subprojects/libvhost-user/libvhost-user.c | 70 ++++++
> subprojects/libvhost-user/libvhost-user.h | 54 +++++
> 11 files changed, 926 insertions(+), 5 deletions(-)
>
> --
> 2.49.0
next prev parent reply other threads:[~2025-12-02 19:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 9:10 [PATCH v11 0/7] vhost-user: Add SHMEM_MAP/UNMAP requests Albert Esteve
2025-11-11 9:10 ` [PATCH v11 1/7] vhost-user: Add VirtIO Shared Memory map request Albert Esteve
2025-11-11 9:10 ` [PATCH v11 2/7] vhost_user.rst: Align VhostUserMsg excerpt members Albert Esteve
2025-11-11 9:10 ` [PATCH v11 3/7] vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec Albert Esteve
2025-11-11 9:10 ` [PATCH v11 4/7] vhost_user: Add frontend get_shmem_config command Albert Esteve
2025-11-11 9:10 ` [PATCH v11 5/7] vhost_user.rst: Add GET_SHMEM_CONFIG message Albert Esteve
2025-11-11 9:10 ` [PATCH v11 6/7] qmp: add shmem feature map Albert Esteve
2025-11-11 9:10 ` [PATCH v11 7/7] vhost-user-device: Add shared memory BAR Albert Esteve
2025-12-02 19:50 ` Michael S. Tsirkin [this message]
2025-12-10 7:59 ` [PATCH v11 0/7] vhost-user: Add SHMEM_MAP/UNMAP requests Albert Esteve
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=20251202144821-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=aesteve@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=david@redhat.com \
--cc=dbassey@redhat.com \
--cc=farosas@suse.de \
--cc=hi@alyssa.is \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=slp@redhat.com \
--cc=stefanha@redhat.com \
--cc=stevensd@chromium.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;
as well as URLs for NNTP newsgroup(s).