qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] block: Forbid bdrv_set_aio_context outside BQL
Date: Tue, 10 Mar 2015 13:34:26 +0000	[thread overview]
Message-ID: <20150310133426.GC19057@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1423718462-25566-2-git-send-email-famz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

On Thu, Feb 12, 2015 at 01:21:00PM +0800, Fam Zheng wrote:
> Even if the caller has the old #AioContext, there can be a deadlock, due
> to the leading bdrv_drain_all:
> 
> Suppose there are three io threads (a, b, c) with each owning a BDS
> (bds_a, bds_b, bds_c), and a and b want to move their own BDS to c at
> the same time:
> 
>   iothread a                           iothread b
> --------------------------------------------------------------------------
>   bdrv_set_aio_context(bds_a, c)       bdrv_set_aio_context(bds_b, c)
>   -> bdrv_drain_all()                  -> bdrv_drain_all()
>      -> acquire a (OK, already has)       -> acquire a (blocked)
>      -> acquire b (blocked)               -> acquire b
>      -> acquire c                         -> acquire c
> 
> Current caller of bdrv_set_aio_context outside BQL is
> virtio-scsi-dataplane, which will be fixed in the next patches.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  include/block/block.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2015-03-10 13:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  5:20 [Qemu-devel] [PATCH 0/3] virtio-scsi: Fix unsafe bdrv_set_aio_context calls Fam Zheng
2015-02-12  5:21 ` [Qemu-devel] [PATCH 1/3] block: Forbid bdrv_set_aio_context outside BQL Fam Zheng
2015-02-13 13:10   ` Paolo Bonzini
2015-03-10 13:34   ` Stefan Hajnoczi [this message]
2015-02-12  5:21 ` [Qemu-devel] [PATCH 2/3] virtio-scsi: Deduplicate cmd queue handling code of dataplane Fam Zheng
2015-02-12  5:21 ` [Qemu-devel] [PATCH 3/3] virtio-scsi-dataplane: Use main thread BH to set BDS' aio context Fam Zheng
2015-02-12 14:29   ` Paolo Bonzini
2015-02-13  1:21     ` Fam Zheng
2015-02-13  9:38       ` Paolo Bonzini
2015-02-13 10:29         ` Fam Zheng
2015-02-13 10:38           ` Paolo Bonzini
2015-02-13 12:42             ` Fam Zheng
2015-02-13 13:12               ` 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=20150310133426.GC19057@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@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 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).