[PULL 11/26] block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK

2023-10-12 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_snapshot_fallback() 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-8-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi

[PULL 23/26] block: Mark bdrv_get_specific_info() and callers GRAPH_RDLOCK

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

[PULL 07/26] block: Take graph rdlock in bdrv_inactivate_all()

2023-10-12 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Message-ID: <20230929145157.45443-4-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

Re: [PATCH v3 3/4] migration: Deprecate block migration

2023-10-12 Thread Kevin Wolf
om the oldest way to the next oldest one. Pointing them to the modern way makes more sense. > > > > CC: Kevin Wolf > > CC: Eric Blake > > CC: Stefan Hajnoczi > > CC: Hanna Czenczek > > > > Signed-off-by: Juan Quintela Kevin

Re: [PATCH 00/22] block: Graph locking part 5 (protect children/parent links)

2023-10-11 Thread Kevin Wolf
Am 10.10.2023 um 22:48 hat Stefan Hajnoczi geschrieben: > On Fri, Sep 29, 2023 at 04:51:35PM +0200, Kevin Wolf wrote: > > After all the preparation in previous series, this series reaches an > > important milestone for the graph locking work: TSA can now verify that > >

Re: [PATCH v3 0/4] block: clean up coroutine versions of bdrv_{is_allocated,block_status}*

2023-10-06 Thread Kevin Wolf
Am 04.09.2023 um 12:03 hat Paolo Bonzini geschrieben: > Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, > since the underlying BlockDriver API is coroutine-based, and use > automatically-generated wrappers for the "mixed" versions. > > v2->v3: cleaned up formatting Thanks

Re: [PATCH v2 03/21] preallocate: Don't poll during permission updates

2023-10-06 Thread Kevin Wolf
Am 05.10.2023 um 21:55 hat Vladimir Sementsov-Ogievskiy geschrieben: > On 11.09.23 12:46, Kevin Wolf wrote: > > When the permission related BlockDriver callbacks are called, we are in > > the middle of an operation traversing the block graph. Polling in such a > > place is a

[PATCH 14/22] qcow2: Mark qcow2_signal_corruption() and callers GRAPH_RDLOCK

2023-09-29 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 --- block/qcow2.h | 180 + include/block/block-global-state.h

[PATCH 16/22] qcow2: Mark check_constraints_on_bitmap() GRAPH_RDLOCK

2023-09-29 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 --- block/qcow2-bitmap.c | 9 +++-- 1 file changed, 3 insertions

[PATCH 17/22] block: Mark bdrv_op_is_blocked() and callers GRAPH_RDLOCK

2023-09-29 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 --- include/block/block-global-state.h | 4

[PATCH 02/22] block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions

2023-09-29 Thread Kevin Wolf
Add a new wrapper type for GRAPH_RDLOCK functions that should be called from coroutine context. Signed-off-by: Kevin Wolf --- include/block/block-common.h | 7 +-- scripts/block-coroutine-wrapper.py | 10 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a

[PATCH 13/22] block: Mark bdrv_amend_options() and callers GRAPH_RDLOCK

2023-09-29 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 --- include/block/block-global-state.h | 8 include/

[PATCH 01/22] test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context

2023-09-29 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 --- tests/unit/test-bdrv-drain.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests

[PATCH 15/22] qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK

2023-09-29 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 --- block/

[PATCH 12/22] block: Mark bdrv_get_parent_name() and callers GRAPH_RDLOCK

2023-09-29 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 --- block/qcow2.h| 7 +++ include/block/block-io.h | 8 ++-- include/block/block_int-io.h | 2 +- include/block/q

[PATCH 00/22] block: Graph locking part 5 (protect children/parent links)

2023-09-29 Thread Kevin Wolf
ock: Mark drain related functions GRAPH_RDLOCK Kevin Wolf (21): test-bdrv-drain: Don't call bdrv_graph_wrlock() in coroutine context block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions block: Take graph rdlock in bdrv_inactivate_all() block: Mark bdrv_first_blk() a

[PATCH 07/22] block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK

2023-09-29 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_snapshot_fallback() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf --- include/block/block_int-common.h | 18 include/block/snapshot.h

