Received: from eggs.gnu.org ([2001:4830:134:3::10]:33069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO51o-0001EQ-Ac for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:51:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO51j-0002Cw-7n for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:51:00 -0500 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:34936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO51i-0002Cs-QD for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:50:55 -0500 Received: by mail-wi0-f173.google.com with SMTP id bs8so41133805wib.0 for ; Wed, 18 Feb 2015 05:50:53 -0800 (PST) Date: Wed, 18 Feb 2015 13:50:51 +0000 From: Stefan Hajnoczi Message-ID: <20150218135051.GF7629@stefanha-thinkpad.redhat.com> References: <1423564888-14933-1-git-send-email-kwolf@redhat.com> <1423564888-14933-3-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7mxbaLlpDEyR1+x6" Content-Disposition: inline In-Reply-To: <1423564888-14933-3-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: stefanha@redhat.com, pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wu.wubin@huawei.com --7mxbaLlpDEyR1+x6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 10, 2015 at 11:41:27AM +0100, Kevin Wolf wrote: > qemu_coroutine_enter() is now the only user of coroutine_swap(). Both > functions are short, so inline it. >=20 > Also, using COROUTINE_YIELD is now even more confusing because this code > is never called during qemu_coroutine_yield() any more. In fact, this > value is never read back, so we can just introduce a new COROUTINE_ENTER > which documents the purpose of the task switch better. >=20 > Signed-off-by: Kevin Wolf > --- > include/block/coroutine_int.h | 1 + > qemu-coroutine.c | 36 +++++++++++++++--------------------- > 2 files changed, 16 insertions(+), 21 deletions(-) >=20 > diff --git a/include/block/coroutine_int.h b/include/block/coroutine_int.h > index f133d65..69b83db 100644 > --- a/include/block/coroutine_int.h > +++ b/include/block/coroutine_int.h > @@ -29,6 +29,7 @@ > #include "block/coroutine.h" > =20 > typedef enum { > + COROUTINE_ENTER =3D 0, This makes the ucontext code harder to understand because CoroutineAction values are used with setjmp()/longjmp() in qemu_coroutine_switch(). The longjmp() man page says: If longjmp() is invoked with a second argument of 0, 1 will be returned instead. I haven't checked whether or not this causes problems, but the code would be simpler if we avoided using 0. --7mxbaLlpDEyR1+x6 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU5Ji7AAoJEJykq7OBq3PIOuYIAI9q9ZgEnd+tmO6iXIsGNZtA cz/noqsmNY3eOolyQ7jhNHfvN/shueY+cLCAio9GvtHXgiU8sZiNfCxIWboI2Out 6XvFm9Q6MN8KBlybhjQe0cPM8b+OHO6wjwgonUbEZTmaKsm1vOUceoewVQ2LXFv9 GqMPfydK3bkkscBoOr+vctKPHu/I12gncyLfvNMIBct4ECkiutMP4Qcn77dI4gei rugYokxKv/0RUIEDqg3nLg43PhZqckz7qO7L0/kHtUc8MIFhxXWBPhvE/lqarxLZ QoZiZFpA8WknLV6PtiZF6Ntu4KowKY+RxyrdBk2mMe97KL4nWAaSTlqj8gRU1l4= =qirT -----END PGP SIGNATURE----- --7mxbaLlpDEyR1+x6--