Re: [RFC v4 4/9] file-posix: introduce get_sysfs_str_val for device zoned model.

2022-07-12 Thread Damien Le Moal
On 7/12/22 15:17, Hannes Reinecke wrote: > On 7/12/22 04:13, Sam Li wrote: >> Signed-off-by: Sam Li >> --- >> block/file-posix.c | 60 >> include/block/block-common.h | 4 +-- >> 2 files changed, 62 insertions(+), 2 deletions(-) >> >> diff --git

Re: [PATCH] iotests: fix copy-before-write for macOS and FreeBSD

2022-07-12 Thread Richard Henderson
On 7/5/22 21:07, Vladimir Sementsov-Ogievskiy wrote: strerror() represents ETIMEDOUT a bit different in Linux and macOS / FreeBSD. Let's support the latter too. Fixes: 9d05a87b77 ("iotests: copy-before-write: add cases for cbw-timeout option") Signed-off-by: Vladimir Sementsov-Ogievskiy --- A

Re: [PATCH] iotests/copy-before-write: specify required_fmts

2022-07-12 Thread Richard Henderson
On 7/6/22 22:38, Vladimir Sementsov-Ogievskiy wrote: Declare that we need copy-before-write filter to avoid failure when filter is not whitelisted. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/copy-before-write | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(

Re: [RFC v4 2/9] qemu-io: add zoned block device operations.

2022-07-12 Thread Damien Le Moal
On 7/12/22 11:13, Sam Li wrote: > Add zoned storage commands of the device: zone_open(zo), zone_close(zc), > zone_reset(zs), zone_report(zp), zone_finish(zf). > > For example, it can be called by: > ./build/qemu-io --image-opts driver=zoned_host_device, filename=/dev/nullb0 > -c "zone_report 0 0 1

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Damien Le Moal
On 7/12/22 11:13, Sam Li wrote: > By adding zone management operations in BlockDriver, storage > controller emulation can use the new block layer APIs including > zone_report and zone_mgmt(open, close, finish, reset). > > Signed-off-by: Sam Li > --- > block/block-backend.c| 41 +

Re: [RFC v4 3/9] file-posix: introduce get_sysfs_long_val for a block queue of sysfs attribute

2022-07-12 Thread Damien Le Moal
On 7/12/22 11:13, Sam Li wrote: > Use sysfs attribute files to get the zoned device information in case > that ioctl() commands of zone management interface won't work. > > Signed-off-by: Sam Li > --- > block/file-posix.c | 38 +++--- > 1 file changed, 27 insertio

Re: [RFC v4 4/9] file-posix: introduce get_sysfs_str_val for device zoned model.

2022-07-12 Thread Damien Le Moal
On 7/12/22 11:13, Sam Li wrote: > Signed-off-by: Sam Li > --- > block/file-posix.c | 60 > include/block/block-common.h | 4 +-- > 2 files changed, 62 insertions(+), 2 deletions(-) > > diff --git a/block/file-posix.c b/block/file-posix.c > index 31

Re: [RFC v4 9/9] qapi: add support for zoned host device

2022-07-12 Thread Damien Le Moal
On 7/12/22 11:13, Sam Li wrote: > --- > block/file-posix.c | 8 +++- > qapi/block-core.json | 7 +-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/block/file-posix.c b/block/file-posix.c > index e9ad1d8e1e..4e0aa02acf 100644 > --- a/block/file-posix.c > +++ b/bloc

Re: [PULL 06/18] vfio-user: build library

2022-07-12 Thread Daniel P . Berrangé
On Wed, Jun 15, 2022 at 04:51:17PM +0100, Stefan Hajnoczi wrote: > From: Jagannathan Raman > > add the libvfio-user library as a submodule. build it as a meson > subproject. > > libvfio-user is distributed with BSD 3-Clause license and > json-c with MIT (Expat) license > > Signed-off-by: Elena

Re: [PATCH 6/9] error-report: add a callback to overwrite error_vprintf

2022-07-12 Thread Marc-André Lureau
Hi On Thu, Jul 7, 2022 at 10:05 PM Marc-André Lureau < marcandre.lur...@gmail.com> wrote: > Hi > > On Thu, Jul 7, 2022 at 4:18 PM Markus Armbruster > wrote: > >> marcandre.lur...@redhat.com writes: >> >> > From: Marc-André Lureau >> > >> > error_vprintf() is implemented in monitor.c, which over

[PATCH v2 01/15] error-report: misc comment fix

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Missed in commit beeb175c0d "util/qemu-error: Rename error_print_loc() to be more generic". Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- util/error-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/error-report.c b

[PATCH v2 03/15] error-report: simplify print_loc()

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Pass the program name as "prefix" argument to print_loc() if printing with "details". This allows to get rid of monitor_cur() call in print_loc(). Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- util/error-report.c | 8 1 file changed, 4 in

[PATCH v2 02/15] error-report: introduce "detailed" variable

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Let's use a more explicit variable "detailed" instead of calling monitor_cur() multiple times. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- util/error-report.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/error-re

[PATCH v2 00/15] Preliminary patches for subproject split

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Hi, Here is another subset of the large "subproject(qga)"" series I intend to send soon after (https://gitlab.com/marcandre.lureau/qemu/-/commits/qga). Thanks v2: - drop error_init() callbacks, use static library symbol override instead - include a few patches from th

[PATCH v2 07/15] scripts/qapi-gen: add -i option

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Replace hard-coded "qemu/osdep.h" include with a qapi-gen option to specify the headers to include. This will allow to substitute QEMU osdep.h with glib.h for example, for projects with different global headers. For historical reasons, we can keep the default as "qemu/osd

[PATCH v2 12/15] qemu-common: move glib-compat.h

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau qemu-common will have compatible dependency requirements with QEMU. Since qemu-common won't have a toplevel qemu/osdep.h which would include various system headers, include stdbool.h (bool is used for some declarations here). Replace getenv() with g_getenv() to avoid ext

[PATCH v2 04/15] error-report: introduce overridable error_is_detailed()

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Remove the direct dependency from error-report to monitor code. This will allow to move error-report to a subproject. Signed-off-by: Marc-André Lureau --- include/qemu/error-report.h | 2 ++ softmmu/vl.c| 5 + stubs/error-is-detailed.c | 7 +++

[PATCH v2 05/15] stubs: remove needless error_vprintf_unless_qmp()

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- stubs/error-printf.c | 5 - 1 file changed, 5 deletions(-) diff --git a/stubs/error-printf.c b/stubs/error-printf.c index 0e326d801059..1afa0f62ca26 100644 --- a/stubs/error-printf.c +++ b/stubs/error-printf.c @@ -16,8 +16,3 @@ i

[PATCH v2 06/15] qapi: move QEMU-specific dispatch code in monitor

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Make QMP-dispatch code free from QEMU-specific OOB dispatch/async coroutine handling. This will allow to move the base code to qemu-common, and clear other users from potential mis-ususe (QGA doesn't have OOB or coroutine). To do that, introduce an optional callback QmpDi

[PATCH v2 08/15] scripts/qapi: add required system includes to visitor

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau The generated visitor code includes abort() & assert(), we shouldn't rely on the global "-i" headers to include the necessary system headers. Signed-off-by: Marc-André Lureau --- scripts/qapi/visit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/vi

[PATCH v2 09/15] util: move 256-by-128 division helpers to int128

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Break a cyclic dependency between int128 and host-utils. Signed-off-by: Marc-André Lureau --- include/qemu/host-utils.h | 3 - include/qemu/int128.h | 3 + util/host-utils.c | 180 -- util/int128.c | 180 ++

[PATCH v2 10/15] qemu-common: introduce a common subproject

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Add a new meson subproject to provide common code and scripts for QEMU and tools. Initially, it will offer QAPI/QMP code generation and common utilities. libvhost-user & libvduse will make use of the subproject to avoid having include/ links to common headers. The other

[PATCH v2 11/15] qemu-common: move scripts/qapi

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau This is just moving qapi-gen.py and related subdir to qemu-common, to ease review and proceed step by step. The following patches will move related necessary code, tests etc. Signed-off-by: Marc-André Lureau --- docs/conf.py | 2 +- mes

[PATCH v2 13/15] qemu-common: move error-report

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Signed-off-by: Marc-André Lureau --- .../qemu-common/include}/qemu/error-report.h | 2 ++ .../qemu-common/src}/error-is-detailed.c | 1 - .../qemu-common/src}/error-report.c | 4 +++- .../qemu-common/src/error-vprintf.c | 5 ++--- stubs/meso

