qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Pen <roman.penyaev@profitbricks.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()
Date: Tue, 19 Jul 2016 12:36:25 +0200	[thread overview]
Message-ID: <89cdbaae-9c8c-dda9-6574-84d3633e4a1c@redhat.com> (raw)
In-Reply-To: <1468923921-24868-4-git-send-email-roman.penyaev@profitbricks.com>



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 == -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 == len && !QSIMPLEQ_EMPTY(&s->io_q.pending));
>      s->io_q.blocked = (s->io_q.in_queue > 0);
> +
> +    if (s->io_q.in_flight) {
> +        /* We can try to complete something just right away if there are
> +         * still requests in-flight. */
> +        qemu_laio_process_completions(s);
> +    }

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.

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

>  }
>  
>  void laio_io_plug(BlockDriverState *bs, LinuxAioState *s)

  reply	other threads:[~2016-07-19 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 10:25 [Qemu-devel] [PATCH 0/3] linux-aio: reduce completion latency Roman Pen
2016-07-19 10:25 ` [Qemu-devel] [PATCH 1/3] linux-aio: consume events in userspace instead of calling io_getevents Roman Pen
2016-07-19 10:25 ` [Qemu-devel] [PATCH 2/3] linux-aio: split processing events function Roman Pen
2016-07-19 10:25 ` [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit() Roman Pen
2016-07-19 10:36   ` Paolo Bonzini [this message]
2016-07-19 11:18     ` Roman Penyaev
2016-07-19 11:30       ` Paolo Bonzini
2016-07-19 11:44       ` Roman Penyaev
2016-07-19 11:47         ` Paolo Bonzini
2016-07-19 11:52           ` Roman Penyaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89cdbaae-9c8c-dda9-6574-84d3633e4a1c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roman.penyaev@profitbricks.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).