From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws8Ti-0003Un-I9 for qemu-devel@nongnu.org; Wed, 04 Jun 2014 06:31:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ws8TY-0002wa-Nc for qemu-devel@nongnu.org; Wed, 04 Jun 2014 06:31:30 -0400 Received: from mx.beyond.pl ([92.43.117.49]:46400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws8TY-0002vP-Gm for qemu-devel@nongnu.org; Wed, 04 Jun 2014 06:31:20 -0400 Message-ID: <538EF574.90208@beyond.pl> Date: Wed, 04 Jun 2014 12:31:16 +0200 From: =?UTF-8?B?TWFyY2luIEdpYnXFgmE=?= MIME-Version: 1.0 References: <538C248F.2000801@beyond.pl> <20140604100156.GF26902@stefanha-thinkpad.redhat.com> In-Reply-To: <20140604100156.GF26902@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] thread-pool: fix deadlock when callbacks depends on each other List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Paolo Bonzini , qemu-devel On 04.06.2014 12:01, Stefan Hajnoczi wrote: > On Mon, Jun 02, 2014 at 09:15:27AM +0200, Marcin Gibu=C5=82a wrote: >> When two coroutines submit I/O and first coroutine depends on second t= o >> complete (by calling bdrv_drain_all), deadlock may occur. > > bdrv_drain_all() is a very heavy-weight operation. Coroutines should > avoid it if possible. Please post the file/line/function where this > call was made, perhaps there is a better way to wait for the other > coroutine. This isn't a fix for this bug but it's a cleanup. As in original bug report: #4 0x00007f699c095c0a in bdrv_drain_all () at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block.c= :1805 #5 0x00007f699c09c87e in bdrv_close (bs=3Dbs@entry=3D0x7f699f0bc520) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block.c= :1695 #6 0x00007f699c09c5fa in bdrv_delete (bs=3D0x7f699f0bc520) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block.c= :1978 #7 bdrv_unref (bs=3D0x7f699f0bc520) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block.c= :5198 #8 0x00007f699c09c812 in bdrv_drop_intermediate=20 (active=3Dactive@entry=3D0x7f699ebfd330, top=3Dtop@entry=3D0x7f699f0bc520= ,=20 base=3Dbase@entry=3D0x7f699eec43d0) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block.c= :2567 #9 0x00007f699c0a1963 in commit_run (opaque=3D0x7f699f17dcc0) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/block/c= ommit.c:144 #10 0x00007f699c0e0dca in coroutine_trampoline (i0=3D,=20 i1=3D) at=20 /var/tmp/portage/app-emulation/qemu-2.0.0_rc2/work/qemu-2.0.0-rc2/corouti= ne-ucontext.c:118=20 mirror_run probably has this as well. I didn't check others. --=20 mg