[PATCH v2 14/15] mtest2make.py: teach suite name that are just "PROJECT"

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau A subproject test may be simply in the "PROJECT" suite (such as "qemu-common" with the following patches) Signed-off-by: Marc-André Lureau --- scripts/mtest2make.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/mtest2make.py b/script

[PATCH v2 15/15] qemu-common: add error-report test

2022-07-12 Thread marcandre . lureau
From: Marc-André Lureau Add new tests to check the behaviour of error reporting functions. Signed-off-by: Marc-André Lureau --- .../qemu-common/tests/test-error-report.c | 120 ++ subprojects/qemu-common/meson.build | 2 + subprojects/qemu-common/tests/meson.bui

Re: [PATCH 0/3] qemu/qsd: Unlink absolute PID file path

2022-07-12 Thread Hanna Reitz
Ping On 09.06.22 14:26, Hanna Reitz wrote: Hi, QEMU (the system emulator) and the storage daemon (QSD) write their PID to the given file when you specify --pidfile. They keep the path around and register exit handlers (QEMU uses an exit notifier, QSD an atexit() function) to unlink this file w

Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator

2022-07-12 Thread Stefan Hajnoczi
On Thu, Jul 07, 2022 at 01:36:21PM +, Darren Kenny wrote: > Using the Parfait source code analyser and issue was found in > hw/nvme/ctrl.c where the macros NVME_CAP_SET_CMBS and NVME_CAP_SET_PMRS > are called with a ternary operatore in the second parameter, resulting > in a potentially unexpec

