[PULL 10/27] iotests: Test media change with iothreads

2023-10-31 Thread Kevin Wolf
iotests case 118 already tests all relevant operations for media change with multiple devices, however never with iothreads. This changes the test so that the virtio-scsi tests run with an iothread. Signed-off-by: Kevin Wolf Message-ID: <20231013153302.39234-3-kw...@redhat.com> Revie

[PULL 14/27] block: rename blk_io_plug_call() API to defer_call()

2023-10-31 Thread Kevin Wolf
Maximets Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paul Durrant Signed-off-by: Stefan Hajnoczi Message-ID: <20230913200045.1024233-2-stefa...@redhat.com> Reviewed-by: Michael S. Tsirkin Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/sysemu/block-backend-io.h

[PULL 03/27] qemu-img: rebase: use backing files' BlockBackend for buffer alignment

2023-10-31 Thread Kevin Wolf
.439110-4-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-img.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 2b2a3a86ca..e61d996e0f 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3759,8 +3759,1

[PULL 04/27] qemu-img: add chunk size parameter to compare_buffers()

2023-10-31 Thread Kevin Wolf
img_rebase() to make the write requests aligned to a predefined alignment value. Signed-off-by: Andrey Drobyshev Reviewed-by: Eric Blake Reviewed-by: Hanna Czenczek Message-ID: <20230919165804.439110-5-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf ---

[PULL 27/27] iotests: add test for changing mirror's copy_mode

2023-10-31 Thread Kevin Wolf
: <20231031135431.393137-11-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- .../tests/mirror-change-copy-mode | 193 ++ .../tests/mirror-change-copy-mode.out | 5 + 2 files changed, 198 insertions(+) create mode 100755 tests/qemu-iotests/tests/

[PULL 22/27] mirror: implement mirror_change method

2023-10-31 Thread Kevin Wolf
led. In presence of an iothread, the copy_mode member is now shared between the iothread and the main thread, so turn accesses to it atomic. Signed-off-by: Fiona Ebner Message-ID: <20231031135431.393137-6-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf ---

[PULL 11/27] blockjob: drop AioContext lock before calling bdrv_graph_wrlock()

2023-10-31 Thread Kevin Wolf
e-ID: <20231019131936.414246-2-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- blockjob.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blockjob.c b/blockjob.c index 807f992b59..953dc1b6dc 100644 --- a/blockjob.c +++ b/blockjob.c @@ -198,7 +198,9 @@ void blo

[PULL 21/27] block/mirror: determine copy_to_target only once

2023-10-31 Thread Kevin Wolf
.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/mirror.c | 41 ++--- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 914d723446..31da1526eb 100644 --- a/block/mirror.c +++ b

[PULL 13/27] blockdev: mirror: avoid potential deadlock when using iothread

2023-10-31 Thread Kevin Wolf
specified as the @replaces parameter or if the source node is a filter node. Signed-off-by: Fiona Ebner Message-ID: <20231019131936.414246-4-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- blockdev.c | 14 -- 1 file changed, 12 insertions(+), 2 del

[PULL 09/27] block: Fix locking in media change monitor commands

2023-10-31 Thread Kevin Wolf
(), which is called for the QMP commands 'blockdev-insert-medium' and 'blockdev-change-medium', to correctly take the lock. Cc: qemu-sta...@nongnu.org Fixes: https://issues.redhat.com/browse/RHEL-3922 Fixes: c066e808e11a5c181b625537b6c78e0de27a4801 Signed-off-by: Ke

[PULL 16/27] virtio: use defer_call() in virtio_irqfd_notify()

2023-10-31 Thread Kevin Wolf
sirkin Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/io_uring.c | 6 ++ block/linux-aio.c | 4 hw/virtio/virtio.c | 13 - util/thread-pool.c | 5 + hw/virtio/trace-events | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff -

[PULL 05/27] qemu-img: rebase: avoid unnecessary COW operations

2023-10-31 Thread Kevin Wolf
als to the cluster size. so in any case we end up aligning to the smallest unit of allocation. Signed-off-by: Andrey Drobyshev Message-ID: <20230919165804.439110-6-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-img.c | 74 ++

