From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5Uq-0004dQ-P5 for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:21:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO5Ul-0002rc-1a for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:21:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5Uk-0002rO-Qd for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:20:54 -0500 Date: Wed, 18 Feb 2015 15:20:26 +0100 From: Kevin Wolf Message-ID: <20150218142026.GE4996@noname.str.redhat.com> References: <1423564888-14933-1-git-send-email-kwolf@redhat.com> <1423564888-14933-3-git-send-email-kwolf@redhat.com> <20150218135051.GF7629@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20150218135051.GF7629@stefanha-thinkpad.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: Stefan Hajnoczi Cc: stefanha@redhat.com, pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wu.wubin@huawei.com --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 18.02.2015 um 14:50 hat Stefan Hajnoczi geschrieben: > 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_in= t.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, >=20 > This makes the ucontext code harder to understand because > CoroutineAction values are used with setjmp()/longjmp() in > qemu_coroutine_switch(). >=20 > The longjmp() man page says: >=20 > If longjmp() is invoked with a second argument of 0, 1 will be > returned instead. >=20 > I haven't checked whether or not this causes problems, but the code > would be simpler if we avoided using 0. It doesn't, the value is unused where we pass COROUTINE_ENTER. But I can make it 3 instead. Kevin --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJU5J+qAAoJEH8JsnLIjy/WSyQQAL2qHq0O4CVrzPkWXRz/sIET R9NboyIFY6Wl68LpeMwb0MeP7RnV35q9zxfHGBi2t9j6q/rh9Bri8U5lm4b4rzcH ikGE8stVSbVogNYWTtTQ8qyFhvWs93B2t6e+bLtx4zV3QvUia4lUXQZDweIIZ+FC rkBV9xVptMtL8asqjtCWDAoaW1fKQtrVJMMgZuygMn7Cqhko2QitoaWBqkAYIprJ wX0I+E6Fs3kdYjhNLD0Ra5uMMmy3jq/1CVUedz+jsWyEZ2biGseDO1A9ew/u5jFK 9UOBW5OZDuEQE7xOSgpQRT4HklO+afuJZ29CzHP8CHunr1l3wEKcoCEAgOaKToeg 0LV7J7pUckrJ8/Ui6/2AqmFIMonw1DwIUCNGSrT2lKq7Okp4O5Dv05PCK6/SNJyN xTH5ko/3Gcs6AVJcZO6qWaSngirWnJ3iHOPWTnYGgtZYiOtUmzFP9JdXCaIMM0NU 8urHrcliq5NGfKblRB5PFfZVc6U6vzAscFyt2aacBrX8wp/4EhUejAI9GeqeYKiF Vbux61ZhovyDVd8cWeJ3627fVdRUdxgS/IlEY9jmtjq7cs29hJ+lj1lsQv/dJMuF oMNg/ZeaX33p1J1x+ogHQUPMHKajIEhJhy2AtK5IKiqA0wdQAd0g8IuMkm+ZIF/B zSDqBYEZqXnU1s1w+Gtd =CjV0 -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--