[PATCH 3/8] qcow2: Unlock the graph in qcow2_do_open() where necessary

2023-05-10 Thread Kevin Wolf
qcow2_do_open() calls a few no_co_wrappers that wrap functions taking the graph lock internally as a writer. Therefore, it can't hold the reader lock across these calls, it causes deadlocks. Drop the lock temporarily around the calls. Signed-off-by: Kevin Wolf --- block/qcow2.c | 6 ++ 1

[PATCH 1/8] block: Call .bdrv_co_create(_opts) unlocked

2023-05-10 Thread Kevin Wolf
These are functions that modify the graph, so they must be able to take a writer lock. This is impossible if they already hold the reader lock. If they need a reader lock for some of their operations, they should take it internally. Many of them go through blk_*(), which will always take the lock

[PATCH 2/8] block/export: Fix null pointer dereference in error path

2023-05-10 Thread Kevin Wolf
There are some error paths in blk_exp_add() that jump to 'fail:' before 'exp' is even created. So we can't just unconditionally access exp->blk. Add a NULL check, and switch from exp->blk to blk, which is available earlier, just to be extra sure that we really cover all cases where BlockDevOps

[PATCH 6/8] test-bdrv-drain: Call bdrv_co_unref() in coroutine context

2023-05-10 Thread Kevin Wolf
bdrv_unref() is a no_coroutine_fn, so calling it from coroutine context is invalid. Use bdrv_co_unref() instead. Signed-off-by: Kevin Wolf --- tests/unit/test-bdrv-drain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test-bdrv-drain.c

[PATCH 5/8] test-bdrv-drain: Take graph lock more selectively

2023-05-10 Thread Kevin Wolf
If we take a reader lock, we can't call any functions that take a writer lock internally without causing deadlocks once the reader lock is actually enforced in the main thread, too. Take the reader lock only where it is actually needed. Signed-off-by: Kevin Wolf --- tests/unit/test-bdrv-drain.c

[PATCH 8/8] graph-lock: Honour read locks even in the main thread

2023-05-10 Thread Kevin Wolf
There are some conditions under which we don't actually need to do anything for taking a reader lock: Writing the graph is only possible from the main context while holding the BQL. So if a reader is running in the main context under the BQL and knows that it won't be interrupted until the next

[PATCH 7/8] blockjob: Adhere to rate limit even when reentered early

2023-05-10 Thread Kevin Wolf
When jobs are sleeping, for example to enforce a given rate limit, they can be reentered early, in particular in order to get paused, to update the rate limit or to get cancelled. Before this patch, they behave in this case as if they had fully completed their rate limiting delay. This means that

[PATCH 4/8] qemu-img: Take graph lock more selectively

2023-05-10 Thread Kevin Wolf
If we take a reader lock, we can't call any functions that take a writer lock internally without causing deadlocks once the reader lock is actually enforced in the main thread, too. Take the reader lock only where it is actually needed. Signed-off-by: Kevin Wolf --- qemu-img.c | 5 +++-- 1 file

[PATCH 0/8] block: Honour graph read lock even in the main thread

2023-05-10 Thread Kevin Wolf
Fiona asked why it's correct that bdrv_graph_co_rd_lock/unlock() do nothing if qemu_in_main_thread() returns true. As far as I can tell, it's not correct. The coroutine can yield while it believes to have the lock, and then the main loop can call some code that takes a write lock without waiting

[PULL 05/10] colo: make colo_checkpoint_notify static and provide simpler API

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy colo_checkpoint_notify() is mostly used in colo.c. Outside we use it once when x-checkpoint-delay migration parameter is set. So, let's simplify the external API to only that function - notify COLO that parameter was set. This make external API more robust and

[PULL 04/10] block/meson.build: prefer positive condition for replication

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Lukas Straub Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-2-vsement...@yandex-team.ru> Signed-off-by: Juan Quintela ---

