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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
river callbacks for updating permissions and annotate the function > pointers with GRAPH_RDLOCK_PTR. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
niently already hold the lock. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
y can't call functions that take it > internally. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
in Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
y can't call functions that take it internally. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
t they can't call functions that take it > internally. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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

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

2023-08-21 Thread Emanuele Giuseppe Esposito
t they can't call functions that take it > internally. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
e transaction > callbacks can be changed, too. > > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito

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

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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: Emanuele Giuseppe Esposito

Re: [PATCH 02/21] preallocate: Factor out preallocate_truncate_to_real_size()

2023-08-21 Thread Emanuele Giuseppe Esposito
Am 17/08/2023 um 14:50 schrieb 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: Emanuele Giuseppe Esposito

Re: [PATCH 0/2] target/i386: add support for cpu FLUSH_L1D feature and FB_CLEAR capability

2023-05-08 Thread Emanuele Giuseppe Esposito
Ping? Am 01/02/2023 um 14:57 schrieb Emanuele Giuseppe Esposito: > QEMU should be able to show the guest the above feature/capability, > otherwise we risk to have false vulnerability reports in the guest like in > /sys/devices/system/cpu/vulnerabilities/mmio_stale_data > because th

[PATCH v2] tests/unit/test-blockjob: Re-enable complete_in_standby test

2023-04-26 Thread Emanuele Giuseppe Esposito
(). Fixes: b6903cbe3a2 "tests/unit/test-blockjob: Disable complete_in_standby test" Suggested-by: Hanna Czenczek Signed-off-by: Emanuele Giuseppe Esposito --- tests/unit/test-blockjob.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/unit/test-bl

Re: [PATCH] tests/unit/test-blockjob: Re-enable complete_in_standby test

2023-04-26 Thread Emanuele Giuseppe Esposito
Am 26/04/2023 um 10:45 schrieb Thomas Huth: > On 26/04/2023 10.16, Emanuele Giuseppe Esposito wrote: >> Pause the job while draining so that pause_count will be >> increased and bdrv_drain_all_end() won't reset it to 0, so the >> job will not continue. >> >> Wit

Re: test-blockjob: intermittent CI failures in msys2-64bit job

2023-04-26 Thread Emanuele Giuseppe Esposito
Am 26/04/2023 um 10:03 schrieb Hanna Czenczek: > On 26.04.23 09:38, Emanuele Giuseppe Esposito wrote: >> >> Am 25/04/2023 um 18:48 schrieb Hanna Czenczek: >>> On 24.04.23 20:32, Vladimir Sementsov-Ogievskiy wrote: >>>> On 24.04.23 16:36, Emanuele Giuseppe

[PATCH] tests/unit/test-blockjob: Re-enable complete_in_standby test

2023-04-26 Thread Emanuele Giuseppe Esposito
(). Fixes: b6903cbe3a2 "tests/unit/test-blockjob: Disable complete_in_standby test" Suggested-by: Hanna Czenczek Signed-off-by: Emanuele Giuseppe Esposito --- tests/unit/test-blockjob.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/unit/test-bl

Re: test-blockjob: intermittent CI failures in msys2-64bit job

2023-04-26 Thread Emanuele Giuseppe Esposito
Am 25/04/2023 um 18:48 schrieb Hanna Czenczek: > On 24.04.23 20:32, Vladimir Sementsov-Ogievskiy wrote: >> On 24.04.23 16:36, Emanuele Giuseppe Esposito wrote: >>> >>> >>> Am 21/04/2023 um 12:13 schrieb Vladimir Sementsov-Ogievskiy: >>>> On 17.03.

Re: test-blockjob: intermittent CI failures in msys2-64bit job

2023-04-24 Thread Emanuele Giuseppe Esposito
Am 21/04/2023 um 12:13 schrieb Vladimir Sementsov-Ogievskiy: > On 17.03.23 15:35, Thomas Huth wrote: >> On 17/03/2023 11.17, Peter Maydell wrote: >>> On Mon, 6 Mar 2023 at 11:16, Peter Maydell >>> wrote: On Fri, 3 Mar 2023 at 18:36, Peter Maydell wrote: > > I've noticed

Re: [PATCH v2] block/monitor/block-hmp-cmds.c: Fix crash when execute hmp_commit