[PATCH 22/22] block: Add assertion for bdrv_graph_wrlock()

2023-09-29 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 --- include/block/graph-lock.h | 3 ++- block/

[PATCH 09/22] block: Mark bdrv_get_xdbg_block_graph() and callers GRAPH_RDLOCK

2023-09-29 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 --- include/block/block-global-state.h | 2 +- blockdev.c | 2

[PATCH 05/22] block: Mark drain related functions GRAPH_RDLOCK

2023-09-29 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 --- include/

[PATCH 11/22] block: Mark bdrv_primary_child() and callers GRAPH_RDLOCK

2023-09-29 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 --- include/block/block_int-io.h | 5 +++-- block.c | 11

[PATCH 08/22] block: Take graph rdlock in parts of reopen

2023-09-29 Thread Kevin Wolf
accessing the graph. Signed-off-by: Kevin Wolf --- include/block/block_int-common.h | 13 +--- block.c | 57 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/include/block/block_int-common.h b/include/block/block_in

[PATCH 10/22] block: Mark bdrv_refresh_filename() and callers GRAPH_RDLOCK

2023-09-29 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 --- block/vhdx.h | 5 +-- include/block/block-global-state.h | 9

[PATCH 21/22] block: Protect bs->children with graph_lock

2023-09-29 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 --- include/block/block_int-common.h | 4 ++-- block.c

[PATCH 20/22] block: Protect bs->parents with graph_lock

2023-09-29 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 --- include/block/block_int-common.h | 4 ++-- tests/unit

[PATCH 06/22] block: Mark bdrv_parent_cb_resize() and callers GRAPH_RDLOCK

2023-09-29 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 --- block/io.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/block/io.c b/block/io.c index 63f248d672

[PATCH 04/22] block: Mark bdrv_first_blk() and bdrv_is_root_node() GRAPH_RDLOCK

2023-09-29 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 --- include/block/block

[PATCH 19/22] block: Mark bdrv_get_specific_info() and callers GRAPH_RDLOCK

2023-09-29 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_get_specific_info() need to hold a reader lock for the graph. This removes an assume_graph_lock() call in vmdk's implementation. Signed-off-by: Kevin Wolf --- include/block/block-io.h | 5 +++-- include/block/bloc

[PATCH 18/22] block: Mark bdrv_apply_auto_read_only() and callers GRAPH_RDLOCK

2023-09-29 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 --- include/block/block-io.h | 6

[PATCH 03/22] block: Take graph rdlock in bdrv_inactivate_all()

2023-09-29 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf --- block.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index e7f349b25c..73fd386076 100644 --- a/block.c +++ b/block.c @@ -6975,7 +6975,8 @@ void

Re: [PATCH v3 0/2] qemu-img: map: implement support for compressed clusters

2023-09-22 Thread Kevin Wolf
Am 22.09.2023 um 12:10 hat Kevin Wolf geschrieben: > Am 21.09.2023 um 19:02 hat Andrey Drobyshev geschrieben: > > On 9/14/23 16:34, Kevin Wolf wrote: > > > Am 07.09.2023 um 23:02 hat Andrey Drobyshev via geschrieben: > > >> v2 --> v3: > > >> * Ma

Re: [PATCH v3 0/2] qemu-img: map: implement support for compressed clusters

2023-09-22 Thread Kevin Wolf
Am 21.09.2023 um 19:02 hat Andrey Drobyshev geschrieben: > On 9/14/23 16:34, Kevin Wolf wrote: > > Am 07.09.2023 um 23:02 hat Andrey Drobyshev via geschrieben: > >> v2 --> v3: > >> * Make "compressed" field mandatory, not optional; > >> *

Re: [PATCH v2 7/7] qobject atomics osdep: Make a few macros more hygienic

2023-09-21 Thread Kevin Wolf
Am 20.09.2023 um 20:31 hat Markus Armbruster geschrieben: > Variables declared in macros can shadow other variables. Much of the > time, this is harmless, e.g.: > > #define _FDT(exp) \ > do {

Re: [PATCH v2 4/7] block/dirty-bitmap: Clean up local variable shadowing

