From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, hreitz@redhat.com, eblake@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2 00/11] block: Re-enable the graph lock
Date: Wed, 7 Jun 2023 14:19:41 -0400 [thread overview]
Message-ID: <20230607181941.GH2138915@fedora> (raw)
In-Reply-To: <20230605085711.21261-1-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]
On Mon, Jun 05, 2023 at 10:57:00AM +0200, Kevin Wolf wrote:
> This series fixes the deadlock that was observed before commit ad128dff
> ('graph-lock: Disable locking for now'), which just disabled the graph
> lock completely as a workaround to get 8.0.1 stable.
>
> In theory the problem is simple: We can't poll while still holding the
> lock of a different AioContext. So bdrv_graph_wrlock() just needs to
> drop that lock before it polls. However, there are a number of callers
> that don't even hold the AioContext lock they are supposed to hold, so
> temporarily unlocking tries to unlock a mutex that isn't locked,
> resulting in assertion failures.
>
> Therefore, much of this series is just for fixing AioContext locking
> correctness. It is only the last two patches that actually fix the
> deadlock and reenable the graph locking.
>
> v2:
> - Fixed patch 2 to actually lock the correct AioContext even if the
> device doesn't support iothreads
> - Improved the commit message for patch 7 [Eric]
> - Fixed mismerge in patch 11 (v1 incorrectly left an #if 0 around)
>
> Kevin Wolf (11):
> iotests: Test active commit with iothread and background I/O
> qdev-properties-system: Lock AioContext for blk_insert_bs()
> test-block-iothread: Lock AioContext for blk_insert_bs()
> block: Fix AioContext locking in bdrv_open_child()
> block: Fix AioContext locking in bdrv_attach_child_common()
> block: Fix AioContext locking in bdrv_reopen_parse_file_or_backing()
> block: Fix AioContext locking in bdrv_open_inherit()
> block: Fix AioContext locking in bdrv_open_backing_file()
> blockjob: Fix AioContext locking in block_job_add_bdrv()
> graph-lock: Unlock the AioContext while polling
> Revert "graph-lock: Disable locking for now"
>
> include/block/graph-lock.h | 6 +-
> block.c | 103 ++++++++++++++++--
> block/graph-lock.c | 42 ++++---
> blockjob.c | 17 ++-
> hw/core/qdev-properties-system.c | 8 +-
> tests/unit/test-block-iothread.c | 7 +-
> .../tests/iothreads-commit-active | 85 +++++++++++++++
> .../tests/iothreads-commit-active.out | 23 ++++
> 8 files changed, 250 insertions(+), 41 deletions(-)
> create mode 100755 tests/qemu-iotests/tests/iothreads-commit-active
> create mode 100644 tests/qemu-iotests/tests/iothreads-commit-active.out
>
> --
> 2.40.1
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2023-06-07 18:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 8:57 [PATCH v2 00/11] block: Re-enable the graph lock Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 01/11] iotests: Test active commit with iothread and background I/O Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 02/11] qdev-properties-system: Lock AioContext for blk_insert_bs() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 03/11] test-block-iothread: " Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 04/11] block: Fix AioContext locking in bdrv_open_child() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 05/11] block: Fix AioContext locking in bdrv_attach_child_common() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 06/11] block: Fix AioContext locking in bdrv_reopen_parse_file_or_backing() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 07/11] block: Fix AioContext locking in bdrv_open_inherit() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 08/11] block: Fix AioContext locking in bdrv_open_backing_file() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 09/11] blockjob: Fix AioContext locking in block_job_add_bdrv() Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 10/11] graph-lock: Unlock the AioContext while polling Kevin Wolf
2023-06-05 8:57 ` [PATCH v2 11/11] Revert "graph-lock: Disable locking for now" Kevin Wolf
2023-06-05 9:06 ` Paolo Bonzini
2023-06-05 10:03 ` Kevin Wolf
2023-06-07 18:19 ` Stefan Hajnoczi [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=20230607181941.GH2138915@fedora \
--to=stefanha@redhat.com \
--cc=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--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 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).