On 30/01/2017 10:18, Stefan Hajnoczi wrote: > On Fri, Jan 20, 2017 at 05:43:06PM +0100, Paolo Bonzini wrote: >> diff --git a/include/qemu/coroutine_int.h b/include/qemu/coroutine_int.h >> index 14d4f1d..1efa356 100644 >> --- a/include/qemu/coroutine_int.h >> +++ b/include/qemu/coroutine_int.h >> @@ -40,12 +40,20 @@ struct Coroutine { >> CoroutineEntry *entry; >> void *entry_arg; >> Coroutine *caller; >> + >> + /* Only used when the coroutine has terminated. */ >> QSLIST_ENTRY(Coroutine) pool_next; >> size_t locks_held; > > locks_held is used when the coroutine is running. Please add a newline > to separate it from pool_next. > >> >> - /* Coroutines that should be woken up when we yield or terminate */ >> + /* Coroutines that should be woken up when we yield or terminate. >> + * Only used when the coroutine is running. >> + */ >> QSIMPLEQ_HEAD(, Coroutine) co_queue_wakeup; >> + >> + /* Only used when the coroutine is sleeping. */ > > "running", "yielded", and "terminated" are terms with specific meanings. > Is "sleeping" a subset of "yielded" where the coroutine is waiting for a > mutex or its AioContext to schedule it?
No, I'll just change it to "has yielded". >> +static void test_multi_co_schedule_entry(void *opaque) > > Missing coroutine_fn. > >> diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c >> index d2f529b..cb87997 100644 >> --- a/tests/test-vmstate.c >> +++ b/tests/test-vmstate.c >> @@ -33,17 +33,6 @@ >> static char temp_file[] = "/tmp/vmst.test.XXXXXX"; >> static int temp_fd; >> >> -/* Fake yield_until_fd_readable() implementation so we don't have to pull >> the >> - * coroutine code as dependency. >> - */ >> -void yield_until_fd_readable(int fd) >> -{ >> - fd_set fds; >> - FD_ZERO(&fds); >> - FD_SET(fd, &fds); >> - select(fd + 1, &fds, NULL, NULL, NULL); >> -} >> - >> >> /* Duplicate temp_fd and seek to the beginning of the file */ >> static QEMUFile *open_test_file(bool write) > > This should be a separate patch. Yes, it probably doesn't have to be in this series either. Paolo