2023-09-21 Thread Kevin Wolf
While there, move the local variables to function scope. > > Suggested-by: Kevin Wolf > Signed-off-by: Markus Armbruster Reviewed-by: Kevin Wolf

Re: [PATCH v2 6/7] block: Clean up local variable shadowing

2023-09-21 Thread Kevin Wolf
else rename variables. > > Signed-off-by: Markus Armbruster > Reviewed-by: Stefan Hajnoczi > Acked-by: Anthony PERARD > Acked-by: Ilya Dryomov Reviewed-by: Kevin Wolf

Re: [PATCH v2 5/7] block/vdi: Clean up local variable shadowing

2023-09-21 Thread Kevin Wolf
else rename variables. > > Signed-off-by: Markus Armbruster > Reviewed-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf

[PULL v2 00/28] Block layer patches

2023-09-20 Thread Kevin Wolf
essed data blocks - block-backend: process I/O in the current AioContext Andrey Drobyshev via (2): block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status() qemu-img: map: report compressed data blocks Kevi

Re: [PATCH] block: mark aio_poll as non-coroutine

2023-09-19 Thread Kevin Wolf
Am 08.09.2023 um 09:54 hat Paolo Bonzini geschrieben: > It is forbidden to block on the event loop during a coroutine, as that > can cause deadlocks due to recursive locking. > > Signed-off-by: Paolo Bonzini Thanks, applied to the block branch. Kevin

Re: Deadlock with SATA CD I/O and eject

2023-09-19 Thread Kevin Wolf
Am 19.09.2023 um 14:57 hat John Levon geschrieben: > On Tue, Sep 19, 2023 at 12:54:59PM +0200, Kevin Wolf wrote: > > > > In the meantime, we start processing the blk_drain() code, so by the time > > > this > > > blk_pread() actually gets handled, quiesc

Re: [PATCH v2] block-backend: Add new bds_io_in_flight counter

2023-09-19 Thread Kevin Wolf
Am 31.03.2023 um 18:23 hat Hanna Czenczek geschrieben: > IDE TRIM is a BB user that wants to elevate its BB's in-flight counter > for a "macro" operation that consists of several actual I/O operations. > Each of those operations is individually started and awaited. It does > this so that blk_drain

Re: Deadlock with SATA CD I/O and eject

2023-09-19 Thread Kevin Wolf
Am 18.09.2023 um 19:28 hat John Levon geschrieben: > > Observed with base of qemu 6.2.0, but from code inspection it looks to me like > it's still current in upstream master. Apologies if I have missed a fix in > this > area. > > Symptom: run a UEFI-booted SATA CD Windows installer. When it hits

Re: [PULL 00/28] Block layer patches

2023-09-19 Thread Kevin Wolf
Am 18.09.2023 um 20:56 hat Stefan Hajnoczi geschrieben: > Hi Kevin, > I believe that my own commit "block-coroutine-wrapper: use > qemu_get_current_aio_context()" breaks this test. The failure is > non-deterministic (happens about 1 out of 4 runs). > > It seems the job hangs and the test times out

Re: [PATCH 4/7] block/dirty-bitmap: Clean up local variable shadowing

2023-09-19 Thread Kevin Wolf
Am 19.09.2023 um 07:48 hat Markus Armbruster geschrieben: > Kevin Wolf writes: > > > Am 31.08.2023 um 15:25 hat Markus Armbruster geschrieben: > >> Local variables shadowing other local variables or parameters make the > >> code needlessly hard to understand. Tr

[PULL 10/28] block: Mark bdrv_attach_child_common() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
tched to locked tran_finalize() calls together. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-11-kw...@redhat.com> Signed-off-by: Kevin Wolf --- block.c| 133 +++-- block/stream.c | 20 ++

[PULL 09/28] block: Mark bdrv_replace_child_tran() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
alize() must be called without the lock held. This is because bdrv_append() also calls bdrv_attach_child_noperm(), which currently requires to be called unlocked. Once it changes, the transaction callbacks can be changed, too. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Rev

[PULL 25/28] test-bdrv-drain: avoid race with BH in IOThread drain test