2023-04-24 Thread Emanuele Giuseppe Esposito
AIO_WAIT_WHILE(), > which crashes if the aio_context lock is not taken before. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1615 > Signed-off-by: Wang Liang > Thanks! Reviewed-by: Emanuele Giuseppe Esposito

Re: [PATCH] block/monitor/block-hmp-cmds.c: Fix crash when execute hmp_commit

2023-04-24 Thread Emanuele Giuseppe Esposito
Am 24/04/2023 um 10:15 schrieb Emanuele Giuseppe Esposito: > > > Am 23/04/2023 um 13:02 schrieb wanglian...@126.com: >> From: Wang Liang >> >> We need to get the aio_context before calling the blk_is_available. >> >> Resolves: https://gitlab.com/qemu-p

Re: [PATCH] block/monitor/block-hmp-cmds.c: Fix crash when execute hmp_commit

2023-04-24 Thread Emanuele Giuseppe Esposito
Am 23/04/2023 um 13:02 schrieb wanglian...@126.com: > From: Wang Liang > > We need to get the aio_context before calling the blk_is_available. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1615 > Signed-off-by: Wang Liang > Reviewed-by: Emanuele Giuseppe Esposito

Re: [PATCH] aio-wait: avoid AioContext lock in aio_wait_bh_oneshot()

2023-04-05 Thread Emanuele Giuseppe Esposito
n Hajnoczi > Reviewed-by: Emanuele Giuseppe Esposito

Re: [PATCH for-8.0] block/export: Fix graph locking in blk_get_geometry() call

2023-03-27 Thread Emanuele Giuseppe Esposito
> it). > > Fixes: 8ab8140a04cf771d63e9754d6ba6c1e676bfe507 > Reported-by: Lukáš Doktor > Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito > --- > include/block/block-io.h | 4 +++- > include/sysemu/block-backend-io.h | 5 - > block.c

Re: [PATCH 00/23] block: Lock the graph, part 2 (BlockDriver callbacks)

2023-02-17 Thread Emanuele Giuseppe Esposito
back theme), are ready and their number looks > manageable. You will still see some FIXMEs at the end of the series > that will only be addressed in future patches. Reviewed-by: Emanuele Giuseppe Esposito > > Emanuele Giuseppe Esposito (5): > block/qed: add missing graph rdlock

[PATCH] block/file-posix: don't use functions calling AIO_WAIT_WHILE in worker threads

2023-02-09 Thread Emanuele Giuseppe Esposito
thread and is not protected by any lock. Replace it with raw_co_getlength, that doesn't create a coroutine and doesn't read the BDS graph. Signed-off-by: Emanuele Giuseppe Esposito --- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b

Re: rainier-bmc machine dumping core with latest qemu

2023-02-09 Thread Emanuele Giuseppe Esposito
Adding Kevin too. I can't reproduce your issue. I tried the exact steps showed in your mail, both with BLD_VERSION=20230205025034 (not anymore latest compose) and BLD_VERSION=20230209025037 (currently latest), and the VM boots till the login screen. Talking with Kevin it looks like

[PATCH] virtio-blk: add missing AioContext lock

2023-02-08 Thread Emanuele Giuseppe Esposito
quot;:true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ -device virtio-blk-pci,iothread=iothread1,drive=libvirt-1-format,id=virtio-disk0,bootindex=1,write-cache=on and observe that it will fail not manage to boot with "qemu_mutex_unlock_

[PATCH v5 1/4] linux-aio: use LinuxAioState from the running thread

2023-02-03 Thread Emanuele Giuseppe Esposito
in the current thread's AioContext. Signed-off-by: Emanuele Giuseppe Esposito --- include/block/aio.h | 4 include/block/raw-aio.h | 18 -- include/sysemu/block-backend-io.h | 6 ++ block/file-posix.c| 10 +++--- block/linux-aio.c

[PATCH v5 3/4] thread-pool: use ThreadPool from the running thread

2023-02-03 Thread Emanuele Giuseppe Esposito
Use qemu_get_current_aio_context() where possible, since we always submit work to the current thread anyways. We want to also be sure that the thread submitting the work is the same as the one processing the pool, to avoid adding synchronization to the pool list. Signed-off-by: Emanuele Giuseppe

[PATCH v5 2/4] io_uring: use LuringState from the running thread

