Received: from eggs.gnu.org ([2001:4830:134:3::10]:38762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNKJd-0004hz-VT for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNKJX-0008BP-OQ for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:26:01 -0400 Received: from indium.canonical.com ([91.189.90.7]:52666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNKJX-0008BK-G1 for qemu-devel@nongnu.org; Fri, 29 Aug 2014 07:25:55 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1XNKJW-0000sP-QC for ; Fri, 29 Aug 2014 11:25:54 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id B71292E80C0 for ; Fri, 29 Aug 2014 11:25:54 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Fri, 29 Aug 2014 11:16:16 -0000 From: senya Sender: bounces@canonical.com References: <20140828141904.28233.58158.malonedeb@gac.canonical.com> Message-Id: <20140829111617.18476.43628.malone@soybean.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1362635] Re: bdrv_read co-routine re-entered recursively Reply-To: Bug 1362635 <1362635@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org the problem is taking place only when call bdrv_read frome separate thread. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1362635 Title: bdrv_read co-routine re-entered recursively Status in QEMU: New Bug description: calling bdrv_read in a loop leads to the follwing situation: bs->drv->bdrv_aio_readv is called, and finally calls bdrv_co_io_em_comple= te in other thread context. there is a possibility of calling bdrv_co_io_em_complete before calling q= emu_coroutine_yield in bdrv_co_io_em. And qemu fails with "co-routine re-en= tered recursively". static void bdrv_co_io_em_complete(void *opaque, int ret) { CoroutineIOCompletion *co =3D opaque; co->ret =3D ret; qemu_coroutine_enter(co->coroutine, NULL); } static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t secto= r_num, int nb_sectors, QEMUIOVector *iov, bool is_write) { CoroutineIOCompletion co =3D { .coroutine =3D qemu_coroutine_self(), }; BlockDriverAIOCB *acb; if (is_write) { acb =3D bs->drv->bdrv_aio_writev(bs, sector_num, iov, nb_sectors, bdrv_co_io_em_complete, &co); } else { acb =3D bs->drv->bdrv_aio_readv(bs, sector_num, iov, nb_sectors, bdrv_co_io_em_complete, &co); } trace_bdrv_co_io_em(bs, sector_num, nb_sectors, is_write, acb); if (!acb) { return -EIO; } qemu_coroutine_yield(); return co.ret; } is it a bug, or may be I don't understand something? To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1362635/+subscriptions