[PULL 02/10] ram: Let colo_flush_ram_cache take the bitmap_mutex

2023-05-10 Thread Juan Quintela
From: Lukas Straub This is not required, colo_flush_ram_cache does not run concurrently with the multifd threads since the cache is only flushed after everything has been received. But it makes me more comfortable. This will be used in the next commits to add colo support to multifd.

[PULL 07/10] migration: drop colo_incoming_thread from MigrationIncomingState

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy have_colo_incoming_thread variable is unused. colo_incoming_thread can be local. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen Message-Id:

[PULL 10/10] migration: block incoming colo when capability is disabled

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy We generally require same set of capabilities on source and target. Let's require x-colo capability to use COLO on target. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Lukas Straub Reviewed-by:

[PULL 09/10] migration: disallow change capabilities in COLO state

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy COLO is not listed as running state in migrate_is_running(), so, it's theoretically possible to disable colo capability in COLO state and the unexpected error in migration_iteration_finish() is reachable. Let's disallow that in qmp_migrate_set_capabilities.

[PULL 06/10] build: move COLO under CONFIG_REPLICATION

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy We don't allow to use x-colo capability when replication is not configured. So, no reason to build COLO when replication is disabled, it's unusable in this case. Note also that the check in migrate_caps_check() is not the only restriction: some functions in

[PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Juan Quintela
The following changes since commit caa9cbd566877b34e9abcc04d936116fc5e0ab28: Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2023-05-10 14:52:03 +0100) are available in the Git repository at: https://gitlab.com/juan.quintela/qemu.git

[PULL 01/10] ram: Add public helper to set colo bitmap

2023-05-10 Thread Juan Quintela
From: Lukas Straub The overhead of the mutex in non-multifd mode is negligible, because in that case its just the single thread taking the mutex. This will be used in the next commits to add colo support to multifd. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Message-Id:

[PULL 03/10] multifd: Add the ramblock to MultiFDRecvParams

2023-05-10 Thread Juan Quintela
From: Lukas Straub This will be used in the next commits to add colo support to multifd. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Message-Id: <88135197411df1a71d7832962b39abf60faf0021.1683572883.git.lukasstra...@web.de> Signed-off-by: Juan Quintela --- migration/multifd.h |

[PULL 08/10] migration: process_incoming_migration_co: simplify code flow around ret

2023-05-10 Thread Juan Quintela
From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-7-vsement...@yandex-team.ru> Signed-off-by: Juan Quintela --- migration/migration.c | 11 ++-

Re: [PATCH v2 0/2] block/blkio: add 'fd' option to virtio-blk-vhost-vdpa driver

2023-05-10 Thread Jonathon Jongsma
On 5/4/23 4:28 AM, Stefano Garzarella wrote: v2: - added patch 01 to use monitor_fd_param() in the blkio module - use monitor_fd_param() to parse the fd like vhost devices [Stefan] v1: https://lore.kernel.org/qemu-devel/20230502145050.224615-1-sgarz...@redhat.com/ The virtio-blk-vhost-vdpa

Re: [PULL 00/28] Block layer patches

2023-05-10 Thread Richard Henderson
On 5/10/23 13:20, Kevin Wolf wrote: The following changes since commit b2896c1b09878fd1c4b485b3662f8beecbe0fef4: Merge tag 'vfio-updates-20230509.0' of https://gitlab.com/alex.williamson/qemu into staging (2023-05-10 11:20:35 +0100) are available in the Git repository at:

Re: [PATCH v9 0/6] block: refactor blockdev transactions

2023-05-10 Thread Denis V. Lunev
On 5/10/23 17:21, Vladimir Sementsov-Ogievskiy wrote: Interesting, I see two 5/6 letters, equal body, but a bit different headers (the second has empty "Sender").. for me all is OK

