Re: [PULL v4 30/83] virtio: core: vq reset feature negotation support

2022-11-18 Thread Stefano Garzarella
Hi, starting from this commit 69e1c14aa2 ("virtio: core: vq reset feature negotation support"), vhost-user-vsock and vhost-vsock fails while setting the device features, because VIRTIO_F_RING_RESET is not masked. I'm not sure vsock is the only one affected. We could fix in two ways: 1) Masking

Re: [PULL v4 30/83] virtio: core: vq reset feature negotation support

2022-11-18 Thread Stefano Garzarella
On Fri, Nov 18, 2022 at 3:32 PM Stefano Garzarella wrote: > > Hi, > starting from this commit 69e1c14aa2 ("virtio: core: vq reset feature > negotation support"), vhost-user-vsock and vhost-vsock fails while > setting the device features, because VIRTIO_F_RING_RESET is

Re: [PULL v4 30/83] virtio: core: vq reset feature negotation support

2022-11-21 Thread Stefano Garzarella
On Mon, Nov 21, 2022 at 02:07:41AM -0500, Michael S. Tsirkin wrote: On Mon, Nov 21, 2022 at 02:17:02PM +0800, Jason Wang wrote: On Sun, Nov 20, 2022 at 1:19 AM Michael S. Tsirkin wrote: > > On Fri, Nov 18, 2022 at 03:32:56PM +0100, Stefano Garzarella wrote: > > Hi, > >

[PATCH] vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices

2022-11-21 Thread Stefano Garzarella
: vq reset feature negotation support") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1318 Signed-off-by: Stefano Garzarella --- To prevent this problem in the future, perhaps we should provide a function (e.g. vhost_device_get_features) where we go to mask all non-device-specific

[PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-11-23 Thread Stefano Garzarella
re we disable vrings. [1] https://gitlab.com/virtio-fs/virtiofsd [2] https://github.com/rust-vmm/vhost/blob/240fc2966/crates/vhost-user-backend/src/event_loop.rs#L217 Fixes: 02b61f38d3 ("hw/virtio: incorporate backend features in features") Reported-by: German Maglione Tested-by: Germ

Re: [PATCH] vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices

2022-11-23 Thread Stefano Garzarella
On Tue, Nov 22, 2022 at 07:01:38PM +0100, Eugenio Perez Martin wrote: On Tue, Nov 22, 2022 at 4:13 AM Jason Wang wrote: On Mon, Nov 21, 2022 at 6:11 PM Stefano Garzarella wrote: > > Commit 69e1c14aa2 ("virtio: core: vq reset feature negotation support") > enabled VIR

Re: [PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-11-23 Thread Stefano Garzarella
On Thu, Nov 24, 2022 at 01:50:19AM -0500, Michael S. Tsirkin wrote: On Thu, Nov 24, 2022 at 12:19:25AM +, Raphael Norwitz wrote: > On Nov 23, 2022, at 8:16 AM, Stefano Garzarella wrote: > > Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features") &g

Re: [PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-11-25 Thread Stefano Garzarella
On Thu, Nov 24, 2022 at 01:36:29PM -0500, Stefan Hajnoczi wrote: On Wed, Nov 23, 2022 at 02:16:30PM +0100, Stefano Garzarella wrote: Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features") properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user backe

Re: [PATCH v3 1/7] include/hw: attempt to document VirtIO feature variables

2022-11-29 Thread Stefano Garzarella
Bennée Cc: Stefano Garzarella Cc: "Michael S. Tsirkin" Cc: Stefan Hajnoczi --- v2 - dropped DISCUSS and commentary - separated protocol section for clarity - updated working on vhost->backend_features - made clear guest_features was the written state --- include/hw/virtio/

Re: [PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-12-01 Thread Stefano Garzarella
On Wed, Nov 30, 2022 at 04:03:28PM -0500, Stefan Hajnoczi wrote: On Fri, Nov 25, 2022 at 09:12:43AM +0100, Stefano Garzarella wrote: On Thu, Nov 24, 2022 at 01:36:29PM -0500, Stefan Hajnoczi wrote: > On Wed, Nov 23, 2022 at 02:16:30PM +0100, Stefano Garzarella wrote: > > Commit 02b61f

Re: [PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-12-05 Thread Stefano Garzarella
On Thu, Dec 01, 2022 at 04:49:37PM -0500, Michael S. Tsirkin wrote: On Thu, Dec 01, 2022 at 12:21:21PM +, Alex Bennée wrote: "Michael S. Tsirkin" writes: > On Thu, Dec 01, 2022 at 10:14:39AM +, Alex Bennée wrote: >> Do you think rust-vmm's vhost crates have enough of the state >> mana

Re: [RFC patch 0/1] block: vhost-blk backend

2022-07-27 Thread Stefano Garzarella
with vDPA perhaps we can have one software stack to maintain for both HW and software accelerators. Thanks, Stefano [1] https://kvmforum2021.sched.com/event/ke3a/vdpa-blk-unified-hardware-and-software-offload-for-virtio-blk-stefano-garzarella-red-hat [2] https://gitlab.com/libblkio/libblkio [3

Re: [RFC patch 0/1] block: vhost-blk backend

2022-07-28 Thread Stefano Garzarella
On Thu, Jul 28, 2022 at 7:28 AM Andrey Zhadchenko wrote: > On 7/27/22 16:06, Stefano Garzarella wrote: > > On Tue, Jul 26, 2022 at 04:15:48PM +0200, Denis V. Lunev wrote: > >> On 26.07.2022 15:51, Michael S. Tsirkin wrote: > >>> On Mon, Jul 25, 2022 at 11:55:26PM

Re: [PATCH] virtio-scsi: fix race in virtio_scsi_dataplane_start()

2022-08-04 Thread Stefano Garzarella
-dataplane.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) Reviewed-by: Stefano Garzarella

[PATCH 0/2] block/blkio: fix opening virtio-blk drivers

2023-07-24 Thread Stefano Garzarella
There is a problem with virtio-blk-vhost-vdpa. The first patch fixes the issue, the second patch tries to prepare QEMU for a future version of libblkio where we can use blkio_set_fd() to check whether the property is supported or not. Stefano Garzarella (2): block/blkio: fix opening virtio-blk

[PATCH 1/2] block/blkio: fix opening virtio-blk drivers

2023-07-24 Thread Stefano Garzarella
_open() to support fd passing for virtio-blk") Reported-by: Qing Wang Signed-off-by: Stefano Garzarella --- block/blkio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blkio.c b/block/blkio.c index 1798648134..ca1149042a 100644 --- a/block/blkio.c +++ b/blo

[PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support

2023-07-24 Thread Stefano Garzarella
The way the virtio-blk driver is implemented in libblkio, it's much easier to use blkio_set_int() instead of blkio_get_int() and have it fail right away to see if `fd` is supported by the transport. See https://gitlab.com/libblkio/libblkio/-/merge_requests/208 Signed-off-by: Stefano Garza

[PATCH] block/blkio: enable the completion eventfd

2023-07-25 Thread Stefano Garzarella
, bool enable); I discovered this while trying a development version of libblkio: the guest kernel hangs during boot, while probing the device. Fixes: fd66dbd424f5 ("blkio: add libblkio block driver") Signed-off-by: Stefano Garzarella --- block/blkio.c | 1 + 1 file changed, 1 insertio

[PATCH] block/blkio: do not use open flags in qemu_open()

2023-07-25 Thread Stefano Garzarella
Qing Wang Signed-off-by: Stefano Garzarella --- block/blkio.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/block/blkio.c b/block/blkio.c index 1798648134..fe9bf8ea5f 100644 --- a/block/blkio.c +++ b/block/blkio.c @@ -686,15 +686,7 @@ static int blkio_virtio_blk_c

Re: [PATCH] block/blkio: do not use open flags in qemu_open()

2023-07-25 Thread Stefano Garzarella
On Tue, Jul 25, 2023 at 12:15:40PM +0100, Daniel P. Berrangé wrote: On Tue, Jul 25, 2023 at 01:11:55PM +0200, Stefano Garzarella wrote: qemu_open() in blkio_virtio_blk_common_open() is used to open the character device (e.g. /dev/vhost-vdpa-0 or /dev/vfio/vfio) or in the future eventually the

Re: [PATCH 1/2] block/blkio: fix opening virtio-blk drivers

2023-07-26 Thread Stefano Garzarella
On Tue, Jul 25, 2023 at 04:00:38PM -0400, Stefan Hajnoczi wrote: On Mon, Jul 24, 2023 at 05:46:10PM +0200, Stefano Garzarella wrote: libblkio 1.3.0 added support of "fd" property for virtio-blk-vhost-vdpa driver. In QEMU, starting from commit cad2ccc395 ("block/blkio: use qemu_op

Re: [PATCH 2/2] block/blkio: use blkio_set_int("fd") to check fd support

2023-07-26 Thread Stefano Garzarella
On Tue, Jul 25, 2023 at 04:05:38PM -0400, Stefan Hajnoczi wrote: On Mon, Jul 24, 2023 at 05:46:11PM +0200, Stefano Garzarella wrote: The way the virtio-blk driver is implemented in libblkio, it's much easier to use blkio_set_int() instead of blkio_get_int() and have it fail right away to s

[PATCH v2] block/blkio: do not use open flags in qemu_open()

2023-07-26 Thread Stefano Garzarella
ink: https://bugzilla.redhat.com/show_bug.cgi?id=2225439 Reported-by: Qing Wang Signed-off-by: Stefano Garzarella --- Notes: v2: - added comment on top of qemu_open() [Daniel] v1: https://lore.kernel.org/qemu-devel/2023072555.85426-1-sgarz...@redhat.com/ block/bl

Re: [PATCH 1/2] block/blkio: fix opening virtio-blk drivers

2023-07-26 Thread Stefano Garzarella
On Wed, Jul 26, 2023 at 11:32:10AM -0400, Stefan Hajnoczi wrote: On Wed, Jul 26, 2023 at 09:26:45AM +0200, Stefano Garzarella wrote: On Tue, Jul 25, 2023 at 04:00:38PM -0400, Stefan Hajnoczi wrote: > On Mon, Jul 24, 2023 at 05:46:10PM +0200, Stefano Garzarella wrote: > > libblkio 1.

[PATCH v2 1/4] block/blkio: move blkio_connect() in the drivers functions

2023-07-27 Thread Stefano Garzarella
This is in preparation for the next patch, where for virtio-blk drivers we need to handle the failure of blkio_connect(). Let's also rename the *_open() functions to *_connect() to make the code reflect the changes applied. Signed-off-by: Stefano Garzarella --- block/blkio.c

[PATCH v2 2/4] block/blkio: retry blkio_connect() if it fails using `fd`

2023-07-27 Thread Stefano Garzarella
block/blkio: use qemu_open() to support fd passing for virtio-blk") Suggested-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella --- Notes: v2: - reworked retrying blkio_connect() [Stefan] block/blkio.c | 29 + 1 file changed, 29 insertions(+) diff

[PATCH v2 3/4] block/blkio: fall back on using `path` when `fd` setting fails

2023-07-27 Thread Stefano Garzarella
ssing, let`s always fall back on using `path` if we fail the fd passing. Fixes: cad2ccc395 ("block/blkio: use qemu_open() to support fd passing for virtio-blk") Reported-by: Qing Wang Signed-off-by: Stefano Garzarella --- block/blkio.c | 20 ++-- 1 file changed,

[PATCH v2 4/4] block/blkio: use blkio_set_int("fd") to check fd support

2023-07-27 Thread Stefano Garzarella
rt fd passing. This patch switches to setting the `fd` property because it is a better mechanism for probing fd passing support than getting the `fd` property. Signed-off-by: Stefano Garzarella --- Notes: v2: - changed commit description [Stefan] block/blkio.c | 2 +- 1 file changed, 1 inse

[PATCH v2 0/4] block/blkio: fix opening virtio-blk drivers

2023-07-27 Thread Stefano Garzarella
UDS - changed patch 4 commit description [Stefan] v1: https://lore.kernel.org/qemu-devel/20230724154611.178858-1-sgarz...@redhat.com/ Based on stefanha/block branch. Stefano Garzarella (4): block/blkio: move blkio_connect() in the drivers functions block/blkio: retry blkio_connect() if it

[PATCH 2/2] block/blkio: add more comments on the fd passing handling

2023-08-01 Thread Stefano Garzarella
As Hanna pointed out, it is not clear in the code why qemu_open() can fail, and why blkio_set_int("fd") is not enough to discover the `fd` property support. Let's fix them by adding more details in the code comments. Suggested-by: Hanna Czenczek Signed-off-by: Stefano Garzare

[PATCH 1/2] block/blkio: close the fd when blkio_connect() fails

2023-08-01 Thread Stefano Garzarella
libblkio drivers take ownership of `fd` only after a successful blkio_connect(), so if it fails, we are still the owners. Fixes: cad2ccc395 ("block/blkio: use qemu_open() to support fd passing for virtio-blk") Suggested-by: Hanna Czenczek Signed-off-by: Stefano Garzarella --- blo

[PATCH 0/2] block/blkio: fix fd leak and add more comments for the fd passing

2023-08-01 Thread Stefano Garzarella
Hanna discovered an fd leak in the error path, and a few comments to improve in the code. Stefano Garzarella (2): block/blkio: close the fd when blkio_connect() fails block/blkio: add more comments on the fd passing handling block/blkio.c | 24 +--- 1 file changed, 21

Re: [PATCH 1/2] block/blkio: close the fd when blkio_connect() fails

2023-08-02 Thread Stefano Garzarella
On Wed, Aug 02, 2023 at 01:15:40PM +0200, Hanna Czenczek wrote: On 01.08.23 18:03, Stefano Garzarella wrote: libblkio drivers take ownership of `fd` only after a successful blkio_connect(), so if it fails, we are still the owners. Fixes: cad2ccc395 ("block/blkio: use qemu_open() to suppo

[PATCH v2 1/2] block/blkio: close the fd when blkio_connect() fails

2023-08-03 Thread Stefano Garzarella
libblkio drivers take ownership of `fd` only after a successful blkio_connect(), so if it fails, we are still the owners. Fixes: cad2ccc395 ("block/blkio: use qemu_open() to support fd passing for virtio-blk") Suggested-by: Hanna Czenczek Signed-off-by: Stefano Garzarella --- Not

[PATCH v2 2/2] block/blkio: add more comments on the fd passing handling

2023-08-03 Thread Stefano Garzarella
Signed-off-by: Stefano Garzarella --- block/blkio.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/block/blkio.c b/block/blkio.c index baba2f0b67..1dd495617c 100644 --- a/block/blkio.c +++ b/block/blkio.c @@ -713,6 +713,12 @@ static int blkio_virtio_blk_connect(B

[PATCH v2 0/2] block/blkio: fix fd leak and add more comments for the fd passing

2023-08-03 Thread Stefano Garzarella
Hanna discovered an fd leak in the error path, and a few comments to improve in the code. v2: - avoid to use `fd_supported` to track a valid fd [Hanna] v1: https://lore.kernel.org/qemu-devel/20230801160332.122564-1-sgarz...@redhat.com/ Stefano Garzarella (2): block/blkio: close the fd when

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Stefano Garzarella
Hi Michael, On Thu, Aug 3, 2023 at 10:02 PM Michael S. Tsirkin wrote: > > On Wed, Jul 05, 2023 at 09:15:23AM +0200, Stefano Garzarella wrote: > > This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. > > > > That commit causes several problems in Linux as des

[PATCH 2/9] libvhost-user: fail vu_message_write() if sendmsg() is failing

2024-02-28 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 1/9] libvhost-user: set msg.msg_control to NULL when it is empty

2024-02-28 Thread Stefano Garzarella
From: 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

[PATCH 0/9] vhost-user: support any POSIX system (tested on macOS and FreeBSD)

2024-02-28 Thread Stefano Garzarella
-device vhost-user-blk-pci,num-queues=1,chardev=char0 \ -chardev socket,id=char0,path=/tmp/vhost.socket Thanks, Stefano Stefano Garzarella (9): 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 5/9] contrib/vhost-user-blk: fix bind() using the right size of the address

2024-02-28 Thread Stefano Garzarella
From: 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

[PATCH 3/9] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported

2024-02-28 Thread Stefano Garzarella
end 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

[PATCH 4/9] vhost-user-server: don't abort if we can't set fd non-blocking

2024-02-28 Thread Stefano Garzarella
From: 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.) if we fail, it's not really a problem, because we don't use these fd with blocking operations, but only to map memory. In the

[PATCH 8/9] contrib/vhost-user-blk: enabled it on any POSIX system

2024-02-28 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 Garzarel

[PATCH 6/9] vhost-user: enable frontends on any POSIX system

2024-02-28 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 --- If we

[PATCH 9/9] hostmem-file: support POSIX shm_open()

2024-02-28 Thread Stefano Garzarella
(e.g. /dev/shm) available as in macOS. Signed-off-by: Stefano Garzarella --- 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 ava

[PATCH 7/9] libvhost-user: enable it on any POSIX system

2024-02-28 Thread Stefano Garzarella
es from include/qemu/memfd.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) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h

Re: [PATCH 0/9] vhost-user: support any POSIX system (tested on macOS and FreeBSD)

2024-02-28 Thread Stefano Garzarella
I just noticed that I forgot to add RFC tag and fix Author to match SOB in some patches, sorry! Stefano On Wed, Feb 28, 2024 at 12:48 PM Stefano Garzarella wrote: > > The vhost-user protocol is not really Linux-specific, so let's try support > QEMU's frontends and backends

Re: Intention to work on GSoC project

2024-02-29 Thread Stefano Garzarella
Hi Sahil, On Sun, Feb 25, 2024 at 10:38 PM Sahil wrote: > > Hi, > > My name is Sahil and I go by the pseudonym 'valdaarhun' on Github. I have > never contributed to QEMU before but I have used it a few times as an end > user. I developed an interest in virtualization during my internship at > VMw

Re: [PATCH 9/9] hostmem-file: support POSIX shm_open()

2024-02-29 Thread Stefano Garzarella
On Wed, Feb 28, 2024 at 01:01:55PM +0100, David Hildenbrand wrote: On 28.02.24 12:47, 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

Re: [PATCH 9/9] hostmem-file: support POSIX shm_open()

2024-02-29 Thread Stefano Garzarella
On Wed, Feb 28, 2024 at 12:08:37PM +, Daniel P. Berrangé wrote: 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

Re: [PATCH 9/9] hostmem-file: support POSIX shm_open()

2024-02-29 Thread Stefano Garzarella
On Wed, Feb 28, 2024 at 01:32:17PM +0100, Markus Armbruster wrote: Stefano Garzarella writes: 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

[PATCH] qapi: Fix format of the memory-backend-file's @rom property doc comment

2024-02-29 Thread Stefano Garzarella
Reflow paragraph following commit a937b6aa73 ("qapi: Reformat doc comments to conform to current conventions"): use 4 spaces indentation, 70 columns width, and two spaces to separate sentences. Suggested-by: Markus Armbruster Signed-off-by: Stefano Garzarella --- qapi/qom

Re: [PATCH 9/9] hostmem-file: support POSIX shm_open()

2024-02-29 Thread Stefano Garzarella
On Thu, Feb 29, 2024 at 11:28:37AM +0100, Markus Armbruster wrote: Stefano Garzarella writes: On Wed, Feb 28, 2024 at 01:32:17PM +0100, Markus Armbruster wrote: Stefano Garzarella writes: [...] +# @shm: if true, shm_open(3) is used to create/open POSIX shared memory +# object; if

Re: [PATCH] blkio: Respect memory-alignment for bounce buffer allocations

2024-01-31 Thread Stefano Garzarella
ed to 4k would fail without this fix. Suggested-by: Stefano Garzarella Signed-off-by: Kevin Wolf --- block/blkio.c | 3 +++ 1 file changed, 3 insertions(+) Thanks for fixinig this! Reviewed-by: Stefano Garzarella diff --git a/block/blkio.c b/block/blkio.c index 0a0a6c0f5f..b989617608 1006

Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-05 Thread Stefano Garzarella
On Fri, Feb 02, 2024 at 02:25:21PM +0100, Kevin Wolf wrote: VDUSE requires that virtqueues are first enabled before the DRIVER_OK status flag is set; with the current API of the kernel module, it is impossible to enable the opposite order in our block export code because userspace is not notified

Re: Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-06 Thread Stefano Garzarella
On Tue, Feb 06, 2024 at 10:47:40AM +0800, Jason Wang wrote: On Mon, Feb 5, 2024 at 6:51 PM Stefano Garzarella wrote: On Fri, Feb 02, 2024 at 02:25:21PM +0100, Kevin Wolf wrote: >VDUSE requires that virtqueues are first enabled before the DRIVER_OK >status flag is set; with the current

Re: Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-06 Thread Stefano Garzarella
On Tue, Feb 6, 2024 at 9:31 AM Stefano Garzarella wrote: > > On Tue, Feb 06, 2024 at 10:47:40AM +0800, Jason Wang wrote: > >On Mon, Feb 5, 2024 at 6:51 PM Stefano Garzarella > >wrote: > >> > >> On Fri, Feb 02, 2024 at 02:25:21PM +0100, Kevin Wolf wrote: >

Re: Re: Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-07 Thread Stefano Garzarella
On Wed, Feb 07, 2024 at 11:17:34AM +0800, Jason Wang wrote: On Tue, Feb 6, 2024 at 4:31 PM Stefano Garzarella wrote: On Tue, Feb 06, 2024 at 10:47:40AM +0800, Jason Wang wrote: >On Mon, Feb 5, 2024 at 6:51 PM Stefano Garzarella wrote: >> >> On Fri, Feb 02, 2024 at 02:25:21

Re: Re: Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-07 Thread Stefano Garzarella
On Wed, Feb 07, 2024 at 04:05:29PM +0800, Cindy Lu wrote: Jason Wang 于2024年2月7日周三 11:17写道: On Tue, Feb 6, 2024 at 4:31 PM Stefano Garzarella wrote: > > On Tue, Feb 06, 2024 at 10:47:40AM +0800, Jason Wang wrote: > >On Mon, Feb 5, 2024 at 6:51 PM Stefano Garzarella wrote: >

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

2024-02-07 Thread Stefano Garzarella
https://lore.kernel.org/virtualization/20240206145154.118044-1-sgarz...@redhat.com/T/#u Signed-off-by: Stefano Garzarella --- Note: This patch conflicts with [2], but the resolution is simple, so for now I sent a patch for the current master, but I'll rebase this patch if we merge the other one

Re: Re: [PATCH] vdpa-dev: Fix initialisation order to restore VDUSE compatibility

2024-02-07 Thread Stefano Garzarella
On Wed, Feb 07, 2024 at 11:18:54AM +0100, Kevin Wolf wrote: Am 06.02.2024 um 17:44 hat Eugenio Perez Martin geschrieben: On Mon, Feb 5, 2024 at 2:49 PM Kevin Wolf wrote: > > Am 05.02.2024 um 13:22 hat Eugenio Perez Martin geschrieben: > > On Fri, Feb 2, 2024 at 2:25 PM Kevin Wolf wrote: > > >

Re: [PATCH v1 00/15] libvhost-user: support more memslots and cleanup memslot handling code

2024-02-07 Thread Stefano Garzarella
y and as expected in my tests. I don't know much about this code, but I didn't find anything wrong with it. Thank you also for the great cleanup! Acked-by: Stefano Garzarella

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

2024-03-22 Thread Stefano Garzarella
https://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.co

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

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

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

2024-03-26 Thread Stefano Garzarella
es from include/qemu/memfd.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) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h

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

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

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

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

2024-03-26 Thread Stefano Garzarella
mp/vhost.socket 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 li

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

2024-03-26 Thread Stefano Garzarella
end 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

[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
, so let's 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 change

[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

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

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

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 rea

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: 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. D

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

[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

[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 07/11] libvhost-user: enable it on any POSIX system

2024-04-04 Thread Stefano Garzarella
es from include/qemu/memfd.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) Signed-off-by: Stefano Garzarella --- meson.build | 2 +- subprojects/libvhost-user/libvhost-user.h

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

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

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

2024-04-04 Thread Stefano Garzarella
nch 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: mask

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

2024-04-04 Thread Stefano Garzarella
l (e.g. 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

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

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

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

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

2024-04-04 Thread Stefano Garzarella
end 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

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 oth

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 with

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

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. A

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

2024-03-13 Thread Stefano Garzarella
Gentle ping :-) On Wed, Feb 7, 2024 at 10:27 AM Stefano Garzarella wrote: > > vhost_vdpa_set_vring_ready() could already fail, but if Linux's > patch [1] will be merged, it may fail with more chance if > userspace does not activate virtqueues befo

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

2024-03-15 Thread Stefano Garzarella
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() could already fail, but if Linux's patch [1] will be merged, it may fail with more chance if userspace does not activate virtqueues b

  1   2   3   4   5   6   7   8   9   10   >