Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 1:47 PM, Paolo Bonzini wrote: > > > On 19/07/2016 13:44, Roman Penyaev wrote: >> >> Can this leave I/O stuck if in_queue > 0 && in_flight == 0 after the >> return from qemu_laio_process_completions? I think you need to goto the >> beginning of the funct

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Paolo Bonzini
On 19/07/2016 13:44, Roman Penyaev wrote: >>> >> >>> >> Can this leave I/O stuck if in_queue > 0 && in_flight == 0 after the >>> >> return from qemu_laio_process_completions? I think you need to goto the >>> >> beginning of the function to submit more I/O requests in that case. > Not quite. I s

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 1:18 PM, Roman Penyaev wrote: > On Tue, Jul 19, 2016 at 12:36 PM, Paolo Bonzini wrote: >> >> >> On 19/07/2016 12:25, Roman Pen wrote: >>> if (laiocb->co) { >>> -qemu_coroutine_enter(laiocb->co, NULL); >>> +if (laiocb->co == qemu_coroutine_self()) { >>>

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Paolo Bonzini
On 19/07/2016 13:18, Roman Penyaev wrote: >> > No need for this new field. You can just do nothing here and check >> > laiocb.ret == -EINPROGRESS here in laio_co_submit. > > I have thought but did not like it, because we depend on the value, > which kernel writes there. (The kernel actually wr

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 12:36 PM, Paolo Bonzini wrote: > > > On 19/07/2016 12:25, Roman Pen wrote: >> if (laiocb->co) { >> -qemu_coroutine_enter(laiocb->co, NULL); >> +if (laiocb->co == qemu_coroutine_self()) { >> +laiocb->self_completed = true; > > No need for thi

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Paolo Bonzini
On 19/07/2016 12:25, Roman Pen wrote: > if (laiocb->co) { > -qemu_coroutine_enter(laiocb->co, NULL); > +if (laiocb->co == qemu_coroutine_self()) { > +laiocb->self_completed = true; No need for this new field. You can just do nothing here and check laiocb.ret ==

[Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Pen
In order to reduce completion latency it makes sense to harvest completed requests ASAP. Very fast backend device can complete requests just after submission, so it is worth trying to check ring buffer in order to peek completed requests directly after io_submit() has been called. Indeed, this pa