Re: [PATCH v9 0/6] block: refactor blockdev transactions

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Interesting, I see two 5/6 letters, equal body, but a bit different headers (the second has empty "Sender").. On 10.05.23 18:06, Vladimir Sementsov-Ogievskiy wrote: Hi all! Let's refactor QMP transactions implementation into new (relatively) transaction API. v9: 01: fix leaks 02-03: add r-b

[PATCH v9 0/6] block: refactor blockdev transactions

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Hi all! Let's refactor QMP transactions implementation into new (relatively) transaction API. v9: 01: fix leaks 02-03: add r-b 04: fix leak, s/Transaction/transaction/ 05: new, was part of 06 06: rework of bitmap-add action moved to 05 Vladimir Sementsov-Ogievskiy (6): blockdev: refactor

[PATCH v9 4/6] blockdev: transaction: refactor handling transaction properties

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Only backup supports GROUPED mode. Make this logic more clear. And avoid passing extra thing to each action. Signed-off-by: Vladimir Sementsov-Ogievskiy --- blockdev.c | 96 +- 1 file changed, 22 insertions(+), 74 deletions(-) diff --git

[PATCH v9 1/6] blockdev: refactor transaction to use Transaction API

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
We are going to add more block-graph modifying transaction actions, and block-graph modifying functions are already based on Transaction API. Next, we'll need to separately update permissions after several graph-modifying actions, and this would be simple with help of Transaction API. So, now

[PATCH v9 6/6] blockdev: qmp_transaction: drop extra generic layer

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Let's simplify things: First, actions generally don't need access to common BlkActionState structure. The only exclusion are backup actions that need block_job_txn. Next, for transaction actions of Transaction API is more native to allocated state structure in the action itself. So, do the

[PATCH v9 5/6] blockdev: use state.bitmap in block-dirty-bitmap-add action

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Other bitmap related actions use the .bitmap pointer in .abort action, let's do same here: 1. It helps further refactoring, as bitmap-add is the only bitmap action that uses state.action in .abort 2. It must be safe: transaction actions rely on the fact that on .abort() the state is the

[PATCH v9 3/6] blockdev: qmp_transaction: refactor loop to classic for

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Kevin Wolf --- blockdev.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/blockdev.c b/blockdev.c index f72084d206..f236e5c27e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2367,7 +2367,7 @@ void

[PATCH v9 2/6] blockdev: transactions: rename some things

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
Look at qmp_transaction(): dev_list is not obvious name for list of actions. Let's look at qapi spec, this argument is "actions". Let's follow the common practice of using same argument names in qapi scheme and code. To be honest, rename props to properties for same reason. Next, we have to

Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson
On 5/10/23 15:08, Juan Quintela wrote: grep " uint;" on my system includes. I know that there are more creative ways to define it. /usr/include/ffi-x86_64.h\0278: ffi_arg uint; Thankfully only a structure member. :-) /usr/include/sys/types.h\0150:typedef unsigned int uint; Oof.

Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Juan Quintela
Richard Henderson wrote: > On 5/10/23 13:20, Juan Quintela wrote: >> Richard Henderson wrote: >>> On 5/9/23 20:17, Juan Quintela wrote: The following changes since commit 271477b59e723250f17a7e20f139262057921b6a: Merge tag 'compression-code-pull-request' of

Re: [PATCH v8 5/5] blockdev: qmp_transaction: drop extra generic layer

2023-05-10 Thread Vladimir Sementsov-Ogievskiy
On 10.05.23 14:47, Kevin Wolf wrote: Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: Let's simplify things: First, actions generally don't need access to common BlkActionState structure. The only exclusion are backup actions that need block_job_txn. Next, for transaction

[PULL 10/28] block: Don't call no_coroutine_fns in qmp_block_resize()

2023-05-10 Thread Kevin Wolf
This QMP handler runs in a coroutine, so it must use the corresponding no_co_wrappers instead. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2185688 Cc: qemu-sta...@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 00/28] Block layer patches