Re: [PATCH 2/3] vl: Conditionally register PID file unlink notifier

2022-07-12 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 02:27:00PM +0200, Hanna Reitz wrote: > Currently, the exit notifier for unlinking the PID file is registered > unconditionally. Limit it to only when we actually do create a PID > file. > > Signed-off-by: Hanna Reitz > --- > softmmu/vl.c | 18 +- > 1 file

Re: [PATCH 1/3] qsd: Unlink absolute PID file path

2022-07-12 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 02:26:59PM +0200, Hanna Reitz wrote: > After writing the PID file, we register an atexit() handler to unlink it > when the process terminates. However, if the process has changed its > working directory in the meantime (e.g. in os_setup_post() when > daemonizing), this will

Re: [PATCH 3/8] virtio_blk_process_queued_requests: always run in a bh

2022-07-12 Thread Stefan Hajnoczi
On Fri, Jul 08, 2022 at 11:07:06AM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 05/07/2022 um 16:23 schrieb Stefan Hajnoczi: > > On Thu, Jun 09, 2022 at 10:37:22AM -0400, Emanuele Giuseppe Esposito wrote: > >> diff --git a/hw/block/dataplane/virtio-blk.c > >> b/hw/block/dataplane/virtio-blk

Re: [QEMU 1/1] nvme: Fix misleading macro when mixed with ternary operator

2022-07-12 Thread Klaus Jensen
On Jul 12 13:11, Stefan Hajnoczi wrote: > On Thu, Jul 07, 2022 at 01:36:21PM +, Darren Kenny wrote: > > Using the Parfait source code analyser and issue was found in > > hw/nvme/ctrl.c where the macros NVME_CAP_SET_CMBS and NVME_CAP_SET_PMRS > > are called with a ternary operatore in the second

Re: [PATCH 3/3] vl: Unlink absolute PID file path

2022-07-12 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 02:27:01PM +0200, Hanna Reitz wrote: > After writing the PID file, we register an exit notifier to unlink it > when the process terminates. However, if the process has changed its > working directory in the meantime (e.g. in os_setup_post() when > daemonizing), this will no

Re: [PATCH 6/8] virtio-blk: mark IO_CODE functions

2022-07-12 Thread Stefan Hajnoczi
On Fri, Jul 08, 2022 at 11:19:43AM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 05/07/2022 um 16:39 schrieb Stefan Hajnoczi: > > On Thu, Jun 09, 2022 at 10:37:25AM -0400, Emanuele Giuseppe Esposito wrote: > >> Just as done in the block API, mark functions in virtio-blk > >> that are called a

Re: [PATCH 7/8] VirtIOBlock: protect rq with its own lock

2022-07-12 Thread Stefan Hajnoczi
On Fri, Jul 08, 2022 at 11:33:28AM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 05/07/2022 um 16:45 schrieb Stefan Hajnoczi: > > On Thu, Jun 09, 2022 at 10:37:26AM -0400, Emanuele Giuseppe Esposito wrote: > >> @@ -946,17 +955,20 @@ static void virtio_blk_reset(VirtIODevice *vdev) > >>

Re: [PATCH 7/8] VirtIOBlock: protect rq with its own lock

2022-07-12 Thread Stefan Hajnoczi
On Fri, Jul 08, 2022 at 01:22:58PM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 08/07/2022 um 11:33 schrieb Emanuele Giuseppe Esposito: > > > > > > Am 05/07/2022 um 16:45 schrieb Stefan Hajnoczi: > >> On Thu, Jun 09, 2022 at 10:37:26AM -0400, Emanuele Giuseppe Esposito wrote: > >>> @@ -946

