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

2017-01-18 Thread Eric Blake
On 01/18/2017 10:43 AM, Paolo Bonzini wrote: > By the way, v2 will have a better comment on how to use the API: > > + * You can move a #QIOChannel from an #AioContext to another even if s/from an/from one/ > + * I/O handlers are set for a coroutine. However, #QIOChannel provides > + * no synchr

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

2017-01-18 Thread Paolo Bonzini
On 18/01/2017 15:58, Stefan Hajnoczi wrote: > On Fri, Jan 13, 2017 at 02:17:20PM +0100, Paolo Bonzini wrote: >> /** >> + * qio_channel_set_aio_context: >> + * @ioc: the channel object >> + * @ctx: the #AioContext to set the handlers on >> + * >> + * Request that qio_channel_yield() sets I/O hand

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

2017-01-18 Thread Stefan Hajnoczi
On Fri, Jan 13, 2017 at 02:17:20PM +0100, Paolo Bonzini wrote: > /** > + * qio_channel_set_aio_context: > + * @ioc: the channel object > + * @ctx: the #AioContext to set the handlers on > + * > + * Request that qio_channel_yield() sets I/O handlers on > + * the given #AioContext. If @ctx is %NULL

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

2017-01-18 Thread Stefan Hajnoczi
On Mon, Jan 16, 2017 at 12:55:59PM +, Daniel P. Berrange wrote: > On Mon, Jan 16, 2017 at 07:38:24PM +0800, Fam Zheng wrote: > > On Fri, 01/13 14:17, Paolo Bonzini wrote: > > > Support separate coroutines for reading and writing, and place the > > > read/write handlers on the AioContext that th

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

2017-01-16 Thread Paolo Bonzini
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 > i

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

2017-01-16 Thread Daniel P. Berrange
On Mon, Jan 16, 2017 at 08:47:28PM +0800, Fam Zheng wrote: > On Mon, 01/16 13:24, Paolo Bonzini wrote: > > > > > > On 16/01/2017 12:38, Fam Zheng wrote: > > >> +void qio_channel_detach_aio_context(QIOChannel *ioc) > > >> +{ > > >> +ioc->read_coroutine = NULL; > > >> +ioc->write_coroutine

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

2017-01-16 Thread Daniel P. Berrange
On Fri, Jan 13, 2017 at 02:17:20PM +0100, Paolo Bonzini wrote: > Support separate coroutines for reading and writing, and place the > read/write handlers on the AioContext that the QIOChannel is registered > with. > > Signed-off-by: Paolo Bonzini > --- > include/io/channel.h | 37 +

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

2017-01-16 Thread Daniel P. Berrange
On Mon, Jan 16, 2017 at 07:38:24PM +0800, Fam Zheng wrote: > On Fri, 01/13 14:17, Paolo Bonzini wrote: > > Support separate coroutines for reading and writing, and place the > > read/write handlers on the AioContext that the QIOChannel is registered > > with. > > > > Signed-off-by: Paolo Bonzini

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

2017-01-16 Thread Fam Zheng
On Mon, 01/16 13:24, Paolo Bonzini wrote: > > > On 16/01/2017 12:38, Fam Zheng wrote: > >> +void qio_channel_detach_aio_context(QIOChannel *ioc) > >> +{ > >> +ioc->read_coroutine = NULL; > >> +ioc->write_coroutine = NULL; > >> +qio_channel_set_aio_fd_handlers(ioc); > >> +ioc->ctx

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

2017-01-16 Thread Paolo Bonzini
On 16/01/2017 12:38, Fam Zheng wrote: >> +void qio_channel_detach_aio_context(QIOChannel *ioc) >> +{ >> +ioc->read_coroutine = NULL; >> +ioc->write_coroutine = NULL; >> +qio_channel_set_aio_fd_handlers(ioc); >> +ioc->ctx = NULL; > > Why is qio_channel_set_aio_fd_handler not needed

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

2017-01-16 Thread Fam Zheng
On Fri, 01/13 14:17, Paolo Bonzini wrote: > Support separate coroutines for reading and writing, and place the > read/write handlers on the AioContext that the QIOChannel is registered > with. > > Signed-off-by: Paolo Bonzini > --- > include/io/channel.h | 37 ++ > io/chann