2023-02-03 Thread Emanuele Giuseppe Esposito
in the current thread's AioContext. Signed-off-by: Emanuele Giuseppe Esposito --- include/block/aio.h | 4 include/block/raw-aio.h | 15 +++ block/file-posix.c | 12 block/io_uring.c| 23 +++ 4 files changed, 30 insertions(+), 24

[PATCH v5 0/4] AioContext removal: LinuxAioState and ThreadPool

2023-02-03 Thread Emanuele Giuseppe Esposito
thread_pool_submit* * document that functions run in current IOThread v4: * add missing aio_context removal, and fix typo v3: * remove qemu_coroutine_enter_if_inactive v2: * assertion in thread_pool * remove useless BlockDriverState * param in patch 1 and 2 * io_uring cleaned too Emanuele Giuseppe Esposito (4

[PATCH v5 4/4] thread-pool: avoid passing the pool parameter every time

2023-02-03 Thread Emanuele Giuseppe Esposito
the ThreadPool function parameter. Signed-off-by: Emanuele Giuseppe Esposito --- include/block/thread-pool.h | 10 -- backends/tpm/tpm_backend.c| 4 +--- block/file-posix.c| 4 +--- block/file-win32.c| 4 +--- block/qcow2-threads.c | 3 +-- hw/9pfs/coth.c

[PATCH 1/2] target/i386: add support for FLUSH_L1D feature

2023-02-01 Thread Emanuele Giuseppe Esposito
ys/devices/system/cpu/vulnerabilities/mmio_stale_data because the mitigation is present only when the cpu has (FLUSH_L1D and MD_CLEAR) or FB_CLEAR features enabled. Signed-off-by: Emanuele Giuseppe Esposito --- target/i386/cpu.h | 2 ++ target/i386/cpu.c | 2 +- 2 files changed, 3 insert

[PATCH 0/2] target/i386: add support for cpu FLUSH_L1D feature and FB_CLEAR capability

2023-02-01 Thread Emanuele Giuseppe Esposito
. Emanuele Emanuele Giuseppe Esposito (2): target/i386: add support for FLUSH_L1D feature target/i386: add support for FB_CLEAR feature target/i386/cpu.h | 3 +++ target/i386/cpu.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) -- 2.39.1

[PATCH 2/2] target/i386: add support for FB_CLEAR feature

2023-02-01 Thread Emanuele Giuseppe Esposito
es enabled. Signed-off-by: Emanuele Giuseppe Esposito --- target/i386/cpu.h | 1 + target/i386/cpu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 4948130900..68a6ded0d7 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -97

Re: [PATCH 00/13] block: Fix bdrv_open*() calls from coroutine context

