[PATCH v2] qapi: clarify that the default is backend dependent

2024-06-11 Thread Stefano Garzarella
-by: Stefano Garzarella --- v2: - documented @share's default right where it's defined [Markus] v1: https://patchew.org/QEMU/20240523133302.103858-1-sgarz...@redhat.com/ --- qapi/qom.json | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index

Re: [PATCH] qapi: clarify that the default is backend dependent

2024-06-06 Thread Stefano Garzarella
On Tue, Jun 04, 2024 at 04:58:49PM GMT, Markus Armbruster wrote: Stefano Garzarella writes: On Mon, Jun 03, 2024 at 11:34:10AM GMT, Markus Armbruster wrote: Stefano Garzarella writes: The default value of the @share option of the @MemoryBackendProperties eally depends on the backend type

[PATCH] qapi/qom: make some QOM properties depend on the build settings

2024-06-04 Thread Stefano Garzarella
Some QOM properties are associated with ObjectTypes that already depend on CONFIG_* switches. So to avoid generating dead code, let's also make the definition of those properties dependent on the corresponding CONFIG_*. Suggested-by: Markus Armbruster Signed-off-by: Stefano Garzarella --- qapi

Re: [PATCH v6 10/12] hostmem: add a new memory backend based on POSIX shm_open()

2024-06-04 Thread Stefano Garzarella
On Mon, Jun 03, 2024 at 11:42:35AM GMT, Markus Armbruster wrote: Stefano Garzarella writes: On Wed, May 29, 2024 at 04:50:20PM GMT, Markus Armbruster wrote: Stefano Garzarella writes: shm_open() creates and opens a new POSIX shared memory object. A POSIX shared memory object allows

Re: [PATCH] qapi: clarify that the default is backend dependent

2024-06-04 Thread Stefano Garzarella
On Mon, Jun 03, 2024 at 11:34:10AM GMT, Markus Armbruster wrote: Stefano Garzarella writes: The default value of the @share option of the @MemoryBackendProperties eally depends on the backend type, so let's document it explicitly and add the default value where it was missing. Cc: David

Re: [PATCH 1/1] vhost-vsock: add VIRTIO_F_RING_PACKED to feaure_bits

2024-05-30 Thread Stefano Garzarella
On Wed, May 29, 2024 at 02:49:28PM GMT, Halil Pasic wrote: On Tue, 28 May 2024 17:32:26 +0200 Stefano Garzarella wrote: >1) The uses is explicitly asking for a vhost device and giving the user >a non vhost device is not an option. I didn't get this point :-( can you elaborat

Re: [PATCH v6 10/12] hostmem: add a new memory backend based on POSIX shm_open()

2024-05-29 Thread Stefano Garzarella
On Wed, May 29, 2024 at 04:50:20PM GMT, Markus Armbruster wrote: Stefano Garzarella writes: shm_open() creates and opens a new POSIX shared memory object. A POSIX shared memory object allows creating memory backend with an associated file descriptor that can be shared with external processes

Re: [PATCH 1/1] vhost-vsock: add VIRTIO_F_RING_PACKED to feaure_bits

2024-05-28 Thread Stefano Garzarella
On Mon, May 27, 2024 at 01:27:10PM GMT, Halil Pasic wrote: On Thu, 16 May 2024 10:39:42 +0200 Stefano Garzarella wrote: [..] >--- > >This is a minimal fix, that follows the current patterns in the >codebase, and not necessarily the best one. Yeah, I did something similar

[PATCH v6 11/12] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-05-28 Thread Stefano Garzarella
). Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- v6 - removed `share=on` since it's the default [David] --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file

[PATCH v6 12/12] tests/qtest/vhost-user-test: add a test case for memory-backend-shm

