From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh3P-0007xp-Ci for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:30:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMh3A-00018Q-5Q for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:30:39 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:56522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh39-000187-Td for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:30:24 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Aug 2014 11:30:22 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <53FE0727.5010501@redhat.com> References: <53F80DC4.7030102@gmail.com> <20140827155339.21832.73704@loki> <53FE0727.5010501@redhat.com> Message-ID: <20140827173017.13291.77975@loki> Date: Wed, 27 Aug 2014 12:30:17 -0500 Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH] stream: fix the deadlock bug when stream finish List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Liu Yu , qemu-stable@nongnu.org Cc: qemu-devel@nongnu.org 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 swit= ch > >> 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 > 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 Thanks. Looks like this missed v2.1.0 so I've gone ahead and queued it for 2.1.1 (along with 5f8127a5811429da85cc4bc273f166aed129fc31). > = > Paolo