Re: [PATCH v2 06/11] iotests/290: add test case to check 'discard-no-unref' option behavior

2024-05-23 Thread Alberto Garcia
On Mon 13 May 2024 09:31:58 AM +03, Andrey Drobyshev wrote: > We basically fill 2 images with identical data and perform discard > operations with and without 'discard-no-unref' enabled. Then we check > that images still read identically, that their disk usage is the same > (i.e. fallocate(FALLOC_

Re: [PATCH v2 05/11] iotests/common.rc: add disk_usage function

2024-05-23 Thread Alberto Garcia
On Mon 13 May 2024 09:31:57 AM +03, Andrey Drobyshev wrote: > Move the definition from iotests/250 to common.rc. This is used to > detect real disk usage of sparse files. In particular, we want to use > it for checking subclusters-based discards. > > Signed-off-by: Andrey Drobyshev Reviewed-by:

Re: [PATCH v2 04/11] block/file-posix: add trace event for fallocate() calls

2024-05-23 Thread Alberto Garcia
On Mon 13 May 2024 09:31:56 AM +03, Andrey Drobyshev wrote: > This would ease debugging of write zeroes and discard operations. > > Signed-off-by: Andrey Drobyshev Reviewed-by: Alberto Garcia Berto

Re: [PATCH v3 00/11] Support persistent reservation operations

2024-05-23 Thread 卢长奇
Hi, could anyone please review this series? On 2024/5/17 17:52, Changqi Lu wrote: > Hi, > > Please ignore the v2 series. Please review the v3 series instead. > Thanks! > > v2->v3: > In v2 Persist Through Power Loss(PTPL) is enable default. > In v3 PTPL is supported, which is passed as a parameter

Re: [PATCH 5/6] migration: Rephrase message on failure to save / load Xen device state

2024-05-23 Thread Peter Xu
On Mon, May 13, 2024 at 04:17:02PM +0200, Markus Armbruster wrote: > Functions that use an Error **errp parameter to return errors should > not also report them to the user, because reporting is the caller's > job. When the caller does, the error is reported twice. When it > doesn't (because it r

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 09/13] osdep: move O_DSYNC and O_DIRECT defines from file-posix

2024-05-23 Thread Daniel P . Berrangé
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”. > > Suggested-by: Philippe Mathieu-Daudé > Signed-off-by: Stefano Gar

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”. Suggest

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, Stefano Garzarella wrote: `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 --- Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

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

2024-05-23 Thread David Hildenbrand
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 environments. Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi R

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, Stefano Garzarella wrote: 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. Reviewed-b

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, Stefano Garzarella wrote: 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-

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, 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.) it's not really needed, because we don't use these fd with blocking operations, but only to map memory. In addition, in

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, Stefano Garzarella wrote: On macOS passing `-s /tmp/vhost.socket` parameter to the vhost-user-blk application, the bind was done on `/tmp/vhost.socke` pathname, missing the last character. This sounds like one of the portability problems described in the unix(7) manpage:

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, 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 is used only if VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD is negotiated. So, l

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

2024-05-23 Thread David Hildenbrand
On 23.05.24 16:55, 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 we should avoid sending the payload, since we were unable to send the header. Discovered before fixing the issue with the previo

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

2024-05-23 Thread Stefano Garzarella
On macOS passing `-s /tmp/vhost.socket` parameter to the vhost-user-blk application, the bind was done on `/tmp/vhost.socke` pathname, missing the last character. This sounds like one of the portability problems described in the unix(7) manpage: Pathname sockets When binding a socket

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

2024-05-23 Thread Stefano Garzarella
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 (e.g. vhost-user). The new `memory-backend-shm` can be used as an alternative when `memory-backen

[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 definitio

[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 07/13] vhost-user: enable frontends on any POSIX system

2024-05-23 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. Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe

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

2024-05-23 Thread Stefano Garzarella
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 linux/vhost.h which is available only on Linux (vhost_types.h contains many of the things we need) - macOS doesn't

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

2024-05-23 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. Acked-by: Thomas Huth Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Tested-by:

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

2024-05-23 Thread Stefano Garzarella
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 is used only if VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD is negotiated. So, let's mask that feature if the backend is not ab

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

2024-05-23 Thread Stefano Garzarella
In vu_message_write() we use sendmsg() to send the message header, then a write() to send the payload. If sendmsg() fails we should avoid sending the payload, since we were unable to send the header. Discovered before fixing the issue with the previous patch, where sendmsg() failed on macOS due t

[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 | 1

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

2024-05-23 Thread Stefano Garzarella
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.) it's not really needed, because we don't use these fd with blocking operations, but only to map memory. In addition, in some systems this operation can fail (e.g. in

[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 01/13] libvhost-user: set msg.msg_control to NULL when it is empty

2024-05-23 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é Tested-by: Philippe Mathieu-Daudé Acked-by: Stef

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

2024-05-23 Thread Stefano Garzarella
v1: https://patchew.org/QEMU/20240228114759.44758-1-sgarz...@redhat.com/ v2: https://patchew.org/QEMU/20240326133936.125332-1-sgarz...@redhat.com/ v3: https://patchew.org/QEMU/20240404122330.92710-1-sgarz...@redhat.com/ v4: https://patchew.org/QEMU/20240508074457.12367-1-sgarz...@redhat.com/ v5: -

Re: [PATCH v2 3/6] virtio: virtqueue_ordered_fill - VIRTIO_F_IN_ORDER support

2024-05-23 Thread Jonah Palmer
On 5/23/24 6:47 AM, Eugenio Perez Martin wrote: On Thu, May 23, 2024 at 12:30 PM Jonah Palmer wrote: On 5/22/24 12:07 PM, Eugenio Perez Martin wrote: On Mon, May 20, 2024 at 3:01 PM Jonah Palmer wrote: Add VIRTIO_F_IN_ORDER feature support for the virtqueue_fill operation. The goal o

Re: [PATCH v2 3/6] virtio: virtqueue_ordered_fill - VIRTIO_F_IN_ORDER support

2024-05-23 Thread Eugenio Perez Martin
On Thu, May 23, 2024 at 12:30 PM Jonah Palmer wrote: > > > > On 5/22/24 12:07 PM, Eugenio Perez Martin wrote: > > On Mon, May 20, 2024 at 3:01 PM Jonah Palmer > > wrote: > >> > >> Add VIRTIO_F_IN_ORDER feature support for the virtqueue_fill operation. > >> > >> The goal of the virtqueue_ordered_

Re: [PATCH v2 3/6] virtio: virtqueue_ordered_fill - VIRTIO_F_IN_ORDER support

2024-05-23 Thread Jonah Palmer
On 5/22/24 12:07 PM, Eugenio Perez Martin wrote: On Mon, May 20, 2024 at 3:01 PM Jonah Palmer wrote: Add VIRTIO_F_IN_ORDER feature support for the virtqueue_fill operation. The goal of the virtqueue_ordered_fill operation when the VIRTIO_F_IN_ORDER feature has been negotiated is to search

Re: [PATCH v2 2/6] virtio: virtqueue_pop - VIRTIO_F_IN_ORDER support

2024-05-23 Thread Jonah Palmer
On 5/22/24 11:45 AM, Eugenio Perez Martin wrote: On Mon, May 20, 2024 at 3:01 PM Jonah Palmer wrote: Add VIRTIO_F_IN_ORDER feature support in virtqueue_split_pop and virtqueue_packed_pop. VirtQueueElements popped from the available/descritpor ring are added to the VirtQueue's used_elems ar

Re: [PATCH v2 1/6] virtio: Add bool to VirtQueueElement

2024-05-23 Thread Jonah Palmer
On 5/22/24 11:44 AM, Eugenio Perez Martin wrote: On Mon, May 20, 2024 at 3:01 PM Jonah Palmer wrote: Add the boolean 'in_order_filled' member to the VirtQueueElement structure. The use of this boolean will signify whether the element has been processed and is ready to be flushed (so long as