Re: [PATCH 0/3] qemu/qsd: Unlink absolute PID file path

2022-07-12 Thread Hanna Reitz
On 09.06.22 14:26, Hanna Reitz wrote: Hi, QEMU (the system emulator) and the storage daemon (QSD) write their PID to the given file when you specify --pidfile. They keep the path around and register exit handlers (QEMU uses an exit notifier, QSD an atexit() function) to unlink this file when th

Re: [PATCH 1/8] virtio_queue_aio_attach_host_notifier: remove AioContext lock

2022-07-12 Thread Stefan Hajnoczi
On Fri, Jul 08, 2022 at 11:01:37AM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 05/07/2022 um 16:11 schrieb Stefan Hajnoczi: > > On Thu, Jun 09, 2022 at 10:37:20AM -0400, Emanuele Giuseppe Esposito wrote: > >> @@ -146,7 +147,6 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) > >> > >

Re: [RFC v3 1/8] blkio: add io_uring block driver using libblkio

2022-07-12 Thread Stefano Garzarella
On Fri, Jul 08, 2022 at 05:17:30AM +0100, Stefan Hajnoczi wrote: libblkio (https://gitlab.com/libblkio/libblkio/) is a library for high-performance disk I/O. It currently supports io_uring and virtio-blk-vhost-vdpa with additional drivers under development. One of the reasons for developing libb

Re: [RFC v3 7/8] blkio: implement BDRV_REQ_REGISTERED_BUF optimization

2022-07-12 Thread Stefano Garzarella
On Fri, Jul 08, 2022 at 05:17:36AM +0100, Stefan Hajnoczi wrote: Avoid bounce buffers when QEMUIOVector elements are within previously registered bdrv_register_buf() buffers. The idea is that emulated storage controllers will register guest RAM using bdrv_register_buf() and set the BDRV_REQ_REGI

Re: [PATCH v3 00/14] scsi: add quirks and features to support m68k Macs

2022-07-12 Thread Paolo Bonzini
Queued, thanks (I was on vacation last week). I am a bit scared about the mode_select_truncated quirk. My reading of the code is that the MODE SELECT would fail anyway because the page length does not match in scsi_disk_check_mode_select: len = mode_sense_page(s, page, &p, 0); if (len <

Re: [PATCH v2 10/15] qemu-common: introduce a common subproject

2022-07-12 Thread Warner Losh
On Tue, Jul 12, 2022 at 3:36 AM wrote: > From: Marc-André Lureau > > Add a new meson subproject to provide common code and scripts for QEMU > and tools. Initially, it will offer QAPI/QMP code generation and > common utilities. > > libvhost-user & libvduse will make use of the subproject to avoid

Re: [PATCH v2 12/15] qemu-common: move glib-compat.h

2022-07-12 Thread Warner Losh
On Tue, Jul 12, 2022 at 3:37 AM wrote: > From: Marc-André Lureau > > qemu-common will have compatible dependency requirements with QEMU. > > Since qemu-common won't have a toplevel qemu/osdep.h which would include > various system headers, include stdbool.h (bool is used for some > declarations

Re: [PATCH v2 04/15] error-report: introduce overridable error_is_detailed()

2022-07-12 Thread Warner Losh
On Tue, Jul 12, 2022 at 3:36 AM wrote: > From: Marc-André Lureau > > Remove the direct dependency from error-report to monitor code. > This will allow to move error-report to a subproject. > > Signed-off-by: Marc-André Lureau > --- > include/qemu/error-report.h | 2 ++ > softmmu/vl.c

Re: [PATCH v2 08/15] scripts/qapi: add required system includes to visitor

2022-07-12 Thread Warner Losh
On Tue, Jul 12, 2022 at 3:36 AM wrote: > From: Marc-André Lureau > > The generated visitor code includes abort() & assert(), we shouldn't > rely on the global "-i" headers to include the necessary system headers. > > Signed-off-by: Marc-André Lureau > --- > scripts/qapi/visit.py | 2 ++ > 1 fi

Re: [PULL 06/18] vfio-user: build library

2022-07-12 Thread Jag Raman
On Jul 12, 2022, at 4:39 AM, Daniel P. Berrangé mailto:berra...@redhat.com>> wrote: On Wed, Jun 15, 2022 at 04:51:17PM +0100, Stefan Hajnoczi wrote: From: Jagannathan Raman mailto:jag.ra...@oracle.com>> add the libvfio-user library as a submodule. build it as a meson subproject. libvfio-user

Re: [PULL 06/18] vfio-user: build library

2022-07-12 Thread Daniel P . Berrangé
On Tue, Jul 12, 2022 at 03:27:09PM +, Jag Raman wrote: > > > On Jul 12, 2022, at 4:39 AM, Daniel P. Berrangé > mailto:berra...@redhat.com>> wrote: > > On Wed, Jun 15, 2022 at 04:51:17PM +0100, Stefan Hajnoczi wrote: > From: Jagannathan Raman mailto:jag.ra...@oracle.com>> > > add the libvfi

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Stefan Hajnoczi
On Tue, Jul 12, 2022 at 10:13:37AM +0800, Sam Li wrote: > By adding zone management operations in BlockDriver, storage > controller emulation can use the new block layer APIs including > zone_report and zone_mgmt(open, close, finish, reset). > > Signed-off-by: Sam Li > --- > block/block-backend.

Re: [PULL 06/18] vfio-user: build library

2022-07-12 Thread Jag Raman
> On Jul 12, 2022, at 11:44 AM, Daniel P. Berrangé wrote: > > On Tue, Jul 12, 2022 at 03:27:09PM +, Jag Raman wrote: >> >> >> On Jul 12, 2022, at 4:39 AM, Daniel P. Berrangé >> mailto:berra...@redhat.com>> wrote: >> >> On Wed, Jun 15, 2022 at 04:51:17PM +0100, Stefan Hajnoczi wrote: >>

[PULL 00/35] Block patches

2022-07-12 Thread Hanna Reitz
The following changes since commit 9548cbed4253e38570d29b8cff0bf77c998f: iotests/copy-before-write: specify required_fmts (2022-07-12 13:21:02 +0530) are available in the Git repository at: https://gitlab.com/hreitz/qemu.git tags/pull-block-2022-07-12 for you to fetch changes up to 85c4

[PULL 01/35] block: Add a 'flags' param to bdrv_{pread, pwrite, pwrite_sync}()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria For consistency with other I/O functions, and in preparation to implement them using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes; @@ - bdrv_pread(child, offset, buf, bytes) + bdrv_pread(child, o

[PULL 04/35] crypto: Make block callbacks return 0 on success

2022-07-12 Thread Hanna Reitz
From: Alberto Faria They currently return the value of their headerlen/buflen parameter on success. Returning 0 instead makes it clear that short reads/writes are not possible. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.389184

[PULL 02/35] block: Change bdrv_{pread, pwrite, pwrite_sync}() param order

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Swap 'buf' and 'bytes' around for consistency with bdrv_co_{pread,pwrite}(), and in preparation to implement these functions using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes, flags; @@ - bdrv_pread

[PULL 05/35] block: Make bdrv_co_pwrite() take a const buffer

2022-07-12 Thread Hanna Reitz
From: Alberto Faria It does not mutate the buffer. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.3891847-6-afa...@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz --- include/block/block_int-io.h | 2 +- 1 fi

[PULL 07/35] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper

2022-07-12 Thread Hanna Reitz
From: Alberto Faria bdrv_{pread,pwrite}() now return -EIO instead of -EINVAL when 'bytes' is negative, making them consistent with bdrv_{preadv,pwritev}() and bdrv_co_{pread,pwrite,preadv,pwritev}(). bdrv_pwrite_zeroes() now also calls trace_bdrv_co_pwrite_zeroes() and clears the BDRV_REQ_MAY_UN

[PULL 10/35] block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Use bdrv_pwrite_sync() instead of calling bdrv_pwrite() and bdrv_flush() separately. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.3891847-11-afa...@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna R

[PULL 09/35] block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Convert uses of bdrv_pwrite_sync() into bdrv_co_pwrite_sync() when the callers are already coroutine_fn. Signed-off-by: Alberto Faria Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.3891847-10-afa...@redhat.com> Reviewed-b

[PULL 13/35] block: Make blk_{pread,pwrite}() return 0 on success

2022-07-12 Thread Hanna Reitz
From: Alberto Faria They currently return the value of their 'bytes' parameter on success. Make them return 0 instead, for consistency with other I/O functions and in preparation to implement them using generated_co_wrapper. This also makes it clear that short reads/writes are not possible. Sig

[PULL 11/35] tests/qemu-iotests: hotfix for 307, 223 output

2022-07-12 Thread Hanna Reitz
From: John Snow Fixes: 58a6fdcc Signed-off-by: John Snow Tested-by: Daniel P. Berrangé Reviewed-by: Daniel P. Berrangé Message-Id: <20220616142659.3184115-2-js...@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz --- tests/qemu-iotests/223.out | 4 ++-- tests/qemu-iotests/307.

[PULL 08/35] block: Add bdrv_co_pwrite_sync()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Also convert bdrv_pwrite_sync() to being implemented using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.3891847-9-afa...@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz

[PULL 12/35] tests/qemu-iotests: skip 108 when FUSE is not loaded

2022-07-12 Thread Hanna Reitz
From: John Snow In certain container environments we may not have FUSE at all, so skip the test in this circumstance too. Signed-off-by: John Snow Message-Id: <20220616142659.3184115-3-js...@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz --- tests/q

[PULL 25/35] block: Implement blk_pdiscard() using generated_co_wrapper

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-14-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 3 --- include/sysemu/block-backend-io.h | 3 ++- block/block-ba

[PULL 03/35] block: Make bdrv_{pread,pwrite}() return 0 on success

2022-07-12 Thread Hanna Reitz
From: Alberto Faria They currently return the value of their 'bytes' parameter on success. Make them return 0 instead, for consistency with other I/O functions and in preparation to implement them using generated_co_wrapper. This also makes it clear that short reads/writes are not possible. The

[PULL 06/35] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t

2022-07-12 Thread Hanna Reitz
From: Alberto Faria For consistency with other I/O functions, and in preparation to implement bdrv_{pread,pwrite}() using generated_co_wrapper. unsigned int fits in int64_t, so all callers remain correct. bdrv_check_request32() is called further down the stack and causes -EIO to be returned if

[PULL 14/35] block: Add a 'flags' param to blk_pread()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria For consistency with other I/O functions, and in preparation to implement it using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression blk, offset, buf, bytes; @@ - blk_pread(blk, offset, buf, bytes) + blk_pread(blk, offset, buf

[PULL 17/35] block: Make blk_co_pwrite() take a const buffer

2022-07-12 Thread Hanna Reitz
From: Alberto Faria It does not mutate the buffer. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-6-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-io.h | 2 +- 1 file changed, 1 insertion(+

[PULL 16/35] block: Make 'bytes' param of blk_{pread, pwrite}() an int64_t

2022-07-12 Thread Hanna Reitz
From: Alberto Faria For consistency with other I/O functions, and in preparation to implement them using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-5-afa...@redhat.com> Signed-off-by: Hanna Reitz

[PULL 19/35] block: Add blk_{preadv,pwritev}()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Implement them using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-8-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-io.h | 6 + tests/unit/te

[PULL 20/35] block: Add blk_[co_]preadv_part()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Implement blk_preadv_part() using generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-9-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 5 -

[PULL 21/35] block: Export blk_pwritev_part() in block-backend-io.h

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Also convert it into a generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-10-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 5 - include/sy

[PULL 15/35] block: Change blk_{pread,pwrite}() param order

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Swap 'buf' and 'bytes' around for consistency with blk_co_{pread,pwrite}(), and in preparation to implement these functions using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression blk, offset, buf, bytes, flags; @@ - blk_pread(blk

[PULL 29/35] block: Reorganize some declarations in block-backend-io.h

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Keep generated_co_wrapper and coroutine_fn pairs together. This should make it clear that each I/O function has these two versions. Also move blk_co_{pread,pwrite}()'s implementations out of the header file for consistency. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bo

[PULL 27/35] block: Add blk_co_ioctl()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Also convert blk_ioctl() into a generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-16-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 6 -- i

[PULL 22/35] block: Change blk_pwrite_compressed() param order

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Swap 'buf' and 'bytes' around for consistency with other I/O functions. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-11-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-

[PULL 30/35] block: Remove remaining unused symbols in coroutines.h

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Some can be made static, others are unused generated_co_wrappers. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-19-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 19

[PULL 23/35] block: Add blk_co_pwrite_compressed()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Also convert blk_pwrite_compressed() into a generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-12-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-io.h |

[PULL 31/35] qsd: Do not use error_report() before monitor_init

2022-07-12 Thread Hanna Reitz
error_report() only works once monitor_init_globals_core() has been called, which is not the case when parsing the --daemonize option. Use fprintf(stderr, ...) instead. Fixes: 2525edd85fec53e23fda98974a15e3b3c8957596 ("qsd: Add --daemonize") Signed-off-by: Hanna Reitz Message-Id: <20220609122852

[PULL 34/35] vl: Conditionally register PID file unlink notifier

2022-07-12 Thread Hanna Reitz
Currently, the exit notifier for unlinking the PID file is registered unconditionally. Limit it to only when we actually do create a PID file. Signed-off-by: Hanna Reitz Message-Id: <20220609122701.17172-3-hre...@redhat.com> Reviewed-by: Daniel P. Berrangé --- softmmu/vl.c | 18 +--

[PULL 35/35] vl: Unlink absolute PID file path

2022-07-12 Thread Hanna Reitz
After writing the PID file, we register an exit notifier to unlink it when the process terminates. However, if the process has changed its working directory in the meantime (e.g. in os_setup_post() when daemonizing), this will not work when the PID file path was relative. Therefore, pass the absol

[PULL 18/35] block: Implement blk_{pread, pwrite}() using generated_co_wrapper

2022-07-12 Thread Hanna Reitz
From: Alberto Faria We need to add include/sysemu/block-backend-io.h to the inputs of the block-gen.c target defined in block/meson.build. Signed-off-by: Alberto Faria Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-7-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/corou

[PULL 24/35] block: Implement blk_pwrite_zeroes() using generated_co_wrapper

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-13-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-io.h | 5 +++-- block/block-backend.c | 8 tests/u

[PULL 32/35] iotests/297: Have mypy ignore unused ignores

2022-07-12 Thread Hanna Reitz
e7874a50ff3f5b20fb46f36958ad ("python: update for mypy 0.950") has added `warn_unused_ignores = False` to python/setup.cfg, to be able to keep compatibility with both pre- and post-0.950 mypy versions. The iotests' mypy.ini needs the same, or 297 will fail (on both pre- and post-0.950 mypy, as far

[PULL 26/35] block: Implement blk_flush() using generated_co_wrapper

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-15-afa...@redhat.com> Signed-off-by: Hanna Reitz --- block/coroutines.h| 2 -- include/sysemu/block-backend-io.h | 2 +- block/block-back

Re: [PATCH v4 00/12] Improve reliability of VM tests

2022-07-12 Thread John Snow
On Fri, Jul 8, 2022 at 11:35 AM John Snow wrote: > > Note: patches 10-12 are included for testing simplicity, they shouldn't > be merged. They will be included in a forthcoming block PR. Patches 1-9 are fully reviewed. Whose tree should this go in? > > V4: > > - Addressed concern by Marc-Andre i

[PULL 28/35] block: Add blk_co_truncate()

2022-07-12 Thread Hanna Reitz
From: Alberto Faria Also convert blk_truncate() into a generated_co_wrapper. Signed-off-by: Alberto Faria Reviewed-by: Paolo Bonzini Reviewed-by: Hanna Reitz Message-Id: <20220705161527.1054072-17-afa...@redhat.com> Signed-off-by: Hanna Reitz --- include/sysemu/block-backend-io.h | 8 +

[PULL 33/35] qsd: Unlink absolute PID file path

2022-07-12 Thread Hanna Reitz
After writing the PID file, we register an atexit() handler to unlink it when the process terminates. However, if the process has changed its working directory in the meantime (e.g. in os_setup_post() when daemonizing), this will not work when the PID file path was relative. Therefore, pass the ab

Re: Error ret=-1 with EINTR in nbd_connect_systemd_socket_activation()

2022-07-12 Thread Philippe Mathieu-Daudé via
Cc'ing qemu-block@ On 11/7/22 08:38, Motohiro Kawahito wrote: Hi, I’d like to connect to an encrypted QCOW2 file by nbd_connect_systemd_socket_activation(), but I got ret=-1 with EINTR. The arg parameter I used is qemu-nbd --object secret,id=sec0,data=abc123 --image-opts driver=qcow2,encrypt

[RFC PATCH 0/8] Refactor bdrv_try_set_aio_context using transactions

2022-07-12 Thread Emanuele Giuseppe Esposito
The aim of this series is to reorganize bdrv_try_set_aio_context and drop BDS ->set_aio_context and ->can_set_aio_ctx callbacks in favour of a new one, ->change_aio_ctx. More informations in patch 3 (which is also RFC, due to the doubts I have with AioContext locks). Patch 1 just add assertions i

[RFC PATCH 1/8] block.c: assert bs->aio_context is written under BQL and drains

2022-07-12 Thread Emanuele Giuseppe Esposito
Also here ->aio_context is read by I/O threads and written under BQL. Signed-off-by: Emanuele Giuseppe Esposito --- block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block.c b/block.c index d0db104d71..267a39c0de 100644 --- a/block.c +++ b/block.c @@ -7285,6 +7285,7 @@ static void bd

[RFC PATCH 5/8] block: implement .change_aio_ctx in child_of_bds

2022-07-12 Thread Emanuele Giuseppe Esposito
bdrv_child_cb_change_aio_ctx() is identical to bdrv_child_cb_can_set_aio_ctx(), as we only need to recursively go on the parent bs. Note: bdrv_child_try_change_aio_context() is not called by anyone at this point. Signed-off-by: Emanuele Giuseppe Esposito --- block.c | 9 + 1 file change

[RFC PATCH 2/8] transactions: add tran_add_back

2022-07-12 Thread Emanuele Giuseppe Esposito
First change the transactions from a QLIST to QSIMPLEQ, then use it to implement tran_add_tail, which allows adding elements to the end of list transactions. This is useful if we have some "preparation" transiction callbacks that we want to run before the others but still only when invoking finali

[RFC PATCH 7/8] block: use the new _change_ API instead of _can_set_ and _set_

2022-07-12 Thread Emanuele Giuseppe Esposito
Replace all direct usage of ->can_set_aio_ctx and ->set_aio_ctx, and call bdrv_child_try_change_aio_context() in bdrv_try_set_aio_context(), the main function called through the whole block layer. >From this point onwards, ->can_set_aio_ctx and ->set_aio_ctx won't be used anymore. Signed-off-by:

[RFC PATCH 8/8] block: remove all unused ->can_set_aio_ctx and ->set_aio_ctx callbacks

2022-07-12 Thread Emanuele Giuseppe Esposito
Together with all _can_set_ and _set_ APIs, as they are not needed anymore. Signed-off-by: Emanuele Giuseppe Esposito --- block.c| 196 - block/block-backend.c | 33 - blockjob.c | 35 -- inclu

[RFC PATCH 3/8] RFC: block: use transactions as a replacement of ->{can_}set_aio_context()

2022-07-12 Thread Emanuele Giuseppe Esposito
- RFC because I am not sure about the AioContext locks. - Do we need to take the new AioContext lock? what does it protect? - Taking the old AioContext lock is required now, because of bdrv_drained_begin calling AIO_WAIT_WHILE that unlocks the aiocontext. If we replace it with AIO_WAIT_

[RFC PATCH 6/8] block-backend: implement .change_aio_ctx in child_root

2022-07-12 Thread Emanuele Giuseppe Esposito
blk_root_change_aio_ctx() is very similar to blk_root_can_set_aio_ctx(), but implements a new transaction so that if all check pass, the new transaction's .commit will take care of changing the BlockBackend AioContext. blk_root_set_aio_ctx_commit() is the same as blk_root_set_aio_ctx(). Note: bdrv

[RFC PATCH 4/8] blockjob: implement .change_aio_ctx in child_job

2022-07-12 Thread Emanuele Giuseppe Esposito
child_job_change_aio_ctx() is very similar to child_job_can_set_aio_ctx(), but it implements a new transaction so that if all check pass, the new transaction's .commit() will take care of changin the BlockJob AioContext. child_job_set_aio_ctx_commit() is similar to child_job_set_aio_ctx(), but it d

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Damien Le Moal
On 7/13/22 00:49, Stefan Hajnoczi wrote: > On Tue, Jul 12, 2022 at 10:13:37AM +0800, Sam Li wrote: >> By adding zone management operations in BlockDriver, storage >> controller emulation can use the new block layer APIs including >> zone_report and zone_mgmt(open, close, finish, reset). >> >> Signe

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Sam Li
Stefan Hajnoczi 于2022年7月12日周二 23:49写道: > > On Tue, Jul 12, 2022 at 10:13:37AM +0800, Sam Li wrote: > > By adding zone management operations in BlockDriver, storage > > controller emulation can use the new block layer APIs including > > zone_report and zone_mgmt(open, close, finish, reset). > > > >

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Sam Li
Damien Le Moal 于2022年7月12日周二 15:35写道: > > On 7/12/22 11:13, Sam Li wrote: > > By adding zone management operations in BlockDriver, storage > > controller emulation can use the new block layer APIs including > > zone_report and zone_mgmt(open, close, finish, reset). > > > > Signed-off-by: Sam Li >

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-12 Thread Stefan Hajnoczi
On Wed, Jul 13, 2022 at 08:51:45AM +0800, Sam Li wrote: > Stefan Hajnoczi 于2022年7月12日周二 23:49写道: > > > > On Tue, Jul 12, 2022 at 10:13:37AM +0800, Sam Li wrote: > > > diff --git a/block/file-posix.c b/block/file-posix.c > > > index 48cd096624..e7523ae2ed 100644 > > > --- a/block/file-posix.c > > >

  1   2   >