From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQcJR-0006GF-Nh for qemu-devel@nongnu.org; Tue, 02 Feb 2016 09:52:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQcJN-0004e5-Jm for qemu-devel@nongnu.org; Tue, 02 Feb 2016 09:52:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQcJN-0004e1-EQ for qemu-devel@nongnu.org; Tue, 02 Feb 2016 09:52:09 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0E6795A57 for ; Tue, 2 Feb 2016 14:52:09 +0000 (UTC) Date: Tue, 2 Feb 2016 14:52:06 +0000 From: Stefan Hajnoczi Message-ID: <20160202145206.GB32084@stefanha-x1.localdomain> References: <1452870739-28484-1-git-send-email-pbonzini@redhat.com> <1452870739-28484-6-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MfFXiAuoTsnnDAfZ" Content-Disposition: inline In-Reply-To: <1452870739-28484-6-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 05/16] iothread: release AioContext around aio_poll List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org --MfFXiAuoTsnnDAfZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 15, 2016 at 04:12:08PM +0100, Paolo Bonzini wrote: > @@ -120,9 +117,17 @@ Block layer code must therefore expect to run in an = IOThread and avoid using > old APIs that implicitly use the main loop. See the "How to program for > IOThreads" above for information on how to do that. > =20 > -If main loop code such as a QMP function wishes to access a BlockDriverS= tate it > -must first call aio_context_acquire(bdrv_get_aio_context(bs)) to ensure = the > -IOThread does not run in parallel. > +If main loop code such as a QMP function wishes to access a BlockDriverS= tate > +it must first call aio_context_acquire(bdrv_get_aio_context(bs)) to ensu= re > +that callbacks in the IOThread do not run in parallel. > + > +Code running in the monitor typically uses bdrv_drain() to ensure that > +past requests from the guest are completed. When a block device is > +running in an IOThread, the IOThread can also process requests from > +the guest (via ioeventfd). These requests have to be blocked with > +aio_disable_clients() before calling bdrv_drain(). You can then reenable > +guest requests with aio_enable_clients() before finally releasing the > +AioContext and completing the monitor command. This is outdated. Monitor commands do this: bdrv_drained_begin() -> ... -> bdrv_drain() -> ... -> bdrv_drained_end() > @@ -110,6 +111,8 @@ static void *test_acquire_thread(void *opaque) > qemu_mutex_lock(&data->start_lock); > qemu_mutex_unlock(&data->start_lock); > =20 > + g_usleep(500000); Sleep? --MfFXiAuoTsnnDAfZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWsMKWAAoJEJykq7OBq3PI5wsH/RXsfNzwiMfBKd4i+PqoXQZP GluVtIKa3y2C1gd8a/v5QE+DugOSNOrA8I4gu0RD0gm6MgENZMlK0slAgjgsFNZx k8iAoEyiD14mNq3UoH09iYX+V4tBbrDOJDXTvAkPPb1VBtZ0HkMtWnyLHLuO8kME ZFJxBXSKfId2HSkRWJ8Qzs9m1ANgXzG24Q6HScXXHqaWjoUY62p/X1hKnSblMq5b Pc1U9RP1h2IMGUqTqaPc3RKznngMxVUY1CsYLZihFQZWlSnFKOmCOkppsxO14IIn 1UOmBOD9mmPWp/q4rKJBAVpz6LpSyEykkVdWkinSpi0oYEo0oe95HqAD3XyUD1E= =1oI8 -----END PGP SIGNATURE----- --MfFXiAuoTsnnDAfZ--