qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 05/16] io: make qio_channel_yield aware of AioCo


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 05/16] io: make qio_channel_yield aware of AioContexts
Date: Mon, 16 Jan 2017 15:18:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


On 16/01/2017 13:58, Daniel P. Berrange wrote:
>> + * Request that qio_channel_yield() sets I/O handlers on
>> + * the given #AioContext.  If @ctx is %NULL, qio_channel_yield()
>> + * uses QEMU's main thread event loop.
>> + */
> Can you note that it is explicitly permitted to call this while
> inside a qio_channel_yield().

Yes:

 * You can move a #QIOChannel from an #AioContext to another even if
 * I/O handlers are set for a coroutine.  However, #QIOChannel provides
 * no synchronization between the calls to qio_channel_yield() and
 * qio_channel_set_aio_context().
 *
 * Therefore you should first call qio_channel_detach_aio_context()
 * to ensure that the coroutine is not entered concurrently.  Then,
 * while the coroutine has yielded, call qio_channel_set_aio_context(),
 * and then aio_co_schedule() to place the coroutine on the new
 * #AioContext.  The calls to qio_channel_detach_aio_context()
 * and qio_channel_set_aio_context() should be protected with
 * aio_context_acquire() and aio_context_release().

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]