qemu-e2k/include
Emanuele Giuseppe Esposito c86422c554 block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed
BlockDriver->bdrv_getlength is categorized as IO callback, and it
currently doesn't run in a coroutine. We should let it take a graph
rdlock since the callback traverses the block nodes graph, which however
is only possible in a coroutine.

Therefore turn it into a co_wrapper to move the actual function into a
coroutine where the lock can be taken.

Because now this function creates a new coroutine and polls, we need to
take the AioContext lock where it is missing, for the only reason that
internally co_wrapper calls AIO_WAIT_WHILE and it expects to release the
AioContext lock.

This is especially messy when a co_wrapper creates a coroutine and polls
in bdrv_open_driver, because this function has so many callers in so
many context that it can easily lead to deadlocks. Therefore the new
rule for bdrv_open_driver is that the caller must always hold the
AioContext lock of the given bs (except if it is a coroutine), because
the function calls bdrv_refresh_total_sectors() which is now a
co_wrapper.

Once the rwlock is ultimated and placed in every place it needs to be,
we will poll using AIO_WAIT_WHILE_UNLOCKED and remove the AioContext
lock.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230113204212.359076-7-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-02-01 16:52:32 +01:00
..
authz
block block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed 2023-02-01 16:52:32 +01:00
chardev
crypto crypto: Support export akcipher to pkcs8 2022-11-02 06:56:32 -04:00
disas
exec tcg: Fix race conditions in (most) goto_tb implementations 2023-01-19 11:56:51 +00:00
fpu
hw virtio-blk: simplify virtio_blk_dma_restart_cb() 2023-01-23 15:01:23 -05:00
io coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h 2023-01-20 07:21:46 +01:00
libdecnumber
migration
monitor Header cleanup patches for 2023-01-20 2023-01-20 13:17:55 +00:00
net virtio-net: add support for configure interrupt 2023-01-08 01:54:22 -05:00
qapi
qemu block: Add no_coroutine_fn and coroutine_mixed_fn marker 2023-01-24 18:26:41 +01:00
qom
scsi coroutine: Clean up superfluous inclusion of qemu/coroutine.h 2023-01-19 10:18:28 +01:00
semihosting
standard-headers
sysemu block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed 2023-02-01 16:52:32 +01:00
tcg tcg: Move tb_target_set_jmp_target declaration to tcg.h 2023-01-17 10:22:35 -10:00
ui ui: Split hmp_mouse_set() and move the HMP part to ui/ 2023-01-19 13:30:01 +01:00
user include: Include headers where needed 2023-01-08 01:54:22 -05:00
elf.h
glib-compat.h
qemu-io.h
qemu-main.h