2024-05-28 Thread Stefano Garzarella
`memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23

[PATCH v6 10/12] hostmem: add a new memory backend based on POSIX shm_open()

2024-05-28 Thread Stefano Garzarella
anonymous memory such as memfd. Acked-by: David Hildenbrand Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v5 - fixed documentation in qapi/qom.json and qemu-options.hx [Markus] v4 - fail if we find "share=off" in shm_backend_memory_alloc() [David] v3 - enriched comm

[PATCH v6 09/12] contrib/vhost-user-blk: enable it on any POSIX system

2024-05-28 Thread Stefano Garzarella
-Daudé Signed-off-by: Stefano Garzarella --- v6: - reverted v5 changes since we can't move O_DSYNC and O_DIRECT in osdep [Daniel, failing tests on Windows] v5: - O_DSYNC and O_DIRECT definition are now in osdep [Phil] - commit updated since we moved out all code changes v4: - moved using of "

[PATCH v6 03/12] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-05-28 Thread Stefano Garzarella
is not able to properly handle these messages. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 11 +++ 1 file changed, 11 insertions

[PATCH v6 08/12] libvhost-user: enable it on any POSIX system

2024-05-28 Thread Stefano Garzarella
.h to make the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v5: - fixed typos in the commit d

[PATCH v6 02/12] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-05-28 Thread Stefano Garzarella
-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 5 + 1 file changed, 5 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 22bea0c775..a11afd1960 100644 --- a/subprojects/libvhost-user/libvhost-user.c

[PATCH v6 06/12] contrib/vhost-user-*: use QEMU bswap helper functions

2024-05-28 Thread Stefano Garzarella
-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 9 + contrib/vhost-user-input/main.c | 16 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index

[PATCH v6 04/12] vhost-user-server: do not set memory fd non-blocking

2024-05-28 Thread Stefano Garzarella
-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- v3: - avoiding setting fd non-blocking for messages where we have memory fd (Eric) --- util/vhost-user-server.c | 12 1 file changed, 12 insertions(+) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c

[PATCH v6 00/12] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-05-28 Thread Stefano Garzarella
host.socket Branch pushed (and CI started) at https://gitlab.com/sgarzarella/qemu/-/tree/macos-vhost-user?ref_type=heads Thanks, Stefano Stefano Garzarella (12): libvhost-user: set msg.msg_control to NULL when it is empty libvhost-user: fail vu_message_write() if sendmsg() is failing libvhost-us

[PATCH v6 07/12] vhost-user: enable frontends on any POSIX system

2024-05-28 Thread Stefano Garzarella
Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- meson.build| 1 - hw/net/vhost_net.c | 5 + hw/block/Kconfig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index

[PATCH v6 01/12] libvhost-user: set msg.msg_control to NULL when it is empty

2024-05-28 Thread Stefano Garzarella
-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a879149fef..22bea0c775 100644 --- a/subprojects/libvhost

[PATCH v6 05/12] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-05-28 Thread Stefano Garzarella
(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 4

Re: [PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix

2024-05-23 Thread Stefano Garzarella
On Thu, May 23, 2024 at 04:55:18PM GMT, Stefano Garzarella wrote: These defines are also useful for vhost-user-blk when it is compiled in some POSIX systems that do not define them, so let's move them to “qemu/osdep.h”. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella

Re: [PATCH v5 12/13] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-05-23 Thread Stefano Garzarella
On Thu, May 23, 2024 at 05:06:00PM GMT, David Hildenbrand wrote: On 23.05.24 16:55, Stefano Garzarella wrote: `memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple

Re: [PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix

2024-05-23 Thread Stefano Garzarella
On Thu, May 23, 2024 at 04:14:48PM GMT, Daniel P. Berrangé wrote: On Thu, May 23, 2024 at 04:55:18PM +0200, Stefano Garzarella wrote: These defines are also useful for vhost-user-blk when it is compiled in some POSIX systems that do not define them, so let's move them to “qemu/osdep.h

[PATCH v5 06/13] contrib/vhost-user-*: use QEMU bswap helper functions

2024-05-23 Thread Stefano Garzarella
Let's replace the calls to le*toh() and htole*() with qemu/bswap.h helpers to make the code more portable. Suggested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- contrib/vhost

[PATCH v5 05/13] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-05-23 Thread Stefano Garzarella
(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 1 file changed, 1 insertion

[PATCH v5 13/13] tests/qtest/vhost-user-test: add a test case for memory-backend-shm

2024-05-23 Thread Stefano Garzarella
`memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tests

[PATCH v5 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix

2024-05-23 Thread Stefano Garzarella
These defines are also useful for vhost-user-blk when it is compiled in some POSIX systems that do not define them, so let's move them to “qemu/osdep.h”. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella --- include/qemu/osdep.h | 14 ++ block/file-posix.c

[PATCH v5 07/13] vhost-user: enable frontends on any POSIX system

2024-05-23 Thread Stefano Garzarella
Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- meson.build| 1 - hw/net/vhost_net.c | 5 + hw/block/Kconfig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a9de71d450..5a6f7a36eb 100644

[PATCH v5 11/13] hostmem: add a new memory backend based on POSIX shm_open()

2024-05-23 Thread Stefano Garzarella
anonymous memory such as memfd. Acked-by: David Hildenbrand Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v5 - fixed documentation in qapi/qom.json and qemu-options.hx [Markus] v4 - fail if we find "share=off" in shm_backend_memory_alloc() [David] v3 - enriched comm

[PATCH v5 12/13] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-05-23 Thread Stefano Garzarella
-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 117b9acd10..e945f6abf2 100644 --- a/tests/qtest/vhost

[PATCH v5 10/13] contrib/vhost-user-blk: enable it on any POSIX system

2024-05-23 Thread Stefano Garzarella
Previous patches made the vhost-user-blk application and the vhost-user-server.c dependency buildable for any POSIX system. Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella --- v5: - O_DSYNC and O_DIRECT

[PATCH v5 00/13] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-05-23 Thread Stefano Garzarella
a/qemu/-/tree/macos-vhost-user?ref_type=heads Thanks, Stefano Stefano Garzarella (13): libvhost-user: set msg.msg_control to NULL when it is empty libvhost-user: fail vu_message_write() if sendmsg() is failing libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported vhost-user-se

[PATCH v5 04/13] vhost-user-server: do not set memory fd non-blocking

2024-05-23 Thread Stefano Garzarella
-off-by: Stefano Garzarella --- v3: - avoiding setting fd non-blocking for messages where we have memory fd (Eric) --- util/vhost-user-server.c | 12 1 file changed, 12 insertions(+) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index 3bfb1ad3ec..b19229074a 100644

[PATCH v5 03/13] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-05-23 Thread Stefano Garzarella
is not able to properly handle these messages. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/subprojects

[PATCH v5 08/13] libvhost-user: enable it on any POSIX system

2024-05-23 Thread Stefano Garzarella
.h to make the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- v5: - fixed typos in the commit d

[PATCH v5 02/13] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-05-23 Thread Stefano Garzarella
to wrong parameters, but the frontend still sent the payload which the backend incorrectly interpreted as a wrong header. Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Acked-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella

[PATCH v5 01/13] libvhost-user: set msg.msg_control to NULL when it is empty

2024-05-23 Thread Stefano Garzarella
-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a879149fef..22bea0c775 100644 --- a/subprojects/libvhost

[PATCH] qapi: clarify that the default is backend dependent

2024-05-23 Thread Stefano Garzarella
The default value of the @share option of the @MemoryBackendProperties eally depends on the backend type, so let's document it explicitly and add the default value where it was missing. Cc: David Hildenbrand Suggested-by: Markus Armbruster Signed-off-by: Stefano Garzarella --- I followed how

Re: [PATCH 1/1] vhost-vsock: add VIRTIO_F_RING_PACKED to feaure_bits

2024-05-16 Thread Stefano Garzarella
ank you for raising this discussion! Regards, Halil --- hw/virtio/vhost-vsock-common.c | 1 + 1 file changed, 1 insertion(+) This patch LGTM, but as I mention we should fix other devices as well, but maybe we can do with the common macro you suggested in another patch. Reviewed-by: Stefano G

Re: [PATCH v4 10/12] hostmem: add a new memory backend based on POSIX shm_open()

2024-05-10 Thread Stefano Garzarella
On Wed, May 08, 2024 at 01:59:33PM GMT, Markus Armbruster wrote: Stefano Garzarella writes: shm_open() creates and opens a new POSIX shared memory object. A POSIX shared memory object allows creating memory backend with an associated file descriptor that can be shared with external processes

Re: [PATCH v4 09/12] contrib/vhost-user-blk: enable it on any POSIX system

2024-05-10 Thread Stefano Garzarella
On Wed, May 08, 2024 at 12:32:08PM GMT, Philippe Mathieu-Daudé wrote: On 8/5/24 09:44, Stefano Garzarella wrote: Let's make the code more portable by adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable

Re: [PATCH v4 08/12] libvhost-user: enable it on any POSIX system

2024-05-10 Thread Stefano Garzarella
On Wed, May 08, 2024 at 12:36:30PM GMT, Philippe Mathieu-Daudé wrote: On 8/5/24 09:44, Stefano Garzarella wrote: The vhost-user protocol is not really Linux-specific so let's enable libvhost-user for any POSIX system. Compiling it on macOS and FreeBSD some problems came up: - avoid to include

Re: [PATCH v4 03/12] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-05-10 Thread Stefano Garzarella
On Wed, May 08, 2024 at 12:39:33PM GMT, Philippe Mathieu-Daudé wrote: On 8/5/24 09:44, Stefano Garzarella wrote: libvhost-user will panic when receiving VHOST_USER_GET_INFLIGHT_FD message if MFD_ALLOW_SEALING is not defined, since it's not able to create a memfd. VHOST_USER_GET_INFLIGHT_FD

Re: Hermetic virtio-vsock in QEMU

2024-05-08 Thread Stefano Garzarella
On Wed, May 08, 2024 at 01:13:09PM GMT, Marc-André Lureau wrote: Hi On Wed, May 8, 2024 at 11:50 AM Stefano Garzarella wrote: Hi Roman, On Tue, May 07, 2024 at 11:20:50PM GMT, Roman Kiryanov wrote: >Hi Stefano, > >On Tue, May 7, 2024 at 1:10 AM Stefano Garzarella wrote:

Re: [PATCH v4 01/12] libvhost-user: set msg.msg_control to NULL when it is empty

2024-05-08 Thread Stefano Garzarella
On Wed, May 08, 2024 at 09:57:13AM GMT, Daniel P. Berrangé wrote: On Wed, May 08, 2024 at 09:44:45AM +0200, Stefano Garzarella wrote: On some OS (e.g. macOS) sendmsg() returns -1 (errno EINVAL) if the `struct msghdr` has the field `msg_controllen` set to 0, but `msg_control` is not NULL

Re: Hermetic virtio-vsock in QEMU

2024-05-08 Thread Stefano Garzarella
Hi Roman, On Tue, May 07, 2024 at 11:20:50PM GMT, Roman Kiryanov wrote: Hi Stefano, On Tue, May 7, 2024 at 1:10 AM Stefano Garzarella wrote: I have no experience with Windows, but what we need for vhost-user is: - AF_UNIX and be able to send file descriptors using ancillary data (i.e

[PATCH v4 05/12] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-05-08 Thread Stefano Garzarella
(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost

[PATCH v4 11/12] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-05-08 Thread Stefano Garzarella
`memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple environments. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed

[PATCH v4 01/12] libvhost-user: set msg.msg_control to NULL when it is empty

2024-05-08 Thread Stefano Garzarella
On some OS (e.g. macOS) sendmsg() returns -1 (errno EINVAL) if the `struct msghdr` has the field `msg_controllen` set to 0, but `msg_control` is not NULL. Reviewed-by: Eric Blake Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella

[PATCH v4 04/12] vhost-user-server: do not set memory fd non-blocking

2024-05-08 Thread Stefano Garzarella
. in macOS setting an fd returned by shm_open() non-blocking fails with errno = ENOTTY). So, let's avoid setting fd non-blocking for those messages that we know carry memory fd (e.g. VHOST_USER_ADD_MEM_REG, VHOST_USER_SET_MEM_TABLE). Signed-off-by: Stefano Garzarella --- v3: - avoiding setting fd non

[PATCH v4 03/12] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-05-08 Thread Stefano Garzarella
is not able to properly handle these messages. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a11afd1960

[PATCH v4 12/12] tests/qtest/vhost-user-test: add a test case for memory-backend-shm

2024-05-08 Thread Stefano Garzarella
`memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user

[PATCH v4 07/12] vhost-user: enable frontends on any POSIX system

2024-05-08 Thread Stefano Garzarella
The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system. In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Signed-off-by: Stefano Garzarella --- meson.build

[PATCH v4 06/12] contrib/vhost-user-*: use QEMU bswap helper functions

2024-05-08 Thread Stefano Garzarella
Let's replace the calls to le*toh() and htole*() with qemu/bswap.h helpers to make the code more portable. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 9 + contrib/vhost-user-input/main.c | 16

[PATCH v4 09/12] contrib/vhost-user-blk: enable it on any POSIX system

2024-05-08 Thread Stefano Garzarella
Let's make the code more portable by adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable it for any POSIX system. Signed-off-by: Stefano Garzarella --- v4: - moved using of "qemu/bswap.h" API in

[PATCH v4 10/12] hostmem: add a new memory backend based on POSIX shm_open()

2024-05-08 Thread Stefano Garzarella
anonymous memory such as memfd. Acked-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- v4 - fail if we find "share=off" in shm_backend_memory_alloc() [David] v3 - enriched commit message and documentation to highlight that we want to mimic memfd (David) --- docs/system/dev

[PATCH v4 08/12] libvhost-user: enable it on any POSIX system

2024-05-08 Thread Stefano Garzarella
e the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h | 2 +- subprojects/libvhost-user/libvh

[PATCH v4 02/12] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-05-08 Thread Stefano Garzarella
to wrong parameters, but the frontend still sent the payload which the backend incorrectly interpreted as a wrong header. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 5 + 1 file changed, 5 insertions(+) diff --git a/subprojects/libvhost-user/libvhost

[PATCH v4 00/12] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-05-08 Thread Stefano Garzarella
-device vhost-user-blk-pci,num-queues=1,chardev=char0 \ -chardev socket,id=char0,path=/tmp/vhost.socket Branch pushed (and CI started) at https://gitlab.com/sgarzarella/qemu/-/tree/macos-vhost-user?ref_type=heads Thanks, Stefano Stefano Garzarella (12): libvhost-user: set msg.msg_control to NUL

Re: Hermetic virtio-vsock in QEMU

2024-05-07 Thread Stefano Garzarella
Hi, sorry for the delay, but I have been away most of last month. On Thu, Apr 18, 2024 at 10:34:43AM GMT, Daniel P. Berrangé wrote: On Wed, Apr 17, 2024 at 12:31:41PM -0700, Roman Kiryanov wrote: Hi Daniel, thank you for looking into this. I checked how VHOST_USER_VSOCK and it refers to the

Re: [PATCH for-9.1 v3 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-04-08 Thread Stefano Garzarella
On Mon, Apr 08, 2024 at 10:03:15AM +0200, David Hildenbrand wrote: On 08.04.24 09:58, Stefano Garzarella wrote: On Thu, Apr 04, 2024 at 04:09:34PM +0200, David Hildenbrand wrote: On 04.04.24 14:23, Stefano Garzarella wrote: shm_open() creates and opens a new POSIX shared memory object

Re: [PATCH for-9.1 v3 00/11] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-04-08 Thread Stefano Garzarella
FYI I'll be on PTO till May 2nd, I'll send the v4 when I'm back ASAP. Thanks, Stefano On Thu, Apr 04, 2024 at 02:23:19PM +0200, Stefano Garzarella wrote: v1: https://patchew.org/QEMU/20240228114759.44758-1-sgarz...@redhat.com/ v2: https://patchew.org/QEMU/20240326133936.125332-1-sgarz

Re: [PATCH for-9.1 v3 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-04-08 Thread Stefano Garzarella
On Thu, Apr 04, 2024 at 04:09:34PM +0200, David Hildenbrand wrote: On 04.04.24 14:23, Stefano Garzarella wrote: shm_open() creates and opens a new POSIX shared memory object. A POSIX shared memory object allows creating memory backend with an associated file descriptor that can be shared

Re: [PATCH for-9.1 v3 08/11] contrib/vhost-user-blk: enable it on any POSIX system

2024-04-08 Thread Stefano Garzarella
On Thu, Apr 04, 2024 at 04:00:38PM +0200, Philippe Mathieu-Daudé wrote: Hi Stefano, Hi Phil! On 4/4/24 14:23, Stefano Garzarella wrote: Let's make the code more portable by using the "qemu/bswap.h" API and adding defines from block/file-posix.c to support O_DIRECT in other sy

[PATCH for-9.1 v3 03/11] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-04-04 Thread Stefano Garzarella
is not able to properly handle these messages. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a11afd1960

[PATCH for-9.1 v3 11/11] tests/qtest/vhost-user-test: add a test case for memory-backend-shm

2024-04-04 Thread Stefano Garzarella
`memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user

[PATCH for-9.1 v3 06/11] vhost-user: enable frontends on any POSIX system

2024-04-04 Thread Stefano Garzarella
The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system. In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Signed-off-by: Stefano Garzarella --- meson.build

[PATCH for-9.1 v3 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-04-04 Thread Stefano Garzarella
anonymous memory such as memfd. Signed-off-by: Stefano Garzarella --- v3 - enriched commit message and documentation to highlight that we want to mimic memfd (David) --- docs/system/devices/vhost-user.rst | 5 +- qapi/qom.json | 17 + backends/hostmem-shm.c

[PATCH for-9.1 v3 08/11] contrib/vhost-user-blk: enable it on any POSIX system

2024-04-04 Thread Stefano Garzarella
Let's make the code more portable by using the "qemu/bswap.h" API and adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable it for any POSIX system. Signed-off-by: Stefano Garzarella --- m

[PATCH for-9.1 v3 04/11] vhost-user-server: do not set memory fd non-blocking

2024-04-04 Thread Stefano Garzarella
. in macOS setting an fd returned by shm_open() non-blocking fails with errno = ENOTTY). So, let's avoid setting fd non-blocking for those messages that we know carry memory fd (e.g. VHOST_USER_ADD_MEM_REG, VHOST_USER_SET_MEM_TABLE). Signed-off-by: Stefano Garzarella --- v3: - avoiding setting fd non

[PATCH for-9.1 v3 00/11] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-04-04 Thread Stefano Garzarella
tarted) at https://gitlab.com/sgarzarella/qemu/-/tree/macos-vhost-user?ref_type=heads Thanks, Stefano Stefano Garzarella (11): libvhost-user: set msg.msg_control to NULL when it is empty libvhost-user: fail vu_message_write() if sendmsg() is failing libvhost-user: mask F_INFLIGHT_SHMFD if