[PULL 08/27] iotests: add tests for "qemu-img rebase" with compression

2023-10-31 Thread Kevin Wolf
compressed. Signed-off-by: Andrey Drobyshev Reviewed-by: Hanna Czenczek Message-ID: <20230919165804.439110-9-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/271 | 65 +++ tests/qemu-iotests/271.out | 40 +++

[PULL 20/27] block/mirror: move dirty bitmap to filter

2023-10-31 Thread Kevin Wolf
-Ogievskiy Signed-off-by: Fiona Ebner Message-ID: <20231031135431.393137-4-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/mirror.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/block/mirror.c b/block/mirror.c

[PULL 17/27] virtio-blk: remove batch notification BH

2023-10-31 Thread Kevin Wolf
negotiated by the driver. Modern drivers enable EVENT_IDX. Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi Message-ID: <20230913200045.1024233-5-stefa...@redhat.com> Reviewed-by: Michael S. Tsirkin Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- hw/block/dataplane/virtio-blk.

[PULL 06/27] iotests/{024, 271}: add testcases for qemu-img rebase

2023-10-31 Thread Kevin Wolf
804.439110-7-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/024 | 60 ++ tests/qemu-iotests/024.out | 43 + tests/qemu-iotests/271 | 66 ++ te

[PULL 18/27] blockjob: introduce block-job-change QMP command

2023-10-31 Thread Kevin Wolf
Message-ID: <20231031135431.393137-2-f.eb...@proxmox.com> Reviewed-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- qapi/block-core.json | 26 ++ qapi/job.json| 4 +++- include/block/blockjob.h | 11 +++ i

[PULL 15/27] util/defer-call: move defer_call() to util/

2023-10-31 Thread Kevin Wolf
y: Michael S. Tsirkin Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/qemu/defer-call.h | 16 include/sysemu/block-backend-io.h | 4 block/blkio.c | 1 + block/io_uring.c | 1 + block/linux-aio.c

[PULL 00/27] Block layer patches

2023-10-31 Thread Kevin Wolf
driver-specific info via a new 'query' driver method mirror: return mirror-specific information upon query iotests: add test for changing mirror's copy_mode Kevin Wolf (2): block: Fix locking in media change monitor commands iotests: Test media change wit

[PULL 01/27] qemu-img: rebase: stop when reaching EOF of old backing file

