From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkFDW-0005ZC-Cy for qemu-devel@nongnu.org; Mon, 20 Apr 2015 13:10:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkFDP-0006gf-T9 for qemu-devel@nongnu.org; Mon, 20 Apr 2015 13:10:42 -0400 Date: Mon, 20 Apr 2015 18:10:30 +0100 From: Stefan Hajnoczi Message-ID: <20150420171030.GA16268@stefanha-thinkpad.redhat.com> References: <1427524638-28157-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <1427524638-28157-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 28, 2015 at 07:37:18AM +0100, Paolo Bonzini wrote: > bdrv_aio_* APIs can use coroutines to achieve asynchronicity. However, > the coroutine may terminate without having yielded back to the caller > (for example because of something that invokes a nested event loop, > or because the coroutine is doing nothing at all). In this case, > the bdrv_aio_* API must delay the completion to the next iteration > of the main loop, because bdrv_aio_* will never invoke the callback > before returning. >=20 > This can be done with a bottom half, and indeed bdrv_aio_* is always > using one for simplicity. It is possible to gain some performance > (~3%) by avoiding this in the common case. A new field in the > BlockAIOCBCoroutine struct is set to true until the first time the > corotine has yielded to its creator, and completion goes through a > new function bdrv_co_complete. If the flag is false, bdrv_co_complete > invokes the callback immediately. If it is true, the caller will > notice that the coroutine has completed and schedule the bottom > half itself. >=20 > Signed-off-by: Paolo Bonzini > --- > block.c | 43 ++++++++++++++++++++++++++++++++++--------- > 1 file changed, 34 insertions(+), 9 deletions(-) Thanks, applied to my block-next tree: https://github.com/stefanha/qemu/commits/block-next Stefan --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVNTMGAAoJEJykq7OBq3PIHcYH/izQgmNEk9rYZrJZuV6dkLo1 mFGbjOPMwmafE0lWqW6dmJV3HY7Re68YT14CJlUl65G9Svr5C+PChaJqYEXqMa2O NtwJexr+cyloeersFGAUjTJMMgVBn39iPnX92Dvs4ogeLgI2YAqhTHKnZtQlMPCF 0f6WI1jcv8BUDnfVJhroAXrmMqCy9q60cydHL9C5xSTrvzAkIjr0M3E0pp2vJIaT kFICTagkYaX8C0mimzF8v0ZMEf6OaNe/me987h2kH+8CvW/fRectKpQ3iTJ969kx xYW/TWSF03OwLWdu4vkbqse4q5fF/a+yy0xVOBWSk/9Xwc4C8XcoQqXBePEb5YY= =i+Rf -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+--