All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v2 05/26] blkdebug: add missing coroutine_fn annotations
Date: Tue, 10 May 2022 10:30:05 -0500	[thread overview]
Message-ID: <20220510153005.g62rsutcwygvkwgg@redhat.com> (raw)
In-Reply-To: <20220509103019.215041-6-pbonzini@redhat.com>

On Mon, May 09, 2022 at 12:29:58PM +0200, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Sparse commit message; from the followup email, this sentence would be helpful:

| The only rule is that callers of coroutine_fn must be coroutine_fn themselves,
| or the call must be within "if (qemu_in_coroutine())".

> ---
>  block/blkdebug.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/block/blkdebug.c b/block/blkdebug.c
> index bbf2948703..a93ba61487 100644
> --- a/block/blkdebug.c
> +++ b/block/blkdebug.c
> @@ -587,8 +587,8 @@ out:
>      return ret;
>  }
>  
> -static int rule_check(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
> -                      BlkdebugIOType iotype)
> +static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
> +                                   BlkdebugIOType iotype)

Following that guideline, rule_check() is reached from:
+ coroutine_fn blkdebug_co_preadv
+ coroutine_fn blkdebug_co_pwritev
+ blkdebug_co_flush (fixed to be coroutine_fn below)
+ coroutine_fn blkdebug_co_pwrite_zeroes
+ coroutine_fn blkdebug_co_pdiscard
+ coroutine_fn blkdebug_co_block_status

>  {
>      BDRVBlkdebugState *s = bs->opaque;
>      BlkdebugRule *rule = NULL;
> @@ -672,7 +672,7 @@ blkdebug_co_pwritev(BlockDriverState *bs, int64_t offset, int64_t bytes,
>      return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags);
>  }
>  
> -static int blkdebug_co_flush(BlockDriverState *bs)
> +static int coroutine_fn blkdebug_co_flush(BlockDriverState *bs)

blkdebug_co_flush() is only reached from:
+ .bdrv_co_flush_to_disk
  + from io.c coroutine_fn bdrv_co_flush

>  {
>      int err = rule_check(bs, 0, 0, BLKDEBUG_IO_TYPE_FLUSH);
>  
> @@ -791,7 +791,7 @@ static void blkdebug_close(BlockDriverState *bs)
>  }
>  
>  /* Called with lock held.  */
> -static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule)
> +static void coroutine_fn suspend_request(BlockDriverState *bs, BlkdebugRule *rule)

suspend_request() is only reached from:
+ process_rule (fixed to be coroutine_fn below)

>  {
>      BDRVBlkdebugState *s = bs->opaque;
>      BlkdebugSuspendedReq *r;
> @@ -810,8 +810,8 @@ static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule)
>  }
>  
>  /* Called with lock held.  */
> -static void process_rule(BlockDriverState *bs, struct BlkdebugRule *rule,
> -                         int *action_count, int *new_state)
> +static void coroutine_fn process_rule(BlockDriverState *bs, struct BlkdebugRule *rule,
> +                                      int *action_count, int *new_state)

process_rule() is only reached from:
+ blkdebug_debug_event (fixed to be coroutine_fn below)

>  {
>      BDRVBlkdebugState *s = bs->opaque;
>  
> @@ -840,7 +840,7 @@ static void process_rule(BlockDriverState *bs, struct BlkdebugRule *rule,
>      }
>  }
>  
> -static void blkdebug_debug_event(BlockDriverState *bs, BlkdebugEvent event)
> +static void coroutine_fn blkdebug_debug_event(BlockDriverState *bs, BlkdebugEvent event)

Long line; could wrap the arguments.

blkdebug_debug_event() is only reached from:
+ .bdrv_debug_event
  + from io.c coroutine_fn bdrv_do_co_copy_on_readv
  + from io.c bdrv_padding_rmw_read (NOT marked coroutine_fn, no qemu_in_coroutine guard!)
  | + from io.c coroutine_fn bdrv_co_do_zero_pwritev
  | + from io.c coroutine_fn bdrv_co_pwritev_part
  + from io.c coroutine_fn bdrv_aligned_pwritev