2023-09-15 Thread Kevin Wolf
From: Stefan Hajnoczi This patch fixes a race condition in test-bdrv-drain that is difficult to reproduce. test-bdrv-drain sometimes fails without an error message on the block pull request sent by Kevin Wolf on Sep 4, 2023. I was able to reproduce it locally and found that "block-ba

[PULL 22/28] block: add BDRV_BLOCK_COMPRESSED flag for bdrv_block_status()

2023-09-15 Thread Kevin Wolf
s V. Lunev Reviewed-by: Hanna Czenczek Signed-off-by: Andrey Drobyshev Message-ID: <20230907210226.953821-2-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/block/block-common.h | 3 +++ block/qcow.c | 5 - block/qcow2.c

[PULL 20/28] block: Mark bdrv_unref_child() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-21-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 7 ++- block.c| 11 +++ block/blk

[PULL 26/28] block-backend: process I/O in the current AioContext

2023-09-15 Thread Kevin Wolf
: blk_mig_lock() protects the data accessed by the completion callback. - The remaining emulated devices and exports run with qemu_get_aio_context() == blk_get_aio_context(). Signed-off-by: Stefan Hajnoczi Message-ID: <20230912231037.826804-4-stefa...@redhat.com> Reviewed-by: Kevin Wolf Reviewed-by

[PULL 21/28] block: Mark bdrv_add/del_child() and caller GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
The functions read the parents list in the generic block layer, so we need to hold the graph lock already there. The BlockDriver implementations actually modify the graph, so it has to be a writer lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan

[PULL 16/28] block: Mark bdrv_parent_cb_change_media() GRAPH_RDLOCK

2023-09-15 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-17-kw...@redhat.com> Signed-off-by: Kevin Wolf --- block.c | 6 +- 1 file chan

[PULL 07/28] block-coroutine-wrapper: Allow arbitrary parameter names

2023-09-15 Thread Kevin Wolf
Don't assume specific parameter names like 'bs' or 'blk' in the generated code, but use the actual name. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-8-kw...@redhat.com> Signed-o

[PULL 15/28] block: Mark bdrv_child_perm() GRAPH_RDLOCK

2023-09-15 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_child_perm() need to hold a reader lock for the graph because some implementations access the children list of a node. The callers of bdrv_child_perm() conveniently already hold the lock. Signed-off-by: Kevin Wolf Reviewed-by

[PULL 01/28] block: Remove unused BlockReopenQueueEntry.perms_checked

2023-09-15 Thread Kevin Wolf
This field has been unused since commit 72373e40fbc ('block: bdrv_reopen_multiple: refresh permissions on updated graph'). Remove it. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <202309110946

[PULL 17/28] block: Take graph rdlock in bdrv_drop_intermediate()

2023-09-15 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Message-ID: <20230911094620.45040-18-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block.c | 2 ++ 1 file chan

[PULL 28/28] block-coroutine-wrapper: use qemu_get_current_aio_context()

2023-09-15 Thread Kevin Wolf
-off-by: Stefan Hajnoczi Message-ID: <20230912231037.826804-6-stefa...@redhat.com> Reviewed-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- scripts/block-coroutine-wrapper.py | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/block-co

[PULL 03/28] preallocate: Don't poll during permission updates

2023-09-15 Thread Kevin Wolf
nd not rely on the permission updates for it. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-4-kw...@redhat.com> Signed-off-by: Kevin Wolf --- block/preallocate.c | 89 +++-- 1 file chang

[PULL 19/28] block: Mark bdrv_root_unref_child() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-20-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include/block/block_int-global-state.h | 2 +- block.c| 6 +++--- block/bloc

[PULL 18/28] block: Take graph rdlock in bdrv_change_aio_context()

2023-09-15 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Message-ID: <20230911094620.45040-19-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block.c | 4 1 file chan

[PULL 00/28] Block layer patches

2023-09-15 Thread Kevin Wolf
essed data blocks Kevin Wolf (21): block: Remove unused BlockReopenQueueEntry.perms_checked preallocate: Factor out preallocate_truncate_to_real_size() preallocate: Don't poll during permission updates block: Take AioContext lock for bdrv_append() more consistently b

