From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDUR6-0005ZQ-Ce for qemu-devel@nongnu.org; Thu, 16 Jun 2016 06:22:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDUQz-0007ud-60 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 06:22:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDUQy-0007uZ-Tg for qemu-devel@nongnu.org; Thu, 16 Jun 2016 06:22:01 -0400 References: <1465928228-1184-1-git-send-email-stefanha@redhat.com> <1465928228-1184-5-git-send-email-stefanha@redhat.com> <5cd43fbb-b9ef-ba1c-ea33-a0abf91346ec@redhat.com> <20160616101724.GG31974@stefanha-x1.localdomain> From: Paolo Bonzini Message-ID: <4ff8b453-c9ea-a6e8-c5b9-8ec0c9bf0987@redhat.com> Date: Thu, 16 Jun 2016 12:21:52 +0200 MIME-Version: 1.0 In-Reply-To: <20160616101724.GG31974@stefanha-x1.localdomain> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RNNMLio67QpIQF1eTe3tn9Fr7MJMfO4AP" Subject: Re: [Qemu-devel] [PATCH v4 4/5] mirror: follow AioContext change gracefully List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Kevin Wolf , Jeff Cody , Fam Zheng , jjherne@linux.vnet.ibm.com, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --RNNMLio67QpIQF1eTe3tn9Fr7MJMfO4AP From: Paolo Bonzini To: Stefan Hajnoczi Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Kevin Wolf , Jeff Cody , Fam Zheng , jjherne@linux.vnet.ibm.com, mreitz@redhat.com Message-ID: <4ff8b453-c9ea-a6e8-c5b9-8ec0c9bf0987@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 4/5] mirror: follow AioContext change gracefully References: <1465928228-1184-1-git-send-email-stefanha@redhat.com> <1465928228-1184-5-git-send-email-stefanha@redhat.com> <5cd43fbb-b9ef-ba1c-ea33-a0abf91346ec@redhat.com> <20160616101724.GG31974@stefanha-x1.localdomain> In-Reply-To: <20160616101724.GG31974@stefanha-x1.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 16/06/2016 12:17, Stefan Hajnoczi wrote: > On Wed, Jun 15, 2016 at 10:57:49AM +0200, Paolo Bonzini wrote: >> On 14/06/2016 20:17, Stefan Hajnoczi wrote: >>> +/* There is no matching mirror_resume() because mirror_run() will be= gin >>> + * iterating again when the job is resumed. >>> + */ >>> +static void mirror_pause(BlockJob *job) >>> +{ >>> + MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common);= >>> + >>> + while (s->in_flight > 0) { >>> + aio_poll(blk_get_aio_context(job->blk), true); >>> + } >> >> This is calling aio_poll from a coroutine, which is ugly -- see Fam's >> recent introduction of bdrv_co_drain. I think this should call >> mirror_drain instead. >=20 > This is not called from coroutine context, so I couldn't use > mirror_drain(). >=20 > BlockJobDriver->pause() and attached_aio_context() are both not > coroutine_fn. That's because bdrv_attach_aio_context() is not > coroutine_fn and can be called from a monitor command or device > emulation code. But mirror_pause is only called from block_job_pause_point, isn't it? And block_job_pause_point is a coroutine_fn. I think what you say was true for v3, though. Paolo --RNNMLio67QpIQF1eTe3tn9Fr7MJMfO4AP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXYn3AAAoJEL/70l94x66DbRUH+QHYrW1Hgkf39mCoumo5Xg46 fDqBftI6vwbTRhOHQVCY4xDnmKuhA/8fZ5Q+pihopErLMHfXWRdGGEMk+h7Aa2RS /bVLxB+lWKKoyxBJu1Xa9AJuHz4z0unFfYNWbRFghotz0duy2N0n4RyuHmAPs8FV PyixVMM3t7z8HE3AkkiGRsAPE48utrtdmscGgpbCc42EhB8WrdAquKVVfBPYDtud 3u8jVKdg5UbIgGnemfPFrcvVK74fCAZfTf6gp2qx1sYLYBYTBVxnmblpgvCpE3N3 zKkS4kC4sN9D0SWXbJCouwE6F51VJP5xefBKrymZ+zzotUl6eQuzsHCGEhPUO70= =ZE+Y -----END PGP SIGNATURE----- --RNNMLio67QpIQF1eTe3tn9Fr7MJMfO4AP--