All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 0/9] blockdev: fix QMP 'transaction' with IOThreads
Date: Wed, 13 Dec 2017 22:26:31 +0100	[thread overview]
Message-ID: <a8005de2-746c-cdd3-b951-e6c23a7d6c2f@redhat.com> (raw)
In-Reply-To: <20171206144550.22295-1-stefanha@redhat.com>

On 06/12/2017 15:45, Stefan Hajnoczi wrote:
> v2:
>  * Use StrOrNull for x-blockdev-set-iothread iothread argument [eblake]
> 
> (This is for QEMU 2.12 because this bug is not -rc4 critical)
> 
> Previously AioContext was held across QMP 'transaction' in an attempt to
> achieve bdrv_drained_begin/end() semantics.  Nowadays we have
> bdrv_drained_begin/end() and the AioContext lock just protects state.
> Therefore there is no reason to hold AioContext across
> .prepare/.commit/.abort/.clean() anymore.
> 
> Besides being cleanup-worthy, holding AioContext also exposes a bug:
> BDRV_POLL_WHILE() doesn't support recursive AioContext locking and will hang if
> depth > 1.  This is easy to trigger by submitting a transaction with 2 actions
> that touch two drives assigned to an IOThread.  The IOThread's AioContext will
> be locked twice and BDRV_POLL_WHILE() will hang.
> 
> BDRV_POLL_WHILE() is best fixed by eliminating the AioContext lock entirely in
> favor of fine-grained locking.  I discussed some fixes for BDRV_POLL_WHILE()
> with Paolo but we came to the conclusion that it will just add complexity when
> we really want to stop using AioContext locking.
> 
> Summary:
> 
>  * Patch 1 fixes missing AioContext lock protection
> 
>  * Patches 2-6 clean up excessive AioContext locked regions in QMP
>    'transaction' to solve the hang
> 
>  * Patches 7-9 add a qemu-iotests test case and the necessary infrastructure
> 
> Stefan Hajnoczi (9):
>   blockdev: hold AioContext for bdrv_unref() in
>     external_snapshot_clean()
>   block: don't keep AioContext acquired after
>     external_snapshot_prepare()
>   block: don't keep AioContext acquired after drive_backup_prepare()
>   block: don't keep AioContext acquired after blockdev_backup_prepare()
>   block: don't keep AioContext acquired after
>     internal_snapshot_prepare()
>   block: drop unused BlockDirtyBitmapState->aio_context field
>   iothread: add iothread_by_id() API
>   blockdev: add x-blockdev-set-iothread testing command
>   qemu-iotests: add 202 external snapshots IOThread test
> 
>  qapi/block-core.json       |  36 +++++++
>  include/sysemu/iothread.h  |   1 +
>  blockdev.c                 | 258 +++++++++++++++++++++++++++++++++------------
>  iothread.c                 |   7 ++
>  tests/qemu-iotests/202     |  95 +++++++++++++++++
>  tests/qemu-iotests/202.out |  11 ++
>  tests/qemu-iotests/group   |   1 +
>  7 files changed, 339 insertions(+), 70 deletions(-)
>  create mode 100755 tests/qemu-iotests/202
>  create mode 100644 tests/qemu-iotests/202.out
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

      parent reply	other threads:[~2017-12-13 21:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 14:45 [Qemu-devel] [PATCH v2 0/9] blockdev: fix QMP 'transaction' with IOThreads Stefan Hajnoczi
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 1/9] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean() Stefan Hajnoczi
2017-12-07 20:32   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 2/9] block: don't keep AioContext acquired after external_snapshot_prepare() Stefan Hajnoczi
2017-12-07 20:37   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 3/9] block: don't keep AioContext acquired after drive_backup_prepare() Stefan Hajnoczi
2017-12-07 21:27   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 4/9] block: don't keep AioContext acquired after blockdev_backup_prepare() Stefan Hajnoczi
2017-12-07 21:39   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 5/9] block: don't keep AioContext acquired after internal_snapshot_prepare() Stefan Hajnoczi
2017-12-07 21:46   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 6/9] block: drop unused BlockDirtyBitmapState->aio_context field Stefan Hajnoczi
2017-12-07 21:47   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 7/9] iothread: add iothread_by_id() API Stefan Hajnoczi
2017-12-07 21:48   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 8/9] blockdev: add x-blockdev-set-iothread testing command Stefan Hajnoczi
2017-12-07 21:54   ` Eric Blake
2017-12-06 14:45 ` [Qemu-devel] [PATCH v2 9/9] qemu-iotests: add 202 external snapshots IOThread test Stefan Hajnoczi
2017-12-07 21:58   ` Eric Blake
2017-12-08 10:19 ` [Qemu-devel] [Qemu-block] [PATCH v2 0/9] blockdev: fix QMP 'transaction' with IOThreads Stefan Hajnoczi
2017-12-08 13:29 ` [Qemu-devel] " Kevin Wolf
2017-12-08 15:32 ` Stefan Hajnoczi
2017-12-13 21:26 ` Paolo Bonzini [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=a8005de2-746c-cdd3-b951-e6c23a7d6c2f@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.