2023-05-10 Thread Kevin Wolf
The following changes since commit b2896c1b09878fd1c4b485b3662f8beecbe0fef4: Merge tag 'vfio-updates-20230509.0' of https://gitlab.com/alex.williamson/qemu into staging (2023-05-10 11:20:35 +0100) are available in the Git repository at: https://repo.or.cz/qemu/kevin.git tags/for-upstream

Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Juan Quintela
Richard Henderson wrote: > On 5/9/23 20:17, Juan Quintela wrote: >> The following changes since commit 271477b59e723250f17a7e20f139262057921b6a: >>Merge tag 'compression-code-pull-request' of >> https://gitlab.com/juan.quintela/qemu into staging (2023-05-08 >> 20:38:05 +0100) >> are available

Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson
On 5/10/23 13:20, Juan Quintela wrote: Richard Henderson wrote: On 5/9/23 20:17, Juan Quintela wrote: The following changes since commit 271477b59e723250f17a7e20f139262057921b6a: Merge tag 'compression-code-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-05-08

[PULL 01/28] block: add configure options for excluding vmdk, vhdx and vpc

2023-05-10 Thread Kevin Wolf
From: Vladimir Sementsov-Ogievskiy Let's add --enable / --disable configure options for these formats, so that those who don't need them may not build them. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20230421092758.814122-1-vsement...@yandex-team.ru> Reviewed-by: Kevin Wolf

[PULL 19/28] mirror: Require GRAPH_RDLOCK for accessing a node's parent list

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that functions accessing the parent list of a node need to hold a reader lock for the graph. As it happens, they already do. Signed-off-by: Kevin Wolf Message-Id: <20230504115750.54437-13-kw...@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Stefan

[PULL 09/28] block: bdrv/blk_co_unref() for calls in coroutine context

2023-05-10 Thread Kevin Wolf
These functions must not be called in coroutine context, because they need write access to the graph. Cc: qemu-sta...@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id: <20230504115750.54437-4-kw...@redhat.com> Signed-off-by: Kevin Wolf ---

[PULL 22/28] block: Mark bdrv_co_debug_event() GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_debug_event() need to hold a reader lock for the graph. Unfortunately we cannot use a co_wrapper_bdrv_rdlock (i.e. make the coroutine wrapper a no_coroutine_fn), because the function is called

[PULL 14/28] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock

2023-05-10 Thread Kevin Wolf
GRAPH_RDLOCK_GUARD() and GRAPH_RDLOCK_GUARD_MAINLOOP() only take a reader lock for the graph, so the correct annotation for them to use is TSA_ASSERT_SHARED rather than TSA_ASSERT. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Message-Id: <20230504115750.54437-8-kw...@redhat.com>

[PULL 16/28] nbd: Remove nbd_co_flush() wrapper function

2023-05-10 Thread Kevin Wolf
The only thing nbd_co_flush() does is call nbd_client_co_flush(). Just use that function directly in the BlockDriver definitions and remove the wrapper. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id: <20230504115750.54437-10-kw...@redhat.com>

[PULL 20/28] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_get_allocated_file_size() need to hold a reader lock for the graph. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Message-Id:

[PULL 21/28] block: Mark bdrv_co_get_info() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_get_info() need to hold a reader lock for the graph. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 12/28] test-bdrv-drain: Don't modify the graph in coroutines

2023-05-10 Thread Kevin Wolf
test-bdrv-drain contains a few test cases that are run both in coroutine and non-coroutine context. Running the entire code including the setup and shutdown in coroutines is incorrect because graph modifications can generally not happen in coroutines. Change the test so that creating and

[PULL 18/28] vhdx: Require GRAPH_RDLOCK for accessing a node's parent list

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that functions accessing the parent list of a node need to hold a reader lock for the graph. As it happens, they already do. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 25/28] block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_query_block_graph_info() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 27/28] block: Mark bdrv_refresh_limits() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_refresh_limits() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 17/28] nbd: Mark nbd_co_do_establish_connection() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito This adds GRAPH_RDLOCK annotations to declare that callers of nbd_co_do_establish_connection() need to hold a reader lock for the graph. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi

