From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4z6D-0000NZ-GF for qemu-devel@nongnu.org; Thu, 10 Nov 2016 18:49:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4z6C-0006iJ-KW for qemu-devel@nongnu.org; Thu, 10 Nov 2016 18:49:41 -0500 References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-2-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <982c40de-1ec6-563b-890d-70d2253de259@redhat.com> Date: Thu, 10 Nov 2016 17:49:32 -0600 MIME-Version: 1.0 In-Reply-To: <1478798349-28983-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XUIrDAuElcsJ5Nn244km5UgOPKJj0kqBM" Subject: Re: [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: berto@igalia.com, qemu-devel@nongnu.org, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XUIrDAuElcsJ5Nn244km5UgOPKJj0kqBM From: Eric Blake To: Kevin Wolf , qemu-block@nongnu.org Cc: berto@igalia.com, qemu-devel@nongnu.org, mreitz@redhat.com Message-ID: <982c40de-1ec6-563b-890d-70d2253de259@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive() References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1478798349-28983-2-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/10/2016 11:19 AM, Kevin Wolf wrote: > In the context of asynchronous work, if we have a worker coroutine that= > didn't yield, the parent coroutine cannot be reentered because it hasn'= t > yielded yet. In this case we don't even have to reenter the parent > because it will see that the work is already done and won't even yield.= >=20 > Signed-off-by: Kevin Wolf > --- > include/qemu/coroutine.h | 6 ++++++ > util/qemu-coroutine.c | 8 ++++++++ > 2 files changed, 14 insertions(+) >=20 > +++ b/util/qemu-coroutine.c > @@ -19,6 +19,7 @@ > #include "qemu/atomic.h" > #include "qemu/coroutine.h" > #include "qemu/coroutine_int.h" > +#include "block/aio.h" Why do you need this include? > =20 > enum { > POOL_BATCH_SIZE =3D 64, > @@ -131,6 +132,13 @@ void qemu_coroutine_enter(Coroutine *co) > } > } > =20 > +void qemu_coroutine_enter_if_inactive(Coroutine *co) > +{ > + if (!qemu_coroutine_entered(co)) { > + qemu_coroutine_enter(co); > + } > +} > + > void coroutine_fn qemu_coroutine_yield(void) > { > Coroutine *self =3D qemu_coroutine_self(); >=20 Otherwise: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XUIrDAuElcsJ5Nn244km5UgOPKJj0kqBM 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYJQeMAAoJEKeha0olJ0NqEQIH/3BUPCcv18+6DFK6l6ThsUtp 3iEfmfNshrGe+LXCfj1U6wJ95yYt657FAFqVq4ZL/7ji1LahZYGEVifyy32VMLDt rWm8qDRbgizm+DBRglcm/tREu/2hxHgLQhHapuzM9zhGQKW+nbc8A1/cyPHxEoc1 29T+unSFnBQoMNhfjvyFLxwZTXD0EDGKvPJfHQvCkvXpljMMz4+Cg3OXQ5rqqnSg LPVFoFfh8WOIBBDH8vYr27WrlxvNcEasEMGVnkaGcAG5+iK5wzE5QnkB7BZGjaeP YyvK/atLIx3bwDHryv4LgDAnvuoxJcMVREuDi5rouzLikeQoUx7RcBXVmgljefo= =lmOX -----END PGP SIGNATURE----- --XUIrDAuElcsJ5Nn244km5UgOPKJj0kqBM--