[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_ent
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive() |
Date: |
Thu, 10 Nov 2016 17:49:32 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
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.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> include/qemu/coroutine.h | 6 ++++++
> util/qemu-coroutine.c | 8 ++++++++
> 2 files changed, 14 insertions(+)
>
> +++ 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?
>
> enum {
> POOL_BATCH_SIZE = 64,
> @@ -131,6 +132,13 @@ void qemu_coroutine_enter(Coroutine *co)
> }
> }
>
> +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 = qemu_coroutine_self();
>
Otherwise:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [RFC PATCH 0/8] quorum: Implement .bdrv_co_preadv/pwritev(), Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 2/8] quorum: Remove s from quorum_aio_get() arguments, Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 1/8] coroutine: Introduce qemu_coroutine_enter_if_inactive(), Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 4/8] quorum: Do cleanup in caller coroutine, Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 3/8] quorum: Implement .bdrv_co_readv/writev, Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 5/8] quorum: Inline quorum_aio_cb(), Kevin Wolf, 2016/11/10
- [Qemu-devel] [RFC PATCH 8/8] quorum: Inline quorum_fifo_aio_cb(), Kevin Wolf, 2016/11/10