[PATCH 2/3] aio-posix: add aio_add_sqe() API for user-defined io_uring requests

2025-04-01 Thread Stefan Hajnoczi
Introduce the aio_add_sqe() API for submitting io_uring requests in the current AioContext. This allows other components in QEMU, like the block layer, to take advantage of io_uring features without creating their own io_uring context. This API supports nested event loops just like file descriptor

Re: [PATCH qemu 1/1] Add IOURING_SETUP_SINGLE_ISSUER flag to improve iouring performance

2025-04-01 Thread Stefan Hajnoczi
On Thu, Mar 27, 2025 at 02:14:25PM +0100, Kevin Wolf wrote: > Am 26.03.2025 um 18:46 hat Stefan Hajnoczi geschrieben: > > On Wed, Mar 26, 2025 at 06:13:44PM +0100, Kevin Wolf wrote: > > > Am 25.03.2025 um 21:49 hat ~h0lyalg0rithm geschrieben: > > > > From: Suraj Shirvankar > > > > > > > > Signed-

[PATCH 1/3] aio-posix: treat io_uring setup failure as fatal

2025-04-01 Thread Stefan Hajnoczi
In the early days of io_uring it was possible for io_uring_setup(2) to fail due to exhausting RLIMIT_MEMLOCK. QEMU's solution was to fall back to epoll(7) or ppoll(2) when io_uring could not be used in an AioContext. Nowadays io_uring memory is accounted differently so io_uring_setup(2) won't fail

Re: [PATCH 11/15] fuse: Manually process requests (without libfuse)

