qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.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 18:28:23 +0200	[thread overview]
Message-ID: <53FE0727.5010501@redhat.com> (raw)
In-Reply-To: <20140827155339.21832.73704@loki>

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>

Paolo

  reply	other threads:[~2014-08-27 16:28 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 [this message]
2014-08-27 17:30     ` Michael Roth

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=53FE0727.5010501@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=allanliuyu@gmail.com \
    --cc=mdroth@linux.vnet.ibm.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).