From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Fam Zheng" <fam@euphon.net>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org, "Juan Quintela" <quintela@redhat.com>,
qemu-devel@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH v7 00/31] block layer: split block APIs in global state and I/O
Date: Thu, 3 Mar 2022 13:06:45 +0100 [thread overview]
Message-ID: <f32ff126-bb01-b45c-771c-46bace77bf3b@redhat.com> (raw)
In-Reply-To: <Yh5E6odY1pUw2LVf@redhat.com>
Thank you for the script!
>
> Error: bdrv_get_full_backing_filename() is IO_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_get_full_backing_filename() -> bdrv_make_absolute_filename() -> bdrv_dirname() -> GLOBAL_STATE_CODE()
So this was something you caught in the first pass of reviews, and you said
"Why isn't this grouped as global state? (Or possibly I/O since it only
reads bs.)"
I will change bdrv_get_full_backing_filename to GS.
>
> Error: blk_error_action() is IO_CODE(), but calls GLOBAL_STATE_CODE() code
> blk_error_action() -> send_qmp_error_event() -> blk_iostatus_is_enabled() -> GLOBAL_STATE_CODE()
I see that blk_error_action is IO:
blk_aio_ioctl(s->qdev.conf.blk, SG_IO, io_header, scsi_block_sgio_complete, req); -> csi_block_sgio_complete -> scsi_handle_rw_error -> blk_error_action
so let's move blk_iostatus_is_enabled to IO_CODE too, together with blk_iostatus_set_err
>
> Error: bdrv_drained_end_no_poll() is IO_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_drained_end_no_poll() -> bdrv_do_drained_end() -> bdrv_do_drained_end() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive, as it will be called in a bh in the main loop.
> Error: nbd_co_do_establish_connection() is IO_CODE(), but calls GLOBAL_STATE_CODE() code
> nbd_co_do_establish_connection() -> nbd_handle_updated_info() -> bdrv_apply_auto_read_only() -> GLOBAL_STATE_CODE()
bdrv_apply_auto_read_only is used in many .bdrv_open callbacks, while nbd_co_do_establish_connection is IO_CODE because it is used by .bdrv_co_block_status and similar callbacks that are classified as I/O.
Still, we can change bdrv_apply_auto_read_only in IO_CODE, and let it still be used from GLOBAL_STATE_CODE.
This implies changing also bdrv_can_set_read_only (callee in bdrv_apply_auto_read_only) in IO_CODE
>
> Error: bdrv_drained_end_no_poll() is IO_CODE(), but calls IO_OR_GS_CODE() code
> bdrv_drained_end_no_poll() -> bdrv_do_drained_end() -> bdrv_do_drained_end() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin_quiesce() -> IO_OR_GS_CODE()
False positive
>
> Error: blk_drain() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> blk_drain() -> bdrv_ref() -> GLOBAL_STATE_CODE()
Here setting bdrv_ref as IO_OR_GS_CODE would work, as GLOBAL_STATE is still allowed call it.
Same applies for bdrv_unref, but we need to change in IO_OR_GS_CODE the following GLOBAL_STATE:
bdrv_close
bdrv_delete
bdrv_op_blocker_is_empty
bdrv_drain_all_end_quiesce
>
> Error: bdrv_drained_begin() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_drained_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
False positive
>
> Error: bdrv_subtree_drained_begin() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_subtree_drained_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
False positive
>
> Error: bdrv_drained_end() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_drained_end() -> bdrv_do_drained_end() -> bdrv_do_drained_end() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Error: bdrv_subtree_drained_end() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_subtree_drained_end() -> bdrv_do_drained_end() -> bdrv_do_drained_end() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Error: bdrv_apply_subtree_drain() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_apply_subtree_drain() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Error: bdrv_unapply_subtree_drain() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_unapply_subtree_drain() -> bdrv_do_drained_end() -> bdrv_do_drained_end() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Error: bdrv_co_drain() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_co_drain() -> bdrv_drained_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Error: bdrv_drain() is IO_OR_GS_CODE(), but calls GLOBAL_STATE_CODE() code
> bdrv_drain() -> bdrv_drained_begin() -> bdrv_do_drained_begin() -> bdrv_do_drained_begin() -> bdrv_co_yield_to_drain() -> bdrv_co_drain_bh_cb() -> bdrv_drain_all_begin() -> GLOBAL_STATE_CODE()
>
False positive
> Do you want to address some of these cases before we merge the series? I
> expect that usually we just miscategorised the caller, so the assertion
> wouldn't actually fail at runtime, but I haven't checked in detail yet.
I re-run the script and there are no more errors (except false positives).
Will send v8.
Emanuele
prev parent reply other threads:[~2022-03-03 12:12 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 14:51 [PATCH v7 00/31] block layer: split block APIs in global state and I/O Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 01/31] main-loop.h: introduce qemu_in_main_thread() Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 02/31] main loop: macros to mark GS and I/O functions Emanuele Giuseppe Esposito
2022-03-01 11:29 ` Kevin Wolf
2022-02-11 14:51 ` [PATCH v7 03/31] include/block/block: split header into I/O and global state API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 04/31] assertions for block " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 05/31] IO_CODE and IO_OR_GS_CODE for block I/O API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 06/31] block/export/fuse.c: allow writable exports to take RESIZE permission Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 07/31] include/sysemu/block-backend: split header into I/O and global state (GS) API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 08/31] block/block-backend.c: assertions for block-backend Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 09/31] IO_CODE and IO_OR_GS_CODE for block-backend I/O API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 10/31] block.c: assertions to the block layer permissions API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 11/31] include/block/block_int: split header into I/O and global state API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 12/31] assertions for block_int " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 13/31] IO_CODE and IO_OR_GS_CODE for block_int I/O API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 14/31] block: introduce assert_bdrv_graph_writable Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 15/31] include/block/blockjob_int.h: split header into I/O and GS API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 16/31] GS and IO CODE macros for blockjob_int.h Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 17/31] block.c: add assertions to static functions Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 18/31] include/block/blockjob.h: global state API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 19/31] assertions for blockjob.h " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 20/31] include/sysemu/blockdev.h: " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 21/31] assertions for blockdev.h " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 22/31] include/block/snapshot: global state API + assertions Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 23/31] block/copy-before-write.h: " Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 24/31] block/coroutines: I/O and "I/O or GS" API Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 25/31] block_int-common.h: split function pointers in BlockDriver Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 26/31] block_int-common.h: assertions in the callers of BlockDriver function pointers Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 27/31] block_int-common.h: split function pointers in BdrvChildClass Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 28/31] block_int-common.h: assertions in the callers of BdrvChildClass function pointers Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 29/31] block-backend-common.h: split function pointers in BlockDevOps Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 30/31] job.h: split function pointers in JobDriver Emanuele Giuseppe Esposito
2022-02-11 14:51 ` [PATCH v7 31/31] job.h: assertions in the callers of JobDriver function pointers Emanuele Giuseppe Esposito
2022-03-01 16:08 ` [PATCH v7 00/31] block layer: split block APIs in global state and I/O Kevin Wolf
2022-03-03 12:06 ` Emanuele Giuseppe Esposito [this message]
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=f32ff126-bb01-b45c-771c-46bace77bf3b@redhat.com \
--to=eesposit@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).