All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Emanuele Giuseppe Esposito <eesposit@redhat.com>,
	qemu-block@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	John Snow <jsnow@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	Eric Blake <eblake@redhat.com>, Fam Zheng <fam@euphon.net>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 2/9] block-copy: add missing coroutine_fn annotations
Date: Thu, 3 Nov 2022 19:06:53 +0100	[thread overview]
Message-ID: <Y2QDPXegFTdpBy6S@redhat.com> (raw)
In-Reply-To: <8f24c24c-ca61-108c-924b-39465a3c67fe@redhat.com>

Am 03.11.2022 um 17:56 hat Paolo Bonzini geschrieben:
> On 11/3/22 14:41, Emanuele Giuseppe Esposito wrote:
> > block_copy_reset_unallocated and block_copy_is_cluster_allocated are
> > only called by backup_run, a corotuine_fn itself.

s/corotuine_fn/coroutine_fn/

> > 
> > Same applies to block_copy_block_status, called by
> > block_copy_dirty_clusters.
> > 
> > Therefore mark them as coroutine too.
> > 
> > Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> 
> They don't need to be coroutine_fn.  coroutine_fn is needed if you call
> another coroutine_fn, but not if you _are only called_ by coroutine_fn.
> There is nothing in these functions that needs them to be called from a
> coroutine.
> 
> The only exception is qemu_coroutine_yield(), which is the only leaf
> coroutine_fn.

I think it can make sense to have coroutine_fn as a documentation for
things that are only ever called in a coroutine even if they could
theoretically also work outside of coroutine context.

Otherwise, when we want to introduce a coroutine_fn call somewhere, it's
not only less obvious that it's even possible to do, but we'll have to
add potentially many additional coroutine_fn annotations in the whole
call chain in an otherwise unrelated patch.

Kevin



  reply	other threads:[~2022-11-03 18:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 13:41 [PATCH 0/9] Still more coroutine and various fixes in block layer Emanuele Giuseppe Esposito
2022-11-03 13:41 ` [PATCH 1/9] block: call bdrv_co_drain_begin in a coroutine Emanuele Giuseppe Esposito
2022-11-03 17:05   ` Paolo Bonzini
2022-11-03 13:41 ` [PATCH 2/9] block-copy: add missing coroutine_fn annotations Emanuele Giuseppe Esposito
2022-11-03 16:56   ` Paolo Bonzini
2022-11-03 18:06     ` Kevin Wolf [this message]
2022-11-03 18:36       ` Paolo Bonzini
2022-11-04  7:35         ` Emanuele Giuseppe Esposito
2022-11-04  8:44           ` Paolo Bonzini
2022-11-04  9:20             ` Emanuele Giuseppe Esposito
2022-11-04 13:16               ` Paolo Bonzini
2022-11-04 13:12             ` Kevin Wolf
2022-11-03 13:42 ` [PATCH 3/9] nbd/server.c: " Emanuele Giuseppe Esposito
2022-11-03 16:58   ` Paolo Bonzini
2022-11-03 13:42 ` [PATCH 4/9] block-backend: replace bdrv_*_above with blk_*_above Emanuele Giuseppe Esposito
2022-11-03 13:42 ` [PATCH 5/9] block: distinguish between bdrv_create running in coroutine and not Emanuele Giuseppe Esposito
2022-11-03 13:42 ` [PATCH 6/9] block/vmdk: add missing coroutine_fn annotations Emanuele Giuseppe Esposito
2022-11-03 17:00   ` Paolo Bonzini
2022-11-03 13:42 ` [PATCH 7/9] block: bdrv_create_file is a coroutine_fn Emanuele Giuseppe Esposito
2022-11-03 17:01   ` Paolo Bonzini
2022-11-03 13:42 ` [PATCH 8/9] block: bdrv_create is never called in non-coroutine context Emanuele Giuseppe Esposito
2022-11-03 17:05   ` Paolo Bonzini
2022-11-03 13:42 ` [PATCH 9/9] block/dirty-bitmap: remove unnecessary qemu_in_coroutine() case Emanuele Giuseppe Esposito

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=Y2QDPXegFTdpBy6S@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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.