[PATCH for-9.1 v3 07/11] libvhost-user: enable it on any POSIX system

2024-04-04 Thread Stefano Garzarella
e the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h | 2 +- subprojects/libvhost-user/libvh

[PATCH for-9.1 v3 05/11] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-04-04 Thread Stefano Garzarella
(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk

[PATCH for-9.1 v3 10/11] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-04-04 Thread Stefano Garzarella
`memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple environments. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed

[PATCH for-9.1 v3 01/11] libvhost-user: set msg.msg_control to NULL when it is empty

2024-04-04 Thread Stefano Garzarella
On some OS (e.g. macOS) sendmsg() returns -1 (errno EINVAL) if the `struct msghdr` has the field `msg_controllen` set to 0, but `msg_control` is not NULL. Reviewed-by: Eric Blake Reviewed-by: David Hildenbrand Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 1

[PATCH for-9.1 v3 02/11] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-04-04 Thread Stefano Garzarella
to wrong parameters, but the frontend still sent the payload which the backend incorrectly interpreted as a wrong header. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 5 + 1 file changed, 5 insertions(+) diff --git a/subprojects/libvhost-user/libvhost

Re: [PATCH for-9.1 v2 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-03-27 Thread Stefano Garzarella
On Wed, Mar 27, 2024 at 12:51:51PM +0100, David Hildenbrand wrote: On 27.03.24 11:23, Stefano Garzarella wrote: On Tue, Mar 26, 2024 at 03:45:52PM +0100, David Hildenbrand wrote: +mode = 0; +oflag = O_RDWR | O_CREAT | O_EXCL; +backend_name = host_memory_backend_get_name(backend

Re: vhost-user-blk reconnect issue

2024-03-27 Thread Stefano Garzarella
Hi Yajun, On Mon, Mar 25, 2024 at 10:54:13AM +, Yajun Wu wrote: Hi experts, With latest QEMU (8.2.90), we find two vhost-user-blk backend reconnect failure scenarios: Do you know if has it ever worked and so it's a regression, or have we always had this problem? Thanks, Stefano 1.

Re: [PATCH for-9.1 v2 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-03-27 Thread Stefano Garzarella
On Tue, Mar 26, 2024 at 03:45:52PM +0100, David Hildenbrand wrote: +mode = 0; +oflag = O_RDWR | O_CREAT | O_EXCL; +backend_name = host_memory_backend_get_name(backend); + +/* + * Some operating systems allow creating anonymous POSIX shared memory + * objects (e.g. FreeBSD

Re: [PATCH for-9.1 v2 04/11] vhost-user-server: don't abort if we can't set fd non-blocking

2024-03-27 Thread Stefano Garzarella
On Tue, Mar 26, 2024 at 09:40:12AM -0500, Eric Blake wrote: On Tue, Mar 26, 2024 at 02:39:29PM +0100, Stefano Garzarella wrote: In vhost-user-server we set all fd received from the other peer in non-blocking mode. For some of them (e.g. memfd, shm_open, etc.) if we fail, it's not really

Re: [PATCH for-9.1 v2 03/11] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-03-27 Thread Stefano Garzarella
On Tue, Mar 26, 2024 at 09:36:54AM -0500, Eric Blake wrote: On Tue, Mar 26, 2024 at 02:39:28PM +0100, Stefano Garzarella wrote: libvhost-user will panic when receiving VHOST_USER_GET_INFLIGHT_FD message if MFD_ALLOW_SEALING is not defined, since it's not able to create a memfd

Re: [PATCH for-9.1 v2 02/11] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-03-27 Thread Stefano Garzarella
On Tue, Mar 26, 2024 at 03:36:52PM +0100, David Hildenbrand wrote: On 26.03.24 15:34, Eric Blake wrote: On Tue, Mar 26, 2024 at 02:39:27PM +0100, Stefano Garzarella wrote: In vu_message_write() we use sendmsg() to send the message header, then a write() to send the payload. If sendmsg() fails

[PATCH for-9.1 v2 11/11] tests/qtest/vhost-user-test: add a test case for memory-backend-shm

2024-03-26 Thread Stefano Garzarella
`memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user

[PATCH for-9.1 v2 04/11] vhost-user-server: don't abort if we can't set fd non-blocking

2024-03-26 Thread Stefano Garzarella
just report a warning instead of panicking if we fail to set some fd in non-blocking mode. This for example occurs in macOS where setting shm_open() fd non-blocking is failing (errno: 25). Signed-off-by: Stefano Garzarella --- util/vhost-user-server.c | 6 +- 1 file changed, 5 insertions

[PATCH for-9.1 v2 03/11] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-03-26 Thread Stefano Garzarella
is not able to properly handle these messages. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index a11afd1960

[PATCH for-9.1 v2 09/11] hostmem: add a new memory backend based on POSIX shm_open()

2024-03-26 Thread Stefano Garzarella
-backend-memfd` is not available (Linux only), since shm_open() should be provided by any POSIX-compliant operating system. Signed-off-by: Stefano Garzarella --- docs/system/devices/vhost-user.rst | 5 +- qapi/qom.json | 17 + backends/hostmem-shm.c | 118

[PATCH for-9.1 v2 06/11] vhost-user: enable frontends on any POSIX system

2024-03-26 Thread Stefano Garzarella
The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system. In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Signed-off-by: Stefano Garzarella --- meson.build

[PATCH for-9.1 v2 00/11] vhost-user: support any POSIX system (tested on macOS, FreeBSD, OpenBSD)

2024-03-26 Thread Stefano Garzarella
Branch pushed (and CI started) at https://gitlab.com/sgarzarella/qemu/-/tree/macos-vhost-user?ref_type=heads Thanks, Stefano Stefano Garzarella (11): libvhost-user: set msg.msg_control to NULL when it is empty libvhost-user: fail vu_message_write() if sendmsg() is failing libvhost-user:

[PATCH for-9.1 v2 01/11] libvhost-user: set msg.msg_control to NULL when it is empty

2024-03-26 Thread Stefano Garzarella
On some OS (e.g. macOS) sendmsg() returns -1 (errno EINVAL) if the `struct msghdr` has the field `msg_controllen` set to 0, but `msg_control` is not NULL. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH for-9.1 v2 05/11] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-03-26 Thread Stefano Garzarella
(struct sockaddr_un). So let's follow the last advice and simplify the code as well. Signed-off-by: Stefano Garzarella --- contrib/vhost-user-blk/vhost-user-blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk

[PATCH for-9.1 v2 07/11] libvhost-user: enable it on any POSIX system

2024-03-26 Thread Stefano Garzarella
e the code works on FreeBSD where MFD_ALLOW_SEALING is defined - define MAP_NORESERVE if it's not defined (e.g. on FreeBSD) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h | 2 +- subprojects/libvhost-user/libvh

[PATCH for-9.1 v2 08/11] contrib/vhost-user-blk: enable it on any POSIX system

2024-03-26 Thread Stefano Garzarella
Let's make the code more portable by using the "qemu/bswap.h" API and adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable it for any POSIX system. Signed-off-by: Stefano Garzarella --- m

[PATCH for-9.1 v2 02/11] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-03-26 Thread Stefano Garzarella
to wrong parameters, but the frontend still sent the payload which the backend incorrectly interpreted as a wrong header. Signed-off-by: Stefano Garzarella --- subprojects/libvhost-user/libvhost-user.c | 5 + 1 file changed, 5 insertions(+) diff --git a/subprojects/libvhost-user/libvhost

[PATCH for-9.1 v2 10/11] tests/qtest/vhost-user-blk-test: use memory-backend-shm

2024-03-26 Thread Stefano Garzarella
`memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple environments. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed

[PATCH for-9.0 v2] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value

2024-03-22 Thread Stefano Garzarella
://lore.kernel.org/virtualization/20240206145154.118044-1-sgarz...@redhat.com/T/#u Acked-by: Eugenio Pérez Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- Based-on: 20240315155949.86066-1-kw...@redhat.com v1: https://patchew.org/QEMU/20240207092702.25242-1-sgarz...@redhat.com/ v2

Re: [PATCH] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value

2024-03-20 Thread Stefano Garzarella
On Wed, Mar 20, 2024 at 12:18:14PM +0800, Jason Wang wrote: On Mon, Mar 18, 2024 at 4:27 PM Stefano Garzarella wrote: On Mon, Mar 18, 2024 at 12:31:59PM +0800, Jason Wang wrote: >On Fri, Mar 15, 2024 at 4:23 PM Stefano Garzarella wrote: >> >> On Thu, Mar 14, 2024 at 11:17:01

Re: [PATCH 2/9] backends/confidential-guest-support: Add IGVM file parameter

2024-03-19 Thread Stefano Garzarella
On Tue, Feb 27, 2024 at 02:50:08PM +, Roy Hopkins wrote: In order to add support for parsing IGVM files for secure virtual machines, a the path to an IGVM file needs to be specified as part of the guest configuration. It makes sense to add this to the ConfidentialGuestSupport object as this

Re: [PATCH 0/9] Introduce support for IGVM files

2024-03-19 Thread Stefano Garzarella
Hi Roy, thanks for this series! On Tue, Feb 27, 2024 at 02:50:06PM +, Roy Hopkins wrote: Hi everyone, This initial patch series submission adds the capability to configure confidential guests using files that conform to the Independent Guest Virtual Machine (IGVM) file format. The series

Re: [PATCH] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value

2024-03-18 Thread Stefano Garzarella
On Mon, Mar 18, 2024 at 12:31:59PM +0800, Jason Wang wrote: On Fri, Mar 15, 2024 at 4:23 PM Stefano Garzarella wrote: On Thu, Mar 14, 2024 at 11:17:01AM +0800, Jason Wang wrote: >On Wed, Feb 7, 2024 at 5:27 PM Stefano Garzarella wrote: >> >> vhost_vdpa_set_vring_ready() cou

  1   2   3   4   5   6   7   8   9   10   >