From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPSO9-00061N-Q9 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 06:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPSO5-0003f6-J0 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 06:36:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPSO5-0003f2-Da for qemu-devel@nongnu.org; Tue, 19 Jul 2016 06:36:29 -0400 References: <1468923921-24868-1-git-send-email-roman.penyaev@profitbricks.com> <1468923921-24868-4-git-send-email-roman.penyaev@profitbricks.com> From: Paolo Bonzini Message-ID: <89cdbaae-9c8c-dda9-6574-84d3633e4a1c@redhat.com> Date: Tue, 19 Jul 2016 12:36:25 +0200 MIME-Version: 1.0 In-Reply-To: <1468923921-24868-4-git-send-email-roman.penyaev@profitbricks.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Pen Cc: Stefan Hajnoczi , qemu-devel@nongnu.org On 19/07/2016 12:25, Roman Pen wrote: > if (laiocb->co) { > - qemu_coroutine_enter(laiocb->co, NULL); > + if (laiocb->co =3D=3D qemu_coroutine_self()) { > + laiocb->self_completed =3D true; No need for this new field. You can just do nothing here and check laiocb.ret =3D=3D -EINPROGRESS here in laio_co_submit. > + } else { > + qemu_coroutine_enter(laiocb->co, NULL); > + } > } else { > laiocb->common.cb(laiocb->common.opaque, ret); > qemu_aio_unref(laiocb); > @@ -312,6 +317,12 @@ static void ioq_submit(LinuxAioState *s) > QSIMPLEQ_SPLIT_AFTER(&s->io_q.pending, aiocb, next, &completed= ); > } while (ret =3D=3D len && !QSIMPLEQ_EMPTY(&s->io_q.pending)); > s->io_q.blocked =3D (s->io_q.in_queue > 0); > + > + if (s->io_q.in_flight) { > + /* We can try to complete something just right away if there a= re > + * still requests in-flight. */ > + qemu_laio_process_completions(s); > + } Can this leave I/O stuck if in_queue > 0 && in_flight =3D=3D 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. In fact, perhaps it's useful to always do so if any I/Os were completed. Should qemu_laio_process_completions return the number of completed requests? Paolo > } > =20 > void laio_io_plug(BlockDriverState *bs, LinuxAioState *s)