From: Kevin Wolf <kwolf@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Hanna Reitz" <hreitz@redhat.com>,
qemu-block@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Fam Zheng" <fam@euphon.net>, "Denis V. Lunev" <den@openvz.org>,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
"Greg Kurz" <groug@kaod.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Anthony PERARD" <anthony@xenproject.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
xen-devel@lists.xenproject.org,
"Li Zhijian" <lizhijian@fujitsu.com>
Subject: Re: [PATCH 6/8] block: add missing coroutine_fn annotations
Date: Fri, 24 Jul 2026 15:19:45 +0200 [thread overview]
Message-ID: <amNmcTIfZT0OFpkB@redhat.com> (raw)
In-Reply-To: <20260720-co-v1-6-fabb4db3c204@redhat.com>
Am 20.07.2026 um 09:55 hat Marc-André Lureau geschrieben:
> The functions call coroutine functions or are called by coroutine.
That it's called only by coroutines isn't a reason to make a function
coroutine_fn as long as it theoretically could be called by
non-coroutine code and it would still work fine (i.e. it doesn't yield).
> Add an assert() in qcow2_do_close() code path which calls a
> no_coroutine_fn bdrv_graph_wrlock_drained().
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> diff --git a/block/parallels.c b/block/parallels.c
> index 7a90fb5220b..46a6e8f2743 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -142,8 +142,9 @@ static uint32_t host_cluster_index(BDRVParallelsState *s, int64_t off)
> return off / s->cluster_size;
> }
>
> -static int64_t block_status(BDRVParallelsState *s, int64_t sector_num,
> - int nb_sectors, int *pnum)
> +static int64_t coroutine_fn
> +block_status(BDRVParallelsState *s, int64_t sector_num,
> + int nb_sectors, int *pnum)
> {
> int64_t start_off = -2, prev_end_off = -2;
>
Specifically this hunk is unclear to me.
As far as I can see, block_status() can't yield. Why did you add the
coroutine_fn marker here, but not e.g. for seek_to_sector() or
cluster_remainder(), which are only called by block_status() and
therefore also always only in coroutine context?
I believe the right way to stay consistent is to leave all of them
unmarked because there is no fundamental reason why they would only make
sense in coroutine context.
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 19271b10a49..161626fa3cb 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -1287,9 +1287,10 @@ fail:
> }
>
> /* s_locked specifies whether s->lock is held or not */
> -static void qcow2_update_options_commit(BlockDriverState *bs,
> - Qcow2ReopenState *r,
> - bool s_locked)
> +static void coroutine_fn
> +qcow2_update_options_commit(BlockDriverState *bs,
> + Qcow2ReopenState *r,
> + bool s_locked)
> {
> BDRVQcow2State *s = bs->opaque;
> int i;
> @@ -2126,7 +2127,8 @@ fail:
> return ret;
> }
>
> -static void qcow2_reopen_commit(BDRVReopenState *state)
> +static void coroutine_fn
> +qcow2_reopen_commit(BDRVReopenState *state)
> {
> BDRVQcow2State *s = state->bs->opaque;
>
This doesn't match the declaration of the .bdrv_reopen_commit callback
in BlockDriver, and as far as I can see, the callers are actually
guaranteed to _not_ be in coroutine context.
If this is true, qcow2_update_options_commit() should probably be marked
coroutine_mixed_fn and this one stay unannotated or no_coroutine_fn.
The other parts of the patch looks correct.
Kevin
next prev parent reply other threads:[~2026-07-24 13:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 7:55 [PATCH 0/8] coroutine: add missing annotations Marc-André Lureau
2026-07-20 7:55 ` [PATCH 1/8] monitor: annotate monitor_qmp_dispatcher_pop_any() as coroutine Marc-André Lureau
2026-07-20 12:34 ` Markus Armbruster
2026-07-20 14:26 ` Philippe Mathieu-Daudé
2026-07-20 7:55 ` [PATCH 2/8] migration: fix qemu_get_counted_string annotation Marc-André Lureau
2026-07-20 14:09 ` Peter Xu
2026-07-20 14:27 ` Philippe Mathieu-Daudé
2026-07-20 7:55 ` [PATCH 3/8] io: add missing coroutine annotation Marc-André Lureau
2026-07-20 14:28 ` Philippe Mathieu-Daudé
2026-07-20 7:55 ` [PATCH 4/8] block: " Marc-André Lureau
2026-07-20 14:28 ` Philippe Mathieu-Daudé
2026-07-24 13:21 ` Kevin Wolf
2026-07-20 7:55 ` [PATCH 5/8] qcow2: remove invalid qcow2_check_refcounts calls Marc-André Lureau
2026-07-20 20:57 ` Philippe Mathieu-Daudé
2026-07-20 7:55 ` [PATCH 6/8] block: add missing coroutine_fn annotations Marc-André Lureau
2026-07-20 20:58 ` Philippe Mathieu-Daudé
2026-07-22 17:19 ` Denis V. Lunev
2026-07-24 13:19 ` Kevin Wolf [this message]
2026-07-20 7:55 ` [PATCH 7/8] hw/9pfs: annotate V9fsTransport callbacks as coroutine_fn Marc-André Lureau
2026-07-20 14:02 ` Christian Schoenebeck
2026-07-20 20:42 ` Philippe Mathieu-Daudé
2026-07-20 20:54 ` Philippe Mathieu-Daudé
2026-07-21 7:58 ` Marc-André Lureau
2026-07-21 8:06 ` Marc-André Lureau
2026-07-21 8:25 ` Philippe Mathieu-Daudé
2026-07-21 8:37 ` Christian Schoenebeck
2026-07-21 8:39 ` Marc-André Lureau
2026-07-21 8:50 ` Christian Schoenebeck
2026-07-20 7:55 ` [PATCH 8/8] migration/rdma: annotate and simplify wait_comp_channel() Marc-André Lureau
2026-07-20 14:13 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amNmcTIfZT0OFpkB@redhat.com \
--to=kwolf@redhat.com \
--cc=anthony@xenproject.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=den@openvz.org \
--cc=edgar.iglesias@gmail.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=groug@kaod.org \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=lizhijian@fujitsu.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=sstabellini@kernel.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.