[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter()
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] coroutine: Clean up qemu_coroutine_enter() |
Date: |
Wed, 18 Feb 2015 15:20:26 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
> >
> > 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.
> >
> > Signed-off-by: Kevin Wolf <address@hidden>
> > ---
> > include/block/coroutine_int.h | 1 +
> > qemu-coroutine.c | 36 +++++++++++++++---------------------
> > 2 files changed, 16 insertions(+), 21 deletions(-)
> >
> > 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"
> >
> > typedef enum {
> > + COROUTINE_ENTER = 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.
It doesn't, the value is unused where we pass COROUTINE_ENTER. But I can
make it 3 instead.
Kevin
pgpG00a8a768p.pgp
Description: PGP signature
[Qemu-devel] [PATCH 3/3] test-coroutine: Regression test for yield bug, Kevin Wolf, 2015/02/10
Re: [Qemu-devel] [PATCH 0/3] coroutine: Fix qemu_coroutine_yield(), Kevin Wolf, 2015/02/16