From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Liu Yu <allanliuyu@gmail.com>,
qemu-stable@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH] stream: fix the deadlock bug when stream finish
Date: Wed, 27 Aug 2014 12:30:17 -0500 [thread overview]
Message-ID: <20140827173017.13291.77975@loki> (raw)
In-Reply-To: <53FE0727.5010501@redhat.com>
Quoting Paolo Bonzini (2014-08-27 11:28:23)
> Il 27/08/2014 17:53, Michael Roth ha scritto:
> >> In case VM does IO while we run a stream job.
> >> When stream finishes, the stream coroutine drains all IOs before
> >> close the unused image, in bdrv_drain_all() it may find
> >> a pending request which is submitted by guest IO coroutine.
> >> In order to wait the pending req finish, the subsequent aio_poll()
> >> call poll() to wait the req. however, if the req is already done by
> >> threadpool and is waiting for the callback, there is no chance to switch
> >> back to guest IO coroutine to call the callback and so that the stream
> >> coroutine waits in poll() all the time.
>
> This is the same bug fixed by this patch;
>
> commit 3c80ca158c96ff902a30883a8933e755988948b1
> Author: Stefan Hajnoczi <stefanha@redhat.com>
> Date: Tue Jul 15 16:44:26 2014 +0200
>
> thread-pool: avoid deadlock in nested aio_poll() calls
>
> The thread pool has a race condition if two elements complete before
> thread_pool_completion_bh() runs:
>
> If element A's callback waits for element B using aio_poll() it will
> deadlock since pool->completion_bh is not marked scheduled when the
> nested aio_poll() runs.
>
> Fix this by marking the BH scheduled while thread_pool_completion_bh()
> is executing. This way any nested aio_poll() loops will enter
> thread_pool_completion_bh() and complete the remaining elements.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Thanks. Looks like this missed v2.1.0 so I've gone ahead and queued it
for 2.1.1 (along with 5f8127a5811429da85cc4bc273f166aed129fc31).
>
> Paolo
prev parent reply other threads:[~2014-08-27 17:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53F80DC4.7030102@gmail.com>
2014-08-27 15:53 ` [Qemu-devel] [Qemu-stable] [PATCH] stream: fix the deadlock bug when stream finish Michael Roth
2014-08-27 16:28 ` Paolo Bonzini
2014-08-27 17:30 ` Michael Roth [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=20140827173017.13291.77975@loki \
--to=mdroth@linux.vnet.ibm.com \
--cc=allanliuyu@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).