2023-10-31 Thread Kevin Wolf
o.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-img.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 585b65640f..2b2a3a86ca 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3814,6 +3814,8 @@ static int img_rebase(

Re: -drive if=none: can't we make this the default?

2023-10-31 Thread Kevin Wolf
Am 14.10.2023 um 21:59 hat BALATON Zoltan geschrieben: > On Sat, 14 Oct 2023, Michael Tokarev wrote: > > Can't we make -drive if=none the default? > > > > Yes, I know current default is ide, and whole world have to use if=none > > explicitly > > to undo this. I think at this point we can deprecat

Re: -drive if=none: can't we make this the default?

2023-10-31 Thread Kevin Wolf
Hi Michael, I didn't see this thread when you posted it, sorry for being a bit late. Am 16.10.2023 um 13:58 hat Michael Tokarev geschrieben: > Almost everyone mentions -blockdev as a replacement for -drive. More specifically for -drive if=none. I honestly don't know many common use cases for tha

Re: [PATCH v4 00/10] mirror: allow switching from background to active mode

2023-10-31 Thread Kevin Wolf
Am 31.10.2023 um 14:54 hat Fiona Ebner geschrieben: > Changes in v4: > * add an iotest for the new functionality > * set actively_synced to false when setting dirty bitmap in > bdrv_mirror_top_do_write > * add comments describing requirements for accessing copy_mode and > ac

Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro

2023-10-31 Thread Kevin Wolf
Am 31.10.2023 um 14:48 hat Richard W.M. Jones geschrieben: > On Tue, Oct 31, 2023 at 02:17:56PM +0100, Kevin Wolf wrote: > > Am 17.10.2023 um 16:01 hat Philippe Mathieu-Daudé geschrieben: > > > Access QOM parent with the proper QOM VIRTIO_SCSI_COMMON() macro. > > > &g

Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro

2023-10-31 Thread Kevin Wolf
Am 31.10.2023 um 14:48 hat Richard W.M. Jones geschrieben: > On Tue, Oct 31, 2023 at 02:17:56PM +0100, Kevin Wolf wrote: > > Am 17.10.2023 um 16:01 hat Philippe Mathieu-Daudé geschrieben: > > > Access QOM parent with the proper QOM VIRTIO_SCSI_COMMON() macro. > > > &g

Re: [PATCH v3 0/4] virtio-blk: use blk_io_plug_call() instead of notification BH

2023-10-31 Thread Kevin Wolf
Am 13.09.2023 um 22:00 hat Stefan Hajnoczi geschrieben: > v3: > - Add comment pointing to API documentation in .c file [Philippe] > - Add virtio_notify_irqfd_deferred_fn trace event [Ilya] > - Remove outdated #include [Ilya] > v2: > - Rename blk_io_plug() to defer_call() and move it to util/ so the

Re: [PATCH 4/7] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro

2023-10-31 Thread Kevin Wolf
Am 17.10.2023 um 16:01 hat Philippe Mathieu-Daudé geschrieben: > Access QOM parent with the proper QOM VIRTIO_SCSI_COMMON() macro. > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/scsi/virtio-scsi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/scsi/virtio-scsi

Re: [PATCH 1/2] block: Fix locking in media change monitor commands

2023-10-31 Thread Kevin Wolf
Am 31.10.2023 um 12:54 hat Hanna Czenczek geschrieben: > On 13.10.23 17:33, Kevin Wolf wrote: > > blk_insert_bs() requires that the caller holds the AioContext lock for > > the node to be inserted. Since commit c066e808e11, neglecting to do so > > causes a crash when the child

[PATCH 24/24] block: Protect bs->file with graph_lock

2023-10-27 Thread Kevin Wolf
Almost all functions that access bs->file already take the graph lock now. Add locking to the remaining users and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf --- block/parallels.h| 5 +++-- block/qe

[PATCH 16/24] block: Mark bdrv_replace_node() GRAPH_WRLOCK

2023-10-27 Thread Kevin Wolf
Instead of taking the writer lock internally, require callers to already hold it when calling bdrv_replace_node(). Its callers may already want to hold the graph lock and so wouldn't be able to call functions that take it internally. Signed-off-by: Kevin Wolf --- include/block/block-g

[PATCH 23/24] block: Take graph lock for most of .bdrv_open

2023-10-27 Thread Kevin Wolf
e. This changes block drivers that follow this pattern to take the graph lock after opening the child node. Signed-off-by: Kevin Wolf --- block/blkdebug.c | 16 ++-- block/bochs.c | 4 block/cloop.c | 4 block/copy-before-write.c | 2 ++ block

[PATCH 04/24] block: Mark bdrv_root_attach_child() GRAPH_WRLOCK

2023-10-27 Thread Kevin Wolf
ff-by: Kevin Wolf --- include/block/block_int-global-state.h | 13 +++-- block.c| 5 + block/block-backend.c | 2 ++ blockjob.c | 2 ++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/

[PATCH 12/24] block: Mark bdrv_cow_child() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_cow_child() need to hold a reader lock for the graph because it accesses bs->backing. Signed-off-by: Kevin Wolf --- include/block/block_int-io.h | 5 +++-- block/stream.c | 2 +- qemu-img.c |

[PATCH 10/24] block: Mark bdrv_chain_contains() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_chain_contains() need to hold a reader lock for the graph because it calls bdrv_filter_or_cow_bs(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 4 ++- bloc

[PATCH 14/24] block: Inline bdrv_set_backing_noperm()

2023-10-27 Thread Kevin Wolf
It's only a single line and has a single caller. Inlining makes things a bit easier to follow. Signed-off-by: Kevin Wolf --- block.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/block.c b/block.c index d79a6f41f9..dc43e36f69 100644 --- a/block.c

[PATCH 15/24] block: Mark bdrv_replace_node_common() GRAPH_WRLOCK

2023-10-27 Thread Kevin Wolf
nally. Signed-off-by: Kevin Wolf --- block.c | 68 - 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/block.c b/block.c index dc43e36f69..c7409cf658 100644 --- a/block.c +++ b/block.c @@ -5412,6 +5412,9 @@ bdrv_replace_node_n

[PATCH 11/24] block: Mark bdrv_filter_child() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_filter_child() need to hold a reader lock for the graph because it accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block_int-io.h | 4 ++-- block.c | 4 ++-- 2 files changed

[PATCH 05/24] block: Mark block_job_add_bdrv() GRAPH_WRLOCK

2023-10-27 Thread Kevin Wolf
Instead of taking the writer lock internally, require callers to already hold it when calling block_job_add_bdrv(). These callers will typically already hold the graph lock once the locking work is completed, which means that they can't call functions that take it internally. Signed-off-by:

[PATCH 13/24] block: Mark bdrv_set_backing_hd_drained() GRAPH_WRLOCK

2023-10-27 Thread Kevin Wolf
nally. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 7 --- block.c| 4 ++-- block/stream.c | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/block/block-global-state.h b/include/block/block-g

[PATCH 20/24] block: Add missing GRAPH_RDLOCK annotations

2023-10-27 Thread Kevin Wolf
river is trivially possible. Signed-off-by: Kevin Wolf --- block/qcow2.h| 11 ++- include/block/block_int-common.h | 17 + block/blkdebug.c | 13 + block/blkverify.c| 2 +- block/copy-before-write.c

[PATCH 18/24] blkverify: Add locking for request_fn

2023-10-27 Thread Kevin Wolf
s for the coroutines to terminate. Annotate with GRAPH_RDLOCK as well to make this clearer. Signed-off-by: Kevin Wolf --- block/blkverify.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/block/blkverify.c b/block/blkverify.c index dae9716a26..9ea2cb4cc5 100644

[PATCH 07/24] block: Mark bdrv_skip_implicit_filters() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_skip_implicit_filters() need to hold a reader lock for the graph because it calls bdrv_filter_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block_int-global-state.h | 3 ++- bloc

[PATCH 08/24] block: Mark bdrv_skip_filters() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_skip_filters() need to hold a reader lock for the graph because it calls bdrv_filter_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 8 --- include/bl

[PATCH 19/24] block: Introduce bdrv_co_change_backing_file()

2023-10-27 Thread Kevin Wolf
implementation and a co_wrapper instead. The new function is marked GRAPH_RDLOCK. As the co_wrapper now runs the function in the AioContext of the node (as it should always have done), this is not GLOBAL_STATE_CODE() any more. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 3

[PATCH 09/24] block: Mark bdrv_(un)freeze_backing_chain() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
no external callers. Signed-off-by: Kevin Wolf --- block/copy-on-read.h | 3 ++- include/block/block-global-state.h | 11 ++- block.c| 5 +++-- block/commit.c | 6 ++ block/copy-on-read.c |

[PATCH 06/24] block: Mark bdrv_filter_or_cow_bs() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_filter_or_cow_bs() need to hold a reader lock for the graph because it calls bdrv_filter_or_cow_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block_int-io.h | 3 ++- bloc

[PATCH 21/24] qcow2: Take locks for accessing bs->file

2023-10-27 Thread Kevin Wolf
This updates the qcow2 code to add GRAPH_RDLOCK annotations for all places that read bs->file. Signed-off-by: Kevin Wolf --- block/qcow2.h | 48 ++- block/qcow2-bitmap.c | 14 +++-- block/qcow2-cluster.c | 25 +++--- bl

[PATCH 03/24] block: Mark bdrv_filter_bs() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_filter_bs() need to hold a reader lock for the graph because it calls bdrv_filter_child(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block-io.h | 2 +- include/block/block_int-io.h

[PATCH 01/24] block: Mark bdrv_probe_blocksizes() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_probe_blocksizes() need to hold a reader lock for the graph because it calls bdrv_filter_bs(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 2 +- include/block/block_

[PATCH 22/24] vhdx: Take locks for accessing bs->file

2023-10-27 Thread Kevin Wolf
This updates the vhdx code to add GRAPH_RDLOCK annotations for all places that read bs->file. Signed-off-by: Kevin Wolf --- block/vhdx.h | 9 ++--- block/vhdx-log.c | 40 ++-- block/vhdx.c | 18 +++--- 3 files changed, 39 inserti

[PATCH 17/24] block: Protect bs->backing with graph_lock

2023-10-27 Thread Kevin Wolf
Almost all functions that access bs->backing already take the graph lock now. Add locking to the remaining users and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf --- include/block/block_int-common.h | 2 +- bloc

[PATCH 02/24] block: Mark bdrv_has_zero_init() and callers GRAPH_RDLOCK

2023-10-27 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_has_zero_init() need to hold a reader lock for the graph because it calls bdrv_filter_bs(), which accesses bs->file/backing. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 2 +- include/block/block_

[PATCH 00/24] block: Graph locking part 6 (bs->file/backing)

2023-10-27 Thread Kevin Wolf
This series is pleasantly boring for the most part and results in a GRAPH_RDLOCK_PTR annotation for bs->file and bs->backing. Kevin Wolf (24): block: Mark bdrv_probe_blocksizes() and callers GRAPH_RDLOCK block: Mark bdrv_has_zero_init() and callers GRAPH_RDLOCK block: Mark bdrv_fil

Re: [PATCH v3 28/28] docs: update Xen-on-KVM documentation

2023-10-26 Thread Kevin Wolf
Am 25.10.2023 um 20:56 hat Andrew Cooper geschrieben: > On 25/10/2023 7:26 pm, David Woodhouse wrote: > > On Wed, 2023-10-25 at 13:20 -0500, Eric Blake wrote: > >> On Wed, Oct 25, 2023 at 03:50:42PM +0100, David Woodhouse wrote: > >>> + > >>> +Booting Xen PV guests > >>> +- > >>

Re: [PATCH v3 0/9] mirror: allow switching from background to active mode

2023-10-25 Thread Kevin Wolf
Am 25.10.2023 um 14:27 hat Fiona Ebner geschrieben: > Am 23.10.23 um 13:39 schrieb Fiona Ebner: > > Am 19.10.23 um 15:36 schrieb Kevin Wolf: > >> Most of this series looks good to me. Apart from the comments I made in > >> the individual patches, I would like to see i

Re: [PATCH 0/3] fix a few blockjob-related deadlocks when using iothread

2023-10-25 Thread Kevin Wolf
Am 19.10.2023 um 15:19 hat Fiona Ebner geschrieben: > The discussion leading up to this series can be found here: > https://lists.nongnu.org/archive/html/qemu-devel/2023-09/msg00729.html > > Fiona Ebner (3): > blockjob: drop AioContext lock before calling bdrv_graph_wrlock() > block: avoid dea

Re: [PATCH v3 5/9] mirror: implement mirror_change method

2023-10-24 Thread Kevin Wolf
Am 23.10.2023 um 16:14 hat Fiona Ebner geschrieben: > Am 23.10.23 um 14:59 schrieb Kevin Wolf: > > Am 23.10.2023 um 13:37 hat Fiona Ebner geschrieben: > >>>> +current = qatomic_cmpxchg(&s->copy_mode, > >>>> MIRROR_COPY_MODE_BACKGROUND, >

Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices

2023-10-23 Thread Kevin Wolf
Am 23.10.2023 um 11:30 hat Igor Mammedov geschrieben: > On Wed, 18 Oct 2023 09:32:47 +0100 > David Woodhouse wrote: > > > On Wed, 2023-10-18 at 09:32 +0200, Igor Mammedov wrote: > > > On Mon, 16 Oct 2023 16:19:08 +0100 > > > David Woodhouse wrote: > > > > > > > From: David Woodhouse > > > >

Re: [PATCH v3 1/9] blockjob: introduce block-job-change QMP command

2023-10-23 Thread Kevin Wolf
Am 23.10.2023 um 11:31 hat Fiona Ebner geschrieben: > Am 18.10.23 um 17:52 schrieb Kevin Wolf: > > Am 13.10.2023 um 11:21 hat Fiona Ebner geschrieben: > >> which will allow changing job-type-specific options after job > >> creation. > >> > >> In the

Re: [PATCH v3 5/9] mirror: implement mirror_change method

2023-10-23 Thread Kevin Wolf
Am 23.10.2023 um 13:37 hat Fiona Ebner geschrieben: > Am 18.10.23 um 18:59 schrieb Kevin Wolf: > > Am 13.10.2023 um 11:21 hat Fiona Ebner geschrieben: > >> which allows switching the @copy-mode from 'background' to > >> 'write-blocking'. > >

Re: [PATCH v3 0/9] mirror: allow switching from background to active mode

2023-10-19 Thread Kevin Wolf
Am 13.10.2023 um 11:21 hat Fiona Ebner geschrieben: > Changes in v3: > * unlock the job mutex when calling the new block job driver > 'query' handler > * squash patch adapting iotest output into patch that changes the > output > * turn accesses to copy_mode and actively_sync

Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices

2023-10-19 Thread Kevin Wolf
Am 18.10.2023 um 12:52 hat David Woodhouse geschrieben: > > Actually, how does this play together with xen_config_dev_blk()? This > > looks like it tried to implement a very similar thing (which is IF_XEN > > even already existed). > > Ah yes, thanks for spotting that! I hadn't been looking at the

Re: deadlock when using iothread during backup_clean()

2023-10-19 Thread Kevin Wolf
Am 18.10.2023 um 11:42 hat Fiona Ebner geschrieben: > Am 17.10.23 um 16:20 schrieb Kevin Wolf: > > Am 17.10.2023 um 15:37 hat Fiona Ebner geschrieben: > >> Am 17.10.23 um 14:12 schrieb Kevin Wolf: > >>> Am 17.10.2023 um 12:18 hat Fiona Ebner geschrieben: > >&g

Re: [PATCH v3 5/9] mirror: implement mirror_change method

2023-10-18 Thread Kevin Wolf
Am 13.10.2023 um 11:21 hat Fiona Ebner geschrieben: > which allows switching the @copy-mode from 'background' to > 'write-blocking'. > > This is useful for management applications, so they can start out in > background mode to avoid limiting guest write speed and switch to > active mode when certa

Re: [PATCH v3 1/9] blockjob: introduce block-job-change QMP command

2023-10-18 Thread Kevin Wolf
Am 13.10.2023 um 11:21 hat Fiona Ebner geschrieben: > which will allow changing job-type-specific options after job > creation. > > In the JobVerbTable, the same allow bits as for set-speed are used, > because set-speed can be considered an existing change command. > > Signed-off-by: Fiona Ebner

Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices

2023-10-18 Thread Kevin Wolf
Am 16.10.2023 um 17:19 hat David Woodhouse geschrieben: > From: David Woodhouse > > There's no need to force the user to assign a vdev. We can automatically > assign one, starting at xvda and searching until we find the first disk > name that's unused. > > This means we can now allow '-drive if=

Re: [PATCH v3 0/8] qemu-img: rebase: add compression support

2023-10-17 Thread Kevin Wolf
Am 19.09.2023 um 18:57 hat Andrey Drobyshev geschrieben: > v2 --> v3: > * Patch 3/8: fixed logic in the if statement, so that we align on blk >when blk_old_backing == NULL; > * Patch 4/8: comment fix; > * Patch 5/8: comment fix; dropped redundant "if (blk_new_backing)" >statements. > >

Re: [PATCH v3 4/8] qemu-img: add chunk size parameter to compare_buffers()

2023-10-17 Thread Kevin Wolf
Am 19.09.2023 um 18:58 hat Andrey Drobyshev geschrieben: > Add @chsize param to the function which, if non-zero, would represent > the chunk size to be used for comparison. If it's zero, then > BDRV_SECTOR_SIZE is used as default chunk size, which is the previous > behaviour. > > In particular, w

Re: deadlock when using iothread during backup_clean()

2023-10-17 Thread Kevin Wolf
Am 17.10.2023 um 15:37 hat Fiona Ebner geschrieben: > Am 17.10.23 um 14:12 schrieb Kevin Wolf: > > Am 17.10.2023 um 12:18 hat Fiona Ebner geschrieben: > >> I ran into similar issues now with mirror, (both deadlocks and stuck > >> guest IO at other times), and interesti

Re: deadlock when using iothread during backup_clean()

2023-10-17 Thread Kevin Wolf
Am 17.10.2023 um 12:18 hat Fiona Ebner geschrieben: > Am 06.10.23 um 14:18 schrieb Fiona Ebner: > > Am 04.10.23 um 19:08 schrieb Vladimir Sementsov-Ogievskiy: > >> On 28.09.23 11:06, Fiona Ebner wrote: > >>> For fixing the backup cancel deadlock, I tried the following: > >>> > diff --git a/blo

Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices

2023-10-17 Thread Kevin Wolf
Find an unoccupied device name */ > +while (disk < (1 << 20)) { I like your optimism that we can handle a million disks. :-) I haven't reviewed the Xen part in detail, but the patch looks fine on the block layer side. Acked-by: Kevin Wolf

Re: [PULL 1/1] virtio-blk: don't start dataplane during the stop of dataplane

2023-10-17 Thread Kevin Wolf
Am 17.10.2023 um 11:01 hat Fiona Ebner geschrieben: > Am 16.10.23 um 21:40 schrieb Stefan Hajnoczi: > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > > index 39e7f23fab..c2d59389cb 100644 > > --- a/hw/block/virtio-blk.c > > +++ b/hw/block/virtio-blk.c > > @@ -1166,7 +1166,7 @@ static

Re: [PATCH 2/2] virtio: Drop out of coroutine context in virtio_load()

2023-10-17 Thread Kevin Wolf
Am 17.10.2023 um 07:19 hat Michael Tokarev geschrieben: > 05.09.2023 17:50, Kevin Wolf wrote: > > virtio_load() as a whole should run in coroutine context because it > > reads from the migration stream and we don't want this to block. > > > > However, it calls v

[PATCH 1/2] block: Fix locking in media change monitor commands

2023-10-13 Thread Kevin Wolf
(), which is called for the QMP commands 'blockdev-insert-medium' and 'blockdev-change-medium', to correctly take the lock. Cc: qemu-sta...@nongnu.org Fixes: https://issues.redhat.com/browse/RHEL-3922 Fixes: c066e808e11a5c181b625537b6c78e0de27a4801 Signed-off-by: Kevin Wolf --- blo

[PATCH 2/2] iotests: Test media change with iothreads

2023-10-13 Thread Kevin Wolf
iotests case 118 already tests all relevant operations for media change with multiple devices, however never with iothreads. This changes the test so that the virtio-scsi tests run with an iothread. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/118 | 6 -- 1 file changed, 4 insertions

[PATCH 0/2] block: Fix locking in media change monitor commands

2023-10-13 Thread Kevin Wolf
Kevin Wolf (2): block: Fix locking in media change monitor commands iotests: Test media change with iothreads block/qapi-sysemu.c| 5 + tests/qemu-iotests/118 | 6 -- 2 files changed, 9 insertions(+), 2 deletions(-) -- 2.41.0

[PULL 10/26] block: Mark bdrv_parent_cb_resize() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_parent_cb_resize() need to hold a reader lock for the graph. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-7-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/io.

[PULL 13/26] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_get_xdbg_block_graph() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-10-kw...@redhat.com> Reviewed-by: Stefan Ha

[PULL 09/26] block: Mark drain related functions GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
t they will hold the lock, but we don't have the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock() with a FIXME comment. These places will be removed once everything is properly annotated. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf Message-ID: <2

[PULL 14/26] block: Mark bdrv_refresh_filename() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_refresh_filename() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-11-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi

[PULL 24/26] block: Protect bs->parents with graph_lock

2023-10-12 Thread Kevin Wolf
Almost all functions that access the parent link already take the graph lock now. Add locking to the remaining user in a test case and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-21-kw...@redhat.

[PULL 05/26] test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context

2023-10-12 Thread Kevin Wolf
he test to use a BH to drop out of coroutine context, and add coroutine_mixed_fn and no_coroutine_fn markers to clarify the context each function runs in. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-2-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf

[PULL 08/26] block: Mark bdrv_first_blk() and bdrv_is_root_node() GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_first_blk() and bdrv_is_root_node() need to hold a reader lock for the graph. These functions are the only functions in block-backend.c that access the parent list of a node. Signed-off-by: Kevin Wolf Message-ID

[PULL 18/26] qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
e the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock() with a FIXME comment. These places will be removed once everything is properly annotated. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-15-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf

[PULL 15/26] block: Mark bdrv_primary_child() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_primary_child() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-12-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Sign

[PULL 02/26] block: complete public block status API

2023-10-12 Thread Kevin Wolf
From: Paolo Bonzini Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini Message-ID: <20230904100306.156197-3-pbonz...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevi

[PULL 25/26] block: Protect bs->children with graph_lock

2023-10-12 Thread Kevin Wolf
Almost all functions that access the child links already take the graph lock now. Add locking to the remaining users and finally annotate the struct field itself as protected by the graph lock. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-22-kw...@redhat.com> Reviewed-by:

[PULL 01/26] block: rename the bdrv_co_block_status static function

2023-10-12 Thread Kevin Wolf
: <20230904100306.156197-2-pbonz...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/io.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/block/io.c b/block/io.c index e7f9448d5a..2ff4ffda1c 100644 --- a/block/io.c +++ b/block/io.c @@ -

[PULL 26/26] block: Add assertion for bdrv_graph_wrlock()

2023-10-12 Thread Kevin Wolf
bdrv_graph_wrlock() can't run in a coroutine (because it polls) and requires holding the BQL. We already have GLOBAL_STATE_CODE() to assert the latter. Assert the former as well and add a no_coroutine_fn marker. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-23-kw...@re

[PULL 12/26] block: Take graph rdlock in parts of reopen

2023-10-12 Thread Kevin Wolf
accessing the graph. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-9-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- include/block/block_int-common.h | 13 +--- block.c | 57 2 f

[PULL 04/26] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-10-12 Thread Kevin Wolf
From: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini Message-ID: <20230904100306.156197-5-pbonz...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 block/io.c

[PULL 00/26] Block layer patches

2023-10-12 Thread Kevin Wolf
}* - Graph locking part 5 (protect children/parent links) Emanuele Giuseppe Esposito (1): block: Mark drain related functions GRAPH_RDLOCK Kevin Wolf (21): test-bdrv-drain: Don't call bdrv_graph_wrlock() in co

[PULL 16/26] block: Mark bdrv_get_parent_name() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
case, add assume_graph_lock() with a FIXME comment. These places will be removed once everything is properly annotated. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-13-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/qcow2.h

[PULL 03/26] block: switch to co_wrapper for bdrv_is_allocated_*

2023-10-12 Thread Kevin Wolf
From: Paolo Bonzini Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini Message-ID: <20230904100306.156197-4-pbonz...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/block/block-io.h | 12 + block/io.c

[PULL 19/26] qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
close_data_file = true, we know that we were called from non-coroutine main loop context (more specifically, we're coming from qcow2_close()) and can safely drop the reader lock temporarily with bdrv_graph_rdunlock_main_loop() and acquire the writer lock. Signed-off-by: Kevin Wolf Messa

[PULL 21/26] block: Mark bdrv_op_is_blocked() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_op_is_blocked() need to hold a reader lock for the graph because it calls bdrv_get_device_or_node_name(), which accesses the parents list of a node. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-18-kw...@redhat.

[PULL 17/26] block: Mark bdrv_amend_options() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_amend_options() need to hold a reader lock for the graph. This removes an assume_graph_lock() call in crypto's implementation. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-14-kw...@redhat.com> Reviewed

[PULL 06/26] block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions

2023-10-12 Thread Kevin Wolf
Add a new wrapper type for GRAPH_RDLOCK functions that should be called from coroutine context. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-3-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- include/block/block-common.h | 7 +-- s

[PULL 20/26] qcow2: Mark check_constraints_on_bitmap() GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
It still has an assume_graph_lock() call, but all of its callers are now properly annotated to hold the graph lock. Update the function to be GRAPH_RDLOCK as well and remove the assume_graph_lock(). Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-17-kw...@redhat.com> Revie

[PULL 22/26] block: Mark bdrv_apply_auto_read_only() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_apply_auto_read_only() need to hold a reader lock for the graph because it calls bdrv_can_set_read_only(), which indirectly accesses the parents list of a node. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-19

<    1   2   3   4   5   6   7   8   9   10   >