So the patch is 95% correct; if you also mark io.c
bdrv_padding_rmw_read(), you can add:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2022-05-10 15:32 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 10:29 [PATCH v2 00/26] block: fix coroutine_fn annotations Paolo Bonzini
2022-05-09 10:29 ` [PATCH v2 01/26] block: remove incorrect " Paolo Bonzini
2022-05-10 15:03   ` Eric Blake
2022-07-04 12:54   ` Alberto Faria
2022-05-09 10:29 ` [PATCH v2 02/26] qcow2: " Paolo Bonzini
2022-05-10 15:04   ` Eric Blake
2022-07-04 12:56   ` Alberto Faria
2022-05-09 10:29 ` [PATCH v2 03/26] nbd: " Paolo Bonzini
2022-05-10 15:05   ` Eric Blake
2022-07-04 12:56   ` Alberto Faria
2022-05-09 10:29 ` [PATCH v2 04/26] coroutine: " Paolo Bonzini
2022-05-10 15:12   ` Eric Blake
2022-07-04 12:57   ` Alberto Faria
2022-05-09 10:29 ` [PATCH v2 05/26] blkdebug: add missing " Paolo Bonzini
2022-05-10 15:30   ` Eric Blake [this message]
2022-05-09 10:29 ` [PATCH v2 06/26] blkverify: " Paolo Bonzini
2022-05-10 15:59   ` Eric Blake
2022-07-04 12:57   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 07/26] block: " Paolo Bonzini
2022-05-13 21:26   ` Eric Blake
2022-05-14  9:54     ` Paolo Bonzini
2022-05-16 18:49       ` Alberto Faria
2022-05-17  9:51         ` Paolo Bonzini
2022-05-09 10:30 ` [PATCH v2 08/26] file-posix: " Paolo Bonzini
2022-05-13 21:52   ` Eric Blake
2022-07-04 12:57   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 09/26] iscsi: " Paolo Bonzini
2022-05-18 14:44   ` Eric Blake
2022-07-04 12:58   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 10/26] nbd: " Paolo Bonzini
2022-05-18 14:50   ` Eric Blake
2022-07-04 12:58   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 11/26] nfs: " Paolo Bonzini
2022-07-04 12:59   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 12/26] nvme: " Paolo Bonzini
2022-07-04 12:59   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 13/26] parallels: " Paolo Bonzini
2022-07-04 12:59   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 14/26] qcow2: " Paolo Bonzini
2022-07-04 12:59   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 15/26] copy-before-write: " Paolo Bonzini
2022-07-04 12:59   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 16/26] curl: " Paolo Bonzini
2022-07-04 13:00   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 17/26] qed: " Paolo Bonzini
2022-07-04 13:01   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 18/26] quorum: " Paolo Bonzini
2022-07-04 13:01   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 19/26] throttle: " Paolo Bonzini
2022-07-04 13:02   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 20/26] vmdk: " Paolo Bonzini
2022-07-04 13:02   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 21/26] job: " Paolo Bonzini
2022-07-04 13:02   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 22/26] coroutine-lock: " Paolo Bonzini
2022-07-04 13:03   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 23/26] raw-format: " Paolo Bonzini
2022-07-04 13:03   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 24/26] 9p: " Paolo Bonzini
2022-07-04 13:03   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 25/26] migration: " Paolo Bonzini
2022-07-04 13:03   ` Alberto Faria
2022-05-09 10:30 ` [PATCH v2 26/26] test-coroutine: " Paolo Bonzini
2022-07-04 13:03   ` Alberto Faria
2022-05-09 11:53 ` [PATCH v2 00/26] block: fix " Daniel P. Berrangé
2022-05-09 13:30   ` Paolo Bonzini

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=20220510153005.g62rsutcwygvkwgg@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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.