[PULL 27/28] block-backend: process zoned requests in the current AioContext

2023-09-15 Thread Kevin Wolf
Hajnoczi Message-ID: <20230912231037.826804-5-stefa...@redhat.com> Reviewed-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- block/block-backend.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c i

[PULL 06/28] block-coroutine-wrapper: Add no_co_wrapper_bdrv_wrlock functions

2023-09-15 Thread Kevin Wolf
Add a new wrapper type for GRAPH_WRLOCK functions that should be called from coroutine context. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-7-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include

[PULL 05/28] block: Introduce bdrv_schedule_unref()

2023-09-15 Thread Kevin Wolf
utput, resulting in a new "(qemu)" prompt in the test output that was previously on a separate line and filtered out. Signed-off-by: Kevin Wolf Message-ID: <20230911094620.45040-6-kw...@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- include/b

[PULL 12/28] block: Mark bdrv_attach_child() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-13-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 14 -- block.c| 7 +++ blo

[PULL 24/28] block: remove AIOCBInfo->get_aio_context()

2023-09-15 Thread Kevin Wolf
-2-stefa...@redhat.com> Reviewed-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Klaus Jensen Signed-off-by: Kevin Wolf --- include/block/aio.h| 1 - include/block/block-global-state.h | 2 ++ include/block/block-io.h | 1 - block/block-backend.c

[PULL 13/28] block: Mark bdrv_parent_perms_conflict() and callers GRAPH_RDLOCK

2023-09-15 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-14-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include/block/block_int-co

[PULL 11/28] block: Call transaction callbacks with lock held

2023-09-15 Thread Kevin Wolf
llers down to the place where the transaction is finalised actually have the writer lock. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-12-kw...@redhat.com> Signed-off-by: Kevin Wolf --- b

[PULL 08/28] block: Mark bdrv_replace_child_noperm() GRAPH_WRLOCK

2023-09-15 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-9-kw...@redhat.com> Signed-off-by: Kevin Wolf --- block.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/block.c b/bl

[PULL 04/28] block: Take AioContext lock for bdrv_append() more consistently

2023-09-15 Thread Kevin Wolf
The documentation for bdrv_append() says that the caller must hold the AioContext lock for bs_top. Change all callers to actually adhere to the contract. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID

[PULL 02/28] preallocate: Factor out preallocate_truncate_to_real_size()

2023-09-15 Thread Kevin Wolf
It's essentially the same code in preallocate_check_perm() and preallocate_close(), except that the latter ignores errors. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45

[PULL 14/28] block: Mark bdrv_get_cumulative_perm() and callers GRAPH_RDLOCK

2023-09-15 Thread Kevin Wolf
with GRAPH_RDLOCK_PTR. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-15-kw...@redhat.com> Signed-off-by: Kevin Wolf --- include/block/block_int-common.h | 9 --- include/block/block_int-global-s

Re: [PATCH v3 0/5] block-backend: process I/O in the current AioContext

2023-09-15 Thread Kevin Wolf
Am 13.09.2023 um 01:10 hat Stefan Hajnoczi geschrieben: > v3 > - Add Patch 2 to fix a race condition in test-bdrv-drain. This was the CI > failure that bumped this patch series from Kevin's pull request. > - Add missing 051.pc.out file. I tried qemu-system-aarch64 to see of 051.out > also needs

Re: [PATCH 6/7] block: Clean up local variable shadowing

2023-09-15 Thread Kevin Wolf
Am 31.08.2023 um 15:25 hat Markus Armbruster geschrieben: > Local variables shadowing other local variables or parameters make the > code needlessly hard to understand. Tracked down with -Wshadow=local. > Clean up: delete inner declarations when they are actually redundant, > else rename variables

Re: [PATCH 4/7] block/dirty-bitmap: Clean up local variable shadowing