[PULL 26/28] block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_recurse_can_replace() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 24/28] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_query_bds_stats() need to hold a reader lock for the graph because it accesses the children list of a node. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-Id:

[PULL 11/28] iotests: Test resizing image attached to an iothread

2023-05-10 Thread Kevin Wolf
This tests that trying to resize an image with QMP block_resize doesn't hang or otherwise fail when the image is attached to a device running in an iothread. This is a regression test for the recent fix that changed qmp_block_resize, which is a coroutine based QMP handler, to avoid calling

[PULL 03/28] aio-wait: avoid AioContext lock in aio_wait_bh_oneshot()

2023-05-10 Thread Kevin Wolf
From: Stefan Hajnoczi There is no need for the AioContext lock in aio_wait_bh_oneshot(). It's easy to remove the lock from existing callers and then switch from AIO_WAIT_WHILE() to AIO_WAIT_WHILE_UNLOCKED() in aio_wait_bh_oneshot(). Document that the AioContext lock should not be held across

[PULL 13/28] graph-lock: Add GRAPH_UNLOCKED(_PTR)

2023-05-10 Thread Kevin Wolf
For some functions, it is part of their interface to be called without holding the graph lock. Add a new macro to document this. The macro expands to TSA_EXCLUDES(), which is a relatively weak check because it passes in cases where the compiler just doesn't know if the lock is held. Function

[PULL 15/28] block: .bdrv_open is non-coroutine and unlocked

2023-05-10 Thread Kevin Wolf
Drivers were a bit confused about whether .bdrv_open can run in a coroutine and whether or not it holds a graph lock. It cannot keep a graph lock from the caller across the whole function because it both changes the graph (requires a writer lock) and does I/O (requires a reader lock). Therefore,

[PULL 02/28] block: add missing coroutine_fn annotations

2023-05-10 Thread Kevin Wolf
From: Paolo Bonzini After the recent introduction of many new coroutine callbacks, a couple calls from non-coroutine_fn to coroutine_fn have sneaked in; fix them. Signed-off-by: Paolo Bonzini Message-Id: <20230406101752.242125-1-pbonz...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by:

[PULL 04/28] block: Fix use after free in blockdev_mark_auto_del()

2023-05-10 Thread Kevin Wolf
job_cancel_locked() drops the job list lock temporarily and it may call aio_poll(). We must assume that the list has changed after this call. Also, with unlucky timing, it can end up freeing the job during job_completed_txn_abort_locked(), making the job pointer invalid, too. For both reasons, we

[PULL 28/28] block: compile out assert_bdrv_graph_readable() by default

2023-05-10 Thread Kevin Wolf
From: Stefan Hajnoczi reader_count() is a performance bottleneck because the global aio_context_list_lock mutex causes thread contention. Put this debugging assertion behind a new ./configure --enable-debug-graph-lock option and disable it by default. The --enable-debug-graph-lock option is

[PULL 07/28] qcow2: Don't call bdrv_getlength() in coroutine_fns

2023-05-10 Thread Kevin Wolf
There is a bdrv_co_getlength() now, which should be used in coroutine context. This requires adding GRAPH_RDLOCK to some functions so that this still compiles with TSA because bdrv_co_getlength() is GRAPH_RDLOCK. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi

[PULL 05/28] iotests/nbd-reconnect-on-open: Fix NBD socket path

2023-05-10 Thread Kevin Wolf
Socket paths need to be short to avoid failures. This is why there is a iotests.sock_dir (defaulting to /tmp) separate from the disk image base directory. Make use of it to fix failures in too deeply nested test directories. Fixes: ab7f7e67a7e7b49964109501dfcde4ec29bae60e Signed-off-by: Kevin

[PULL 23/28] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK

2023-05-10 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito This adds GRAPH_RDLOCK annotations to declare that callers of amend callbacks in BlockDriver need to hold a reader lock for the graph. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi

[PULL 06/28] migration: Attempt disk reactivation in more failure scenarios

2023-05-10 Thread Kevin Wolf
From: Eric Blake Commit fe904ea824 added a fail_inactivate label, which tries to reactivate disks on the source after a failure while s->state == MIGRATION_STATUS_ACTIVE, but didn't actually use the label if qemu_savevm_state_complete_precopy() failed. This failure to reactivate is also present

[PULL 08/28] block: Consistently call bdrv_activate() outside coroutine

2023-05-10 Thread Kevin Wolf
Migration code can call bdrv_activate() in coroutine context, whereas other callers call it outside of coroutines. As it calls other code that is not supposed to run in coroutines, standardise on running outside of coroutines. This adds a no_co_wrapper to switch to the main loop before calling

Re: [PATCH v8 5/5] blockdev: qmp_transaction: drop extra generic layer

2023-05-10 Thread Kevin Wolf
Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: > Let's simplify things: > > First, actions generally don't need access to common BlkActionState > structure. The only exclusion are backup actions that need > block_job_txn. > > Next, for transaction actions of Transaction API

Re: [PATCH v8 4/5] blockdev: transaction: refactor handling transaction properties

2023-05-10 Thread Kevin Wolf
Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: > Only backup supports GROUPED mode. Make this logic more clear. And > avoid passing extra thing to each action. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- > blockdev.c | 92

Re: [PATCH v8 3/5] blockdev: qmp_transaction: refactor loop to classic for

2023-05-10 Thread Kevin Wolf
Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: > Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Kevin Wolf

Re: [PATCH v8 2/5] blockdev: transactions: rename some things

2023-05-10 Thread Kevin Wolf
Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: > Look at qmp_transaction(): dev_list is not obvious name for list of > actions. Let's look at qapi spec, this argument is "actions". Let's > follow the common practice of using same argument names in qapi scheme > and code. > >

Re: [PATCH v8 1/5] blockdev: refactor transaction to use Transaction API

2023-05-10 Thread Kevin Wolf
Am 21.04.2023 um 13:53 hat Vladimir Sementsov-Ogievskiy geschrieben: > We are going to add more block-graph modifying transaction actions, > and block-graph modifying functions are already based on Transaction > API. > > Next, we'll need to separately update permissions after several >

Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson
On 5/9/23 20:17, Juan Quintela wrote: The following changes since commit 271477b59e723250f17a7e20f139262057921b6a: Merge tag 'compression-code-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-05-08 20:38:05 +0100) are available in the Git repository at:

Re: [PATCH v2] piix: fix regression during unplug in Xen HVM domUs

2023-05-10 Thread Olaf Hering
Wed, 10 May 2023 00:58:27 +0200 Olaf Hering : > In my debugging (with v8.0.0) it turned out the three pci_set_word > causes the domU to hang. In fact, it is just the last one: > >pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */ > > It changes the value from 0xc121 to 0x1. If I

Re: [PATCH 12/17] qapi: Rewrite parsing of doc comment section symbols and tags

2023-05-10 Thread Markus Armbruster
Markus Armbruster writes: > To recognize a line starting with a section symbol and or tag, we > first split it at the first space, then examine the part left of the > space. We can just as well examine the unsplit line, so do that. > > Signed-off-by: Markus Armbruster > --- >

Re: [PATCH] migration: for snapshots, hold the BQL during setup callbacks

2023-05-10 Thread Juan Quintela
Peter Xu wrote: Hi [Adding Kevin to the party] > On Fri, May 05, 2023 at 03:46:52PM +0200, Fiona Ebner wrote: >> To fix it, ensure that the BQL is held during setup. To avoid changing >> the behavior for migration too, introduce conditionals for the setup >> callbacks that need the BQL and