2025-04-01 Thread Eric Blake
On Tue, Mar 25, 2025 at 05:06:51PM +0100, Hanna Czenczek wrote: > Manually read requests from the /dev/fuse FD and process them, without > using libfuse. This allows us to safely add parallel request processing > in coroutines later, without having to worry about libfuse internals. > (Technically,

[PATCH 0/3] [RESEND] block: unify block and fdmon io_uring

2025-04-01 Thread Stefan Hajnoczi
For some reason the patch series didn't reach the mailing list. Resending. Every AioContext has an io_uring context for file descriptor monitoring. In addition, block/io_uring.c also has an io_uring context for disk I/O. This patch series eliminates the extra io_uring context so that AioContext ha

[PATCH v4 3/3] vhost-user: return failure if backend crash when live migration

2025-04-01 Thread Haoqian He
Live migration should be terminated if the vhost-user backend crashes before the migration completes. Specifically, since the vhost device will be stopped when VM is stopped before the end of the live migration, in current implementation if the backend crashes, vhost-user device set_status() won't

[PATCH v4 2/3] vhost: return failure if stop virtqueue failed in vhost_dev_stop

2025-04-01 Thread Haoqian He
This patch captures the error of vhost_virtqueue_stop() in vhost_dev_stop() and returns the error upward. Specifically, if QEMU is disconnected from the vhost backend, some actions in vhost_dev_stop() will fail, such as sending vhost-user messages to the backend (GET_VRING_BASE, SET_VRING_ENABLE)

[PATCH v4 1/3] system/runstate: add VM state change cb with return value

2025-04-01 Thread Haoqian He
This patch adds the new VM state change cb type `VMChangeStateHandlerWithRet`, which has return value for `VMChangeStateEntry`. Thus, we can register a new VM state change cb with return value for device. Note that `VMChangeStateHandler` and `VMChangeStateHandlerWithRet` are mutually exclusive and

Re: [PATCH v3 2/2] qapi/throttle: add timeout parameter for qmp_block_set_io_throttle()

2025-04-01 Thread zoudongjie via
I'm sorry for the delay in replying. On Thu, 27 Mar 2025 14:43:54 +0100, Markus wrote: > zoudongjie writes: > > On Thu, 27 Mar 2025 09:04:51 +0100, Markus wrote: > >> zoudongjie writes: > >> > >> > On Wed, Mar 26, 2025 at 10:53:20 +0100, Markus wrote: > >> >> zoudongjie via writes: > >> >> >

Re: [PATCH 08/15] fuse: Introduce fuse_{at,de}tach_handlers()

2025-04-01 Thread Eric Blake
On Tue, Mar 25, 2025 at 05:06:48PM +0100, Hanna Czenczek wrote: > Pull setting up and tearing down the AIO context handlers into two > dedicated functions. > > Signed-off-by: Hanna Czenczek > --- > block/export/fuse.c | 32 > 1 file changed, 16 insertions(+), 16

[PATCH v4 1/3] io/block: Refactoring the bdrv_drained_begin() function and implement a timeout mechanism.

2025-04-01 Thread zoudongjie via
From: Zhu Yangyang The bdrv_drained_begin() function is a blocking function. In scenarios where network storage is used and network links fail, it may block for a long time. Therefore, we add a timeout parameter to control the duration of the block. Since bdrv_drained_begin() has been widely ad

[PATCH v4 3/3] qapi/resize: add timeout parameter for qmp_block_resize()

2025-04-01 Thread zoudongjie via
From: Zhu Yangyang Calling qmp_block_resize() will be blocked for a long time on bdrv_drained_begin() when a network disk is configured and the network failure is just about to occur. Therefore, we add a timeout parameter for qmp_block_resize() to control its execution duration. The default va

Re: [PATCH v2 2/3] include: Add a header to define PCI MMIO functions

2025-04-01 Thread Farhan Ali
On 3/31/2025 6:46 AM, Stefan Hajnoczi wrote: On Fri, Mar 28, 2025 at 12:06:26PM -0700, Farhan Ali wrote: Add a generic QEMU API for PCI MMIO reads/writes. The functions access little endian memory and returns the result in host cpu endianness. Signed-off-by: Farhan Ali --- include/qemu/pci

[PATCH v4 2/3] qapi/throttle: add timeout parameter for qmp_block_set_io_throttle()

2025-04-01 Thread zoudongjie via
From: Zhu Yangyang Calling qmp_block_set_io_throttle() will be blocked for a long time when a network disk is configured and the network failure is just about to occur. Therefore, we add a timeout parameter for qmp_block_set_io_throttle to control its execution duration. The default value of ti

Re: [PATCH v2] Revert "iotests: Stop NBD server in test 162 before starting the next one"

2025-04-01 Thread Eric Blake
On Wed, Mar 26, 2025 at 03:35:33PM +0100, Thomas Huth wrote: > From: Thomas Huth > > This reverts commit e2668ba1ed44ad56f2f1653ff5f53b277d534fac. > > This commit made test 162 fail occasionally with: > > 162 fail [13:06:40] [13:06:40] 0.2s (last: 0.2s) output mismatch > --- tests

Re: [PATCH v3 2/2] qapi/throttle: add timeout parameter for qmp_block_set_io_throttle()

2025-04-01 Thread zoudongjie via
On Thu, 27 Mar 2025 09:04:51 +0100, Markus wrote: > zoudongjie writes: > > > On Wed, Mar 26, 2025 at 10:53:20 +0100, Markus wrote: > >> zoudongjie via writes: > >> > >> > From: Zhu Yangyang > >> > > >> > Calling qmp_block_set_io_throttle() will be blocked for a long time > >> > when a network

Re: [PATCH 14/15] fuse: Implement multi-threading

2025-04-01 Thread Eric Blake
On Tue, Apr 01, 2025 at 02:05:40PM +0200, Kevin Wolf wrote: > > Maybe we could make setting @iothreads here and the generic > > BlockExportOptions.iothread at the same time an error.  That would save us > > the explanation here. > > This raises the question if the better interface wouldn't be to c

Re: [PATCH 14/15] fuse: Implement multi-threading

2025-04-01 Thread Eric Blake
On Thu, Mar 27, 2025 at 11:55:57AM -0400, Stefan Hajnoczi wrote: > On Tue, Mar 25, 2025 at 05:06:54PM +0100, Hanna Czenczek wrote: > > FUSE allows creating multiple request queues by "cloning" /dev/fuse FDs > > (via open("/dev/fuse") + ioctl(FUSE_DEV_IOC_CLONE)). > > > > We can use this to impleme

[PATCH] [for-10.1] qapi/block-core: derpecate some block-job- APIs

2025-04-01 Thread Vladimir Sementsov-Ogievskiy
For change, pause, resume, complete, dismiss and finalize actions corresponding job- and block-job commands are almost equal. The difference is in find_block_job_locked() vs find_job_locked() functions. What's different? 1. find_block_job_locked() do check, is found job a block-job. This OK whe

Re: [PATCH] [for-10.1] qapi/block-core: derpecate some block-job- APIs

2025-04-01 Thread Peter Krempa
On Tue, Apr 01, 2025 at 18:57:30 +0300, Vladimir Sementsov-Ogievskiy wrote: > For change, pause, resume, complete, dismiss and finalize actions > corresponding job- and block-job commands are almost equal. The > difference is in find_block_job_locked() vs find_job_locked() > functions. What's diffe

[PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x

2025-04-01 Thread Farhan Ali
Hi, Recently on s390x we have enabled mmap support for vfio-pci devices [1]. This allows us to take advantage and use userspace drivers on s390x. However, on s390x we have special instructions for MMIO access. Starting with z15 (and newer platforms) we have new PCI Memory I/O (MIO) instructions w

[PATCH v3 2/3] include: Add a header to define host PCI MMIO functions

2025-04-01 Thread Farhan Ali
Add a generic API for host PCI MMIO reads/writes (e.g. Linux VFIO BAR accesses). The functions access little endian memory and returns the result in host cpu endianness. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Farhan Ali --- include/qemu/host-pci-mmio.h | 116

[PATCH v3 3/3] block/nvme: Use host PCI MMIO API

2025-04-01 Thread Farhan Ali
Use the host PCI MMIO functions to read/write to NVMe registers, rather than directly accessing them. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Signed-off-by: Farhan Ali --- block/nvme.c | 37 + 1 file changed, 21 insertions(+), 16 del

[PATCH v3 1/3] util: Add functions for s390x mmio read/write

2025-04-01 Thread Farhan Ali
Starting with z15 (or newer) we can execute mmio instructions from userspace. On older platforms where we don't have these instructions available we can fallback to using system calls to access the PCI mapped resources. This patch adds helper functions for mmio reads and writes for s390x. Reviewe

Re: [PATCH 14/15] fuse: Implement multi-threading

2025-04-01 Thread Eric Blake
On Tue, Mar 25, 2025 at 05:06:54PM +0100, Hanna Czenczek wrote: > FUSE allows creating multiple request queues by "cloning" /dev/fuse FDs > (via open("/dev/fuse") + ioctl(FUSE_DEV_IOC_CLONE)). > > We can use this to implement multi-threading. > > Note that the interface presented here differs fro

Re: [PATCH 14/15] fuse: Implement multi-threading

2025-04-01 Thread Kevin Wolf
Am 27.03.2025 um 14:45 hat Hanna Czenczek geschrieben: > On 27.03.25 13:18, Markus Armbruster wrote: > > Hanna Czenczek writes: > > > > > On 26.03.25 12:41, Markus Armbruster wrote: > > > > Hanna Czenczek writes: > > > > > > > > > On 26.03.25 06:38, Markus Armbruster wrote: > > > > > > Hanna Cz

Re: [PATCH 15/15] fuse: Increase MAX_WRITE_SIZE with a second buffer

2025-04-01 Thread Eric Blake
On Tue, Mar 25, 2025 at 05:06:55PM +0100, Hanna Czenczek wrote: > We probably want to support larger write sizes than just 4k; 64k seems > nice. However, we cannot read partial requests from the FUSE FD, we > always have to read requests in full; so our read buffer must be large > enough to accomm