2023-01-27 Thread Emanuele Giuseppe Esposito
k: Fix bdrv_co_create_opts_simple() to open images with > no_co_wrapper > block: Assert non-coroutine context for bdrv_open_inherit() > Apart from a small nitpick in patch 3 where the functions are not marked as coroutine_fn (but I think this is because BDS callbacks usually don'

Re: [PATCH 2/3] bsd-user/mmap: use TSA_NO_TSA to suppress clang TSA warnings

2023-01-18 Thread Emanuele Giuseppe Esposito
Am 17/01/2023 um 18:17 schrieb Kevin Wolf: > Am 17.01.2023 um 17:43 hat Warner Losh geschrieben: >> On Tue, Jan 17, 2023 at 9:25 AM Kevin Wolf wrote: >> >>> Am 17.01.2023 um 17:16 hat Warner Losh geschrieben: >>>> On Tue, Jan 17, 2023 at 6:52 AM Ema

Re: [PATCH 2/3] bsd-user/mmap: use TSA_NO_TSA to suppress clang TSA warnings

2023-01-17 Thread Emanuele Giuseppe Esposito
Am 17/01/2023 um 17:16 schrieb Warner Losh: > > > On Tue, Jan 17, 2023 at 6:52 AM Emanuele Giuseppe Esposito > mailto:eespo...@redhat.com>> wrote: > > QEMU does not compile when enabling clang's thread safety analysis > (TSA), > because some functio

Re: [PATCH 1/3] util/qemu-thread-posix: use TSA_NO_TSA to suppress clang TSA warnings

2023-01-17 Thread Emanuele Giuseppe Esposito
Am 17/01/2023 um 15:33 schrieb Philippe Mathieu-Daudé: > On 17/1/23 14:52, Emanuele Giuseppe Esposito wrote: >> QEMU does not compile when enabling clang's thread safety analysis >> (TSA), >> because some functions create wrappers for pthread mutexes but do >> not u

Re: [PATCH 3/3] configure: Enable -Wthread-safety if present

2023-01-17 Thread Emanuele Giuseppe Esposito
Am 17/01/2023 um 15:02 schrieb Daniel P. Berrangé: > On Tue, Jan 17, 2023 at 08:52:03AM -0500, Emanuele Giuseppe Esposito wrote: >> From: Kevin Wolf >> >> This enables clang's thread safety analysis (TSA), which we'll use to >> statically check the block grap

[PATCH 3/3] configure: Enable -Wthread-safety if present

2023-01-17 Thread Emanuele Giuseppe Esposito
From: Kevin Wolf This enables clang's thread safety analysis (TSA), which we'll use to statically check the block graph locking. Signed-off-by: Kevin Wolf Message-Id: <20221207131838.239125-9-kw...@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito Signed-off-by: Kevin Wolf --- con

[PATCH 1/3] util/qemu-thread-posix: use TSA_NO_TSA to suppress clang TSA warnings

2023-01-17 Thread Emanuele Giuseppe Esposito
functions should use TSA_ACQUIRE, while unlock TSA_RELEASE, and this applies to all users of pthread_mutex_lock/pthread_mutex_unlock), simply use TSA_NO_TSA to supppress such warnings. Signed-off-by: Emanuele Giuseppe Esposito --- include/qemu/thread.h| 14 +- util/qemu-thread-posix.c

[PATCH 2/3] bsd-user/mmap: use TSA_NO_TSA to suppress clang TSA warnings

2023-01-17 Thread Emanuele Giuseppe Esposito
functions should use TSA_ACQUIRE, while unlock TSA_RELEASE, and this applies to allusers of pthread_mutex_lock/pthread_mutex_unlock), simply use TSA_NO_TSA to supppress such warnings. Signed-off-by: Emanuele Giuseppe Esposito --- bsd-user/qemu.h | 5 +++-- include/exec/exec-all.h | 5 +++-- 2

[PATCH 0/3] TSA: make sure QEMU compiles when using clang TSA

2023-01-17 Thread Emanuele Giuseppe Esposito
/qemu-devel/2022-12/msg00903.html Emanuele Giuseppe Esposito (2): util/qemu-thread-posix: use TSA_NO_TSA to suppress clang TSA warnings bsd-user/mmap: use TSA_NO_TSA to suppress clang TSA warnings Kevin Wolf (1): configure: Enable -Wthread-safety if present configure| 1 + bsd

Re: [PATCH v2 00/14] block: Move more functions to coroutines

2023-01-16 Thread Emanuele Giuseppe Esposito
n earlier. > - Since pretty much every patch was touched in this, I refrained from > picking up any Reviewed-by for v1 > Reviewed-by: Emanuele Giuseppe Esposito > Emanuele Giuseppe Esposito (14): > block-coroutine-wrapper: support void functions > block: Conve

Re: [PATCH 06/14] block-backend: use bdrv_getlength instead of blk_getlength

2022-12-19 Thread Emanuele Giuseppe Esposito
Am 16/12/2022 um 18:22 schrieb Vladimir Sementsov-Ogievskiy: > On 12/13/22 11:53, Kevin Wolf wrote: >> From: Emanuele Giuseppe Esposito >> >> The only difference is that blk_ checks if the block is available, >> but this check is already performed abov

Re: [PATCH 02/14] block: Convert bdrv_io_plug() to co_wrapper