2023-09-15 Thread Kevin Wolf
onsistent(bitmap)) { > @@ -1625,7 +1624,7 @@ bool > qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, > > /* allocate clusters and store bitmaps */ > QSIMPLEQ_FOREACH(bm, bm_list, entry) { > -BdrvDirtyBitmap *bitmap = bm->dirty_bitmap; > + bitmap = bm->dirty_bitmap; > > if (bitmap == NULL || bdrv_dirty_bitmap_readonly(bitmap)) { > continue; Reviewed-by: Kevin Wolf

Re: [PATCH 5/7] block/vdi: Clean up local variable shadowing

2023-09-15 Thread Kevin Wolf
Am 31.08.2023 um 15:25 hat Markus Armbruster geschrieben: > Local variables shadowing other local variables or parameters make the > code needlessly hard to understand. Tracked down with -Wshadow=local. > Clean up: delete inner declarations when they are actually redundant, > else rename variables

Re: [PATCH v3 2/2] qemu-img: map: report compressed data blocks

2023-09-15 Thread Kevin Wolf
Am 14.09.2023 um 23:40 hat Andrey Drobyshev geschrieben: > On 9/15/23 00:17, Eric Blake wrote: > > On Fri, Sep 08, 2023 at 12:02:26AM +0300, Andrey Drobyshev wrote: > >> Right now "qemu-img map" reports compressed blocks as containing data > >> but having no host offset. This is not very informati

Re: [PATCH v3 0/2] qemu-img: map: implement support for compressed clusters

2023-09-14 Thread Kevin Wolf
Am 07.09.2023 um 23:02 hat Andrey Drobyshev via geschrieben: > v2 --> v3: > * Make "compressed" field mandatory, not optional; > * Adjust field description in qapi/block-core.json; > * Squash patch 3 into patch 2 so that failing tests don't break bisect; > * Update even more tests' outputs

Re: [PATCH v2 00/21] Graph locking part 4 (node management)

2023-09-14 Thread Kevin Wolf
Am 12.09.2023 um 18:49 hat Stefan Hajnoczi geschrieben: > On Mon, Sep 11, 2023 at 11:45:59AM +0200, Kevin Wolf wrote: > > The previous parts of the graph locking changes focussed mostly on the > > BlockDriver side and taking reader locks while performing I/O. This > > series

Re: [PATCH 3/3] iotests: distinguish 'skipped' and 'not run' states

2023-09-14 Thread Kevin Wolf
Am 13.09.2023 um 18:31 hat Eric Blake geschrieben: > On Wed, Sep 13, 2023 at 04:47:54PM +0100, Daniel P. Berrangé wrote: > > On Wed, Sep 06, 2023 at 04:09:17PM +0200, Denis V. Lunev wrote: > > > Each particular testcase could skipped intentionally and accidentally. > > > For example the test is not

[PATCH v2 09/21] block: Mark bdrv_replace_child_tran() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
alize() must be called without the lock held. This is because bdrv_append() also calls bdrv_attach_child_noperm(), which currently requires to be called unlocked. Once it changes, the transaction callbacks can be changed, too. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Rev

[PATCH v2 10/21] block: Mark bdrv_attach_child_common() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
tched to locked tran_finalize() calls together. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c| 133 +++-- block/stream.c | 20 ++-- 2 files changed, 100 insertions(+), 53 deletions(-) diff --git a/block.c b/block.c

[PATCH v2 16/21] block: Mark bdrv_parent_cb_change_media() GRAPH_RDLOCK

2023-09-11 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- block.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 0f7f78f8de

[PATCH v2 18/21] block: Take graph rdlock in bdrv_change_aio_context()

2023-09-11 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito --- block.c | 4 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index e024a6ccec..8e589bb2e4 100644 --- a/block.c +++ b/block.c

[PATCH v2 13/21] block: Mark bdrv_parent_perms_conflict() and callers GRAPH_RDLOCK

2023-09-11 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- include/block/block_int-common.h| 6 ++--- include/block/block_int-global-state.h | 8 +++--- include

[PATCH v2 03/21] preallocate: Don't poll during permission updates

2023-09-11 Thread Kevin Wolf
nd not rely on the permission updates for it. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/preallocate.c | 89 +++-- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/block/preallocate.c b/block/p

[PATCH v2 08/21] block: Mark bdrv_replace_child_noperm() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- block.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/block.c b/block.c index c8ac7cfac4..61856f5c33 100644 --- a/block.c +++ b/block.c @@ -91,8 +91,9 @@ s

[PATCH v2 21/21] block: Mark bdrv_add/del_child() and caller GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
The functions read the parents list in the generic block layer, so we need to hold the graph lock already there. The BlockDriver implementations actually modify the graph, so it has to be a writer lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan

[PATCH v2 14/21] block: Mark bdrv_get_cumulative_perm() and callers GRAPH_RDLOCK

2023-09-11 Thread Kevin Wolf
with GRAPH_RDLOCK_PTR. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- include/block/block_int-common.h | 9 --- include/block/block_int-global-state.h | 4 +-- block.c| 35

[PATCH v2 17/21] block: Take graph rdlock in bdrv_drop_intermediate()

2023-09-11 Thread Kevin Wolf
The function reads the parents list, so it needs to hold the graph lock. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito --- block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block.c b/block.c index 06d2a1b256..e024a6ccec 100644 --- a/block.c +++ b/block.c

[PATCH v2 11/21] block: Call transaction callbacks with lock held

2023-09-11 Thread Kevin Wolf
llers down to the place where the transaction is finalised actually have the writer lock. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi --- block.c | 61 + 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/block.c b/bl

[PATCH v2 15/21] block: Mark bdrv_child_perm() GRAPH_RDLOCK

2023-09-11 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_child_perm() need to hold a reader lock for the graph because some implementations access the children list of a node. The callers of bdrv_child_perm() conveniently already hold the lock. Signed-off-by: Kevin Wolf Reviewed-by

[PATCH v2 12/21] block: Mark bdrv_attach_child() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- include/block/block-global-state.h | 14 -- block.c| 7 +++ block/quorum.c | 2 ++ block/replication.c| 6 ++ tests

[PATCH v2 19/21] block: Mark bdrv_root_unref_child() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
ff-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- include/block/block_int-global-state.h | 2 +- block.c| 6 +++--- block/block-backend.c | 3 +++ blockjob.c | 2 ++ 4 files chang

[PATCH v2 06/21] block-coroutine-wrapper: Add no_co_wrapper_bdrv_wrlock functions

2023-09-11 Thread Kevin Wolf
Add a new wrapper type for GRAPH_WRLOCK functions that should be called from coroutine context. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- include/block/block-common.h | 4 scripts/block-coroutine-wrapper.py | 11

[PATCH v2 01/21] block: Remove unused BlockReopenQueueEntry.perms_checked

2023-09-11 Thread Kevin Wolf
This field has been unused since commit 72373e40fbc ('block: bdrv_reopen_multiple: refresh permissions on updated graph'). Remove it. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- block.c | 1 - 1 file

[PATCH v2 07/21] block-coroutine-wrapper: Allow arbitrary parameter names

2023-09-11 Thread Kevin Wolf
Don't assume specific parameter names like 'bs' or 'blk' in the generated code, but use the actual name. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- scripts/block-coroutine-wrapper.py | 7 --- 1 file ch

[PATCH v2 04/21] block: Take AioContext lock for bdrv_append() more consistently

2023-09-11 Thread Kevin Wolf
The documentation for bdrv_append() says that the caller must hold the AioContext lock for bs_top. Change all callers to actually adhere to the contract. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- tests/unit/test

[PATCH v2 00/21] Graph locking part 4 (node management)

2023-09-11 Thread Kevin Wolf
bdrv_schedule_unref() Kevin Wolf (21): block: Remove unused BlockReopenQueueEntry.perms_checked preallocate: Factor out preallocate_truncate_to_real_size() preallocate: Don't poll during permission updates block: Take AioContext lock for bdrv_append() more consistently block: Intr

[PATCH v2 05/21] block: Introduce bdrv_schedule_unref()

2023-09-11 Thread Kevin Wolf
utput, resulting in a new "(qemu)" prompt in the test output that was previously on a separate line and filtered out. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 1 + block.c| 17 + block/graph-lock.c | 2

[PATCH v2 20/21] block: Mark bdrv_unref_child() GRAPH_WRLOCK

2023-09-11 Thread Kevin Wolf
Instead of taking the writer lock internally, require callers to already hold it when calling bdrv_unref_child(). 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:

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