[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 9/9] hostmem-file: support POSIX shm_open()
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH 9/9] hostmem-file: support POSIX shm_open() |
Date: |
Wed, 28 Feb 2024 12:08:37 +0000 |
User-agent: |
Mutt/2.2.12 (2023-09-09) |
On Wed, Feb 28, 2024 at 12:47:59PM +0100, Stefano Garzarella wrote:
> Add a new `shm` bool option for `-object memory-backend-file`.
>
> When this option is set to true, the POSIX shm_open(3) is used instead
> of open(2).
>
> So a file will not be created in the filesystem, but a "POSIX shared
> memory object" will be instantiated. In Linux this turns into a file
> in /dev/shm, but in other OSes this may not happen (for example in
> macOS or FreeBSD nothing is shown in any filesystem).
>
> This new feature is useful when we need to share guest memory with
> another process (e.g. vhost-user backend), but we don't have
> memfd_create() or any special filesystems (e.g. /dev/shm) available
> as in macOS.
>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> I am not sure this is the best way to support shm_open() in QEMU.
>
> Other solutions I had in mind were:
>
> - create a new memory-backend-shm
>
> - extend memory-backend-memfd to use shm_open() on systems where memfd is
> not available (problem: shm_open wants a name to assign to the object, but
> we can do a workaround by using a random name and do the unlink right away)
IMHO, create a new memory-backend-shm, don't overload memory-backend-memfd,
as this lets users choose between shm & memfd, even on Linux.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH 2/9] libvhost-user: fail vu_message_write() if sendmsg() is failing, (continued)
- [PATCH 2/9] libvhost-user: fail vu_message_write() if sendmsg() is failing, Stefano Garzarella, 2024/02/28
- [PATCH 4/9] vhost-user-server: don't abort if we can't set fd non-blocking, Stefano Garzarella, 2024/02/28
- [PATCH 3/9] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported, Stefano Garzarella, 2024/02/28
- [PATCH 5/9] contrib/vhost-user-blk: fix bind() using the right size of the address, Stefano Garzarella, 2024/02/28
- [PATCH 6/9] vhost-user: enable frontends on any POSIX system, Stefano Garzarella, 2024/02/28
- [PATCH 7/9] libvhost-user: enable it on any POSIX system, Stefano Garzarella, 2024/02/28
- [PATCH 8/9] contrib/vhost-user-blk: enabled it on any POSIX system, Stefano Garzarella, 2024/02/28
- [PATCH 9/9] hostmem-file: support POSIX shm_open(), Stefano Garzarella, 2024/02/28
Re: [PATCH 0/9] vhost-user: support any POSIX system (tested on macOS and FreeBSD), Stefano Garzarella, 2024/02/28