2022-12-19 Thread Emanuele Giuseppe Esposito
Am 16/12/2022 um 17:12 schrieb Vladimir Sementsov-Ogievskiy: > On 12/13/22 11:53, Kevin Wolf wrote: >> --- a/include/block/block_int-common.h >> +++ b/include/block/block_int-common.h >> @@ -729,7 +729,7 @@ struct BlockDriver { >>   void (*bdrv_debug_event)(BlockDriverState *bs,

Re: [PATCH 02/14] block: Convert bdrv_io_plug() to co_wrapper

2022-12-19 Thread Emanuele Giuseppe Esposito
Am 16/12/2022 um 15:26 schrieb Vladimir Sementsov-Ogievskiy: > On 12/13/22 11:53, Kevin Wolf wrote: >> From: Emanuele Giuseppe Esposito >> >> BlockDriver->bdrv_io_plug is categorized as IO callback, and it >> currently doesn't run in a coroutine. We should let i

Re: [PATCH 00/14] block: Move more functions to coroutines

2022-12-15 Thread Emanuele Giuseppe Esposito
Converting functions to coroutine_fn, and adding the locking to > them. This series does only the coroutine conversion. The locking part > will be in another series which now comes with TSA annotations and makes > the locking related changes big enough to have separate patches. > Rev

Re: [RFC PATCH] test-bdrv-drain: keep graph manipulations out of coroutines

2022-12-09 Thread Emanuele Giuseppe Esposito
Am 09/12/2022 um 13:18 schrieb Emanuele Giuseppe Esposito: > > > Am 05/12/2022 um 14:01 schrieb Kevin Wolf: >> Am 02.12.2022 um 18:22 hat Paolo Bonzini geschrieben: >>> On 12/2/22 14:42, Emanuele Giuseppe Esposito wrote: >>>> >>>> &

Re: [RFC PATCH] test-bdrv-drain: keep graph manipulations out of coroutines

2022-12-09 Thread Emanuele Giuseppe Esposito
Am 05/12/2022 um 14:01 schrieb Kevin Wolf: > Am 02.12.2022 um 18:22 hat Paolo Bonzini geschrieben: >> On 12/2/22 14:42, Emanuele Giuseppe Esposito wrote: >>> >>> >>> Am 02/12/2022 um 14:27 schrieb Paolo Bonzini: >>>> Changes to the BlockDriverStat

Re: [PATCH 00/18] block: Introduce a block graph rwlock

2022-12-07 Thread Emanuele Giuseppe Esposito
onfigure: Enable -Wthread-safety if present > test-bdrv-drain: Fix incorrrect drain assumptions > block: Fix locking in external_snapshot_prepare() > graph-lock: TSA annotations for lock/unlock functions > Mark assert_bdrv_graph_readable/writable() GRAPH_RD/WRLOCK >

Re: [RFC PATCH] test-bdrv-drain: keep graph manipulations out of coroutines

2022-12-05 Thread Emanuele Giuseppe Esposito
Am 02/12/2022 um 18:22 schrieb Paolo Bonzini: > On 12/2/22 14:42, Emanuele Giuseppe Esposito wrote: >> >> >> Am 02/12/2022 um 14:27 schrieb Paolo Bonzini: >>> Changes to the BlockDriverState graph will have to take the >>> corresponding lock for writing,

[PATCH 1/2] test-bdrv-drain.c: remove test_detach_by_parent_cb()

2022-12-05 Thread Emanuele Giuseppe Esposito
explained above I believe that it is not valid anymore, and can be discarded. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- tests/unit/test-bdrv-drain.c | 41 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/tests/unit

[PATCH 2/2] tests/unit/test-bdrv-drain.c: graph setup functions can't run in coroutines

2022-12-05 Thread Emanuele Giuseppe Esposito
that we are not in a coroutine. Move the initialization phase of test_drv_cb and test_quiesce_common outside the coroutine logic. Signed-off-by: Emanuele Giuseppe Esposito --- tests/unit/test-bdrv-drain.c | 118 ++- 1 file changed, 73 insertions(+), 45 deletions

[PATCH 0/2] Fixes to test-bdrv-drain unit test

2022-12-05 Thread Emanuele Giuseppe Esposito
Thank you, Emanuele Emanuele Giuseppe Esposito (2): test-bdrv-drain.c: remove test_detach_by_parent_cb() tests/unit/test-bdrv-drain.c: graph setup functions can't run in coroutines tests/unit/test-bdrv-drain.c | 159 ++- 1 file changed, 82 inserti

Re: [PATCH v3 2/3] KVM: keep track of running ioctls

2022-12-02 Thread Emanuele Giuseppe Esposito
Am 02/12/2022 um 14:32 schrieb Robert Hoo: > On Fri, 2022-12-02 at 13:03 +0100, Emanuele Giuseppe Esposito wrote: > ... >>>> @@ -3032,7 +3035,9 @@ int kvm_vcpu_ioctl(CPUState *cpu, int type, >>>> ...) >>>> va_end(ap); >>>> &g

Re: [RFC PATCH] test-bdrv-drain: keep graph manipulations out of coroutines

2022-12-02 Thread Emanuele Giuseppe Esposito
Am 02/12/2022 um 14:27 schrieb Paolo Bonzini: > Changes to the BlockDriverState graph will have to take the > corresponding lock for writing, and therefore cannot be done > inside a coroutine. Move them outside the test body. > > Signed-off-by: Paolo Bonzini > --- >

Re: [PATCH v3 2/3] KVM: keep track of running ioctls

2022-12-02 Thread Emanuele Giuseppe Esposito
Am 02/12/2022 um 07:54 schrieb Robert Hoo: > On Fri, 2022-11-11 at 10:47 -0500, Emanuele Giuseppe Esposito wrote: >> Using the new accel-blocker API, mark where ioctls are being called >> in KVM. Next, we will implement the critical section that will take >> care o

[PATCH v7 13/14] block: convert bdrv_create to co_wrapper

2022-11-28 Thread Emanuele Giuseppe Esposito
This function is never called in coroutine context, therefore instead of manually creating a new coroutine, delegate it to the block-coroutine-wrapper script, defining it as co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy

[PATCH v7 09/14] block: rename generated_co_wrapper in co_wrapper_mixed

2022-11-28 Thread Emanuele Giuseppe Esposito
In preparation to the incoming new function specifiers, rename g_c_w with a more meaningful name and document it. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/block-coroutine-wrapper.rst | 6 +-- block/coroutines.h | 4

[PATCH v7 12/14] block-coroutine-wrapper.py: support also basic return types

2022-11-28 Thread Emanuele Giuseppe Esposito
Extend the regex to cover also return type, pointers included. This implies that the value returned by the function cannot be a simple "int" anymore, but the custom return type. Therefore remove poll_state->ret and instead use a per-function custom "ret" field. Signed-of

[PATCH v7 08/14] block: bdrv_create_file is a coroutine_fn

2022-11-28 Thread Emanuele Giuseppe Esposito
It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block-global-state.h | 3

[PATCH v7 04/14] block-backend: replace bdrv_*_above with blk_*_above

2022-11-28 Thread Emanuele Giuseppe Esposito
bdrv_co_common_block_status_above() to avoid using a g_c_w. Same applies to blk_co_is_allocated_above. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend-io.h | 9 + block/block-backend.c | 21 block/commit.c

[PATCH v7 02/14] block-copy: add coroutine_fn annotations

2022-11-28 Thread Emanuele Giuseppe Esposito
suspend (or in other words call qemu_coroutine_yield()). Therefore we can mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Paolo Bonzini Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block-copy.h | 5

[PATCH v7 14/14] block/dirty-bitmap: convert coroutine-only functions to co_wrapper

2022-11-28 Thread Emanuele Giuseppe Esposito
to c_w. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block-common.h | 5 +- include/block/block-io.h | 10 +++- include/block/dirty-bitmap.h | 10 +++- block/dirty-bitmap.c | 88

[PATCH v7 05/14] block/vmdk: add coroutine_fn annotations

2022-11-28 Thread Emanuele Giuseppe Esposito
suspend (or in other words call qemu_coroutine_yield()). Therefore we can mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Paolo Bonzini Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/vmdk.c | 36

[PATCH v7 10/14] block-coroutine-wrapper.py: introduce co_wrapper

2022-11-28 Thread Emanuele Giuseppe Esposito
the advantage of automating the code creation. In the future all c_w_mixed functions will be substituted by co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- docs/devel/block-coroutine-wrapper.rst | 6 +- include/block/block-common.h | 8

[PATCH v7 03/14] nbd/server.c: add coroutine_fn annotations

2022-11-28 Thread Emanuele Giuseppe Esposito
(or in other words call qemu_coroutine_yield()). Therefore we can mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Paolo Bonzini Reviewed-by: Vladimir Sementsov-Ogievskiy --- nbd/server.c | 29 - 1

[PATCH v7 11/14] block-coroutine-wrapper.py: support functions without bs arg

2022-11-28 Thread Emanuele Giuseppe Esposito
, and default to the main loop if no BlockDriverState is passed as parameter. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/block-gen.h | 6 +++--- scripts/block-coroutine-wrapper.py | 16 2 files changed, 11

[PATCH v7 01/14] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers

2022-11-28 Thread Emanuele Giuseppe Esposito
e wrappers that take care of directly calling the same coroutine functions called in the g_c_w. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- include/block/block-io.h | 15 +++ block/io.c

[PATCH v7 07/14] block: distinguish between bdrv_create running in coroutine and not

2022-11-28 Thread Emanuele Giuseppe Esposito
Call two different functions depending on whether bdrv_create is in coroutine or not, following the same pattern as generated_co_wrapper functions. This allows to also call the coroutine function directly, without using CreateCo or relying in bdrv_create(). Signed-off-by: Emanuele Giuseppe

[PATCH v7 06/14] block: avoid duplicating filename string in bdrv_create

2022-11-28 Thread Emanuele Giuseppe Esposito
We know that the string will stay around until the function returns, and the parameter of drv->bdrv_co_create_opts is const char*, so it must not be modified either. Suggested-by: Kevin Wolf Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir Sement

[PATCH v7 00/14] Still more coroutine and various fixes in block layer

2022-11-28 Thread Emanuele Giuseppe Esposito
ge in patches 2/3/6 on why we add coroutine_fn Emanuele Giuseppe Esposito (14): block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers block-copy: add coroutine_fn annotations nbd/server.c: add coroutine_fn annotations block-backend: replace bdrv_*_above w

Re: [PATCH v6 10/14] block-coroutine-wrapper.py: introduce co_wrapper

2022-11-28 Thread Emanuele Giuseppe Esposito
Am 25/11/2022 um 21:32 schrieb Vladimir Sementsov-Ogievskiy: > >>     class FuncDecl: >> -    def __init__(self, return_type: str, name: str, args: str) -> None: >> +    def __init__(self, return_type: str, name: str, args: str, >> + variant: str) -> None: > > I'd prefer

Re: [PATCH v6 07/14] block: distinguish between bdrv_create running in coroutine and not

2022-11-28 Thread Emanuele Giuseppe Esposito
Am 25/11/2022 um 19:03 schrieb Vladimir Sementsov-Ogievskiy: > On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: >> Call two different functions depending on whether bdrv_create >> is in coroutine or not, following the same pattern as >> generated_co_wrapper functio

[PATCH v6 06/14] block: avoid duplicating filename string in bdrv_create

2022-11-25 Thread Emanuele Giuseppe Esposito
We know that the string will stay around until the function returns, and the parameter of drv->bdrv_co_create_opts is const char*, so it must not be modified either. Suggested-by: Kevin Wolf Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c | 7 ++- 1 f

[PATCH v6 10/14] block-coroutine-wrapper.py: introduce co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
the advantage of automating the code creation. In the future all c_w_mixed functions will be substituted by co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- docs/devel/block-coroutine-wrapper.rst | 6 +- include/block/block-common.h | 8 +- scripts/block

[PATCH v6 14/14] block/dirty-bitmap: convert coroutine-only functions to co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
to c_w. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block/dirty-bitmap.c | 88 +--- block/meson.build| 1 + include/block/block-common.h | 5 +- include/block/block-io.h | 10 +++- include/block/dirty-bitmap.h | 10

[PATCH v6 00/14] Still more coroutine and various fixes in block layer

2022-11-25 Thread Emanuele Giuseppe Esposito
ge in patches 2/3/6 on why we add coroutine_fn Emanuele Giuseppe Esposito (14): block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers block-copy: add missing coroutine_fn annotations nbd/server.c: add missing coroutine_fn annotations block-backend: replace b

[PATCH v6 01/14] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers

2022-11-25 Thread Emanuele Giuseppe Esposito
e wrappers that take care of directly calling the same coroutine functions called in the g_c_w. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block/io.c | 58 +--- include/block/block-io.h | 15 +++ 2 files changed, 70

[PATCH v6 07/14] block: distinguish between bdrv_create running in coroutine and not

2022-11-25 Thread Emanuele Giuseppe Esposito
Call two different functions depending on whether bdrv_create is in coroutine or not, following the same pattern as generated_co_wrapper functions. This allows to also call the coroutine function directly, without using CreateCo or relying in bdrv_create(). Signed-off-by: Emanuele Giuseppe

[PATCH v6 11/14] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter

2022-11-25 Thread Emanuele Giuseppe Esposito
, and default to the main loop if no BlockDriverState is passed as parameter. Signed-off-by: Emanuele Giuseppe Esposito --- block/block-gen.h | 6 +++--- scripts/block-coroutine-wrapper.py | 16 2 files changed, 11 insertions(+), 11 deletions(-) diff --git

[PATCH v6 08/14] block: bdrv_create_file is a coroutine_fn

2022-11-25 Thread Emanuele Giuseppe Esposito
It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c| 5 +++-- block/crypto.c | 2

[PATCH v6 04/14] block-backend: replace bdrv_*_above with blk_*_above

2022-11-25 Thread Emanuele Giuseppe Esposito
bdrv_co_common_block_status_above() to avoid using a g_c_w. Same applies to blk_co_is_allocated_above. Signed-off-by: Emanuele Giuseppe Esposito --- block/block-backend.c | 21 block/commit.c| 4 ++-- include/sysemu/block-backend-io.h | 9 + nbd/server.c

[PATCH v6 03/14] nbd/server.c: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
(or in other words call qemu_coroutine_yield()). Therefore we need to mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Paolo Bonzini --- nbd/server.c | 29 - 1 file changed, 16 insertions(+), 13

[PATCH v6 05/14] block/vmdk: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
suspend (or in other words call qemu_coroutine_yield()). Therefore we need to mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Paolo Bonzini Reviewed-by: Kevin Wolf --- block/vmdk.c | 36 +++- 1 file changed, 19 insertions

[PATCH v6 12/14] block-coroutine-wrapper.py: support also basic return types

2022-11-25 Thread Emanuele Giuseppe Esposito
Extend the regex to cover also return type, pointers included. This implies that the value returned by the function cannot be a simple "int" anymore, but the custom return type. Therefore remove poll_state->ret and instead use a per-function custom "ret" field. Signed-of

[PATCH v6 09/14] block: rename generated_co_wrapper in co_wrapper_mixed

2022-11-25 Thread Emanuele Giuseppe Esposito
In preparation to the incoming new function specifiers, rename g_c_w with a more meaningful name and document it. Signed-off-by: Emanuele Giuseppe Esposito --- block/coroutines.h | 4 +- docs/devel/block-coroutine-wrapper.rst | 6 +-- include/block/block-common.h

[PATCH v6 13/14] block: convert bdrv_create to co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
This function is never called in coroutine context, therefore instead of manually creating a new coroutine, delegate it to the block-coroutine-wrapper script, defining it as co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c

[PATCH v6 02/14] block-copy: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
suspend (or in other words call qemu_coroutine_yield()). Therefore we need to mark such functions coroutine_fn too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Paolo Bonzini Reviewed-by: Kevin Wolf --- block/block-copy.c | 21 - include/block/block-copy.h

Re: [PATCH 00/15] Protect the block layer with a rwlock: part 3

2022-11-23 Thread Emanuele Giuseppe Esposito
Am 18/11/2022 um 11:57 schrieb Paolo Bonzini: > On 11/16/22 15:07, Emanuele Giuseppe Esposito wrote: >> Here we introduce generated_co_wrapper_simple, a simplification of >> g_c_w that >> only considers the case where the caller is not in a coroutine. >> This simplifi

[PATCH v5 12/15] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter

2022-11-23 Thread Emanuele Giuseppe Esposito
, and default to the main loop if no BlockDriverState is passed as parameter. Signed-off-by: Emanuele Giuseppe Esposito --- block/block-gen.h | 6 +++--- scripts/block-coroutine-wrapper.py | 14 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/block

[PATCH v5 13/15] block-coroutine-wrapper.py: support also basic return types

2022-11-23 Thread Emanuele Giuseppe Esposito
Extend the regex to cover also return type, pointers included. This implies that the value returned by the function cannot be a simple "int" anymore, but the custom return type. Therefore remove poll_state->ret and instead use a per-function custom "ret" field. Signed-of

  1   2   3   4   5   6   7   8   9   10   >