From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, ming.lei@canonical.com, pl@kamp.de,
stefanha@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH 3/3] linux-aio: Don't reenter request coroutine recursively
Date: Thu, 4 Dec 2014 15:37:10 +0100 [thread overview]
Message-ID: <20141204143710.GE5129@noname.redhat.com> (raw)
In-Reply-To: <1417013204-30676-4-git-send-email-kwolf@redhat.com>
Am 26.11.2014 um 15:46 hat Kevin Wolf geschrieben:
> When getting an error while submitting requests, we must be careful to
> wake up only inactive coroutines. Therefore we must special-case the
> currently active coroutine and communicate an error for that request
> using the ordinary return value of ioq_submit().
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/linux-aio.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
Ming, did you have a look at this patch specifically? Does it fix the
issue that you tried to address with a much more complex callback-based
patch?
I'd like to go forward with this as both Peter and I have measured
considerable performance improvements with our optimisation proposals,
and this series is an important part of it.
Kevin
> diff --git a/block/linux-aio.c b/block/linux-aio.c
> index 99b259d..fd8f0e4 100644
> --- a/block/linux-aio.c
> +++ b/block/linux-aio.c
> @@ -177,12 +177,19 @@ static int ioq_submit(struct qemu_laio_state *s)
> container_of(s->io_q.iocbs[i], struct qemu_laiocb, iocb);
>
> laiocb->ret = (ret < 0) ? ret : -EIO;
> - qemu_laio_process_completion(s, laiocb);
> + if (laiocb->co != qemu_coroutine_self()) {
> + qemu_coroutine_enter(laiocb->co, NULL);
> + } else {
> + /* The return value is used for the currently active coroutine.
> + * We're always in ioq_enqueue() here, ioq_submit() never runs from
> + * a request's coroutine.*/
> + ret = laiocb->ret;
> + }
> }
> return ret;
> }
>
> -static void ioq_enqueue(struct qemu_laio_state *s, struct iocb *iocb)
> +static int ioq_enqueue(struct qemu_laio_state *s, struct iocb *iocb)
> {
> unsigned int idx = s->io_q.idx;
>
> @@ -191,7 +198,9 @@ static void ioq_enqueue(struct qemu_laio_state *s, struct iocb *iocb)
>
> /* submit immediately if queue is full */
> if (idx == s->io_q.size) {
> - ioq_submit(s);
> + return ioq_submit(s);
> + } else {
> + return 0;
> }
> }
>
> @@ -253,11 +262,11 @@ int laio_submit_co(BlockDriverState *bs, void *aio_ctx, int fd,
>
> if (!s->io_q.plugged) {
> ret = io_submit(s->ctx, 1, &iocbs);
> - if (ret < 0) {
> - return ret;
> - }
> } else {
> - ioq_enqueue(s, iocbs);
> + ret = ioq_enqueue(s, iocbs);
> + }
> + if (ret < 0) {
> + return ret;
> }
>
> qemu_coroutine_yield();
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2014-12-04 14:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 14:46 [Qemu-devel] [RFC PATCH 0/3] linux-aio: Convert to coroutines Kevin Wolf
2014-11-26 14:46 ` [Qemu-devel] [RFC PATCH 1/3] qemu-img bench Kevin Wolf
2014-11-28 11:49 ` Stefan Hajnoczi
2014-11-28 12:19 ` Kevin Wolf
2014-12-01 11:15 ` Stefan Hajnoczi
2014-11-26 14:46 ` [Qemu-devel] [RFC PATCH 2/3] raw-posix: Convert Linux AIO submission to coroutines Kevin Wolf
2014-11-27 9:50 ` Peter Lieven
2014-11-28 12:57 ` Kevin Wolf
2014-11-28 13:44 ` Kevin Wolf
2014-11-28 2:59 ` Ming Lei
2014-11-28 7:33 ` Markus Armbruster
2014-11-28 8:12 ` Ming Lei
2014-11-28 8:59 ` Markus Armbruster
2014-11-28 9:15 ` Ming Lei
2014-11-28 9:44 ` Paolo Bonzini
2014-11-28 10:06 ` Kevin Wolf
2014-11-26 14:46 ` [Qemu-devel] [RFC PATCH 3/3] linux-aio: Don't reenter request coroutine recursively Kevin Wolf
2014-12-04 14:37 ` Kevin Wolf [this message]
2014-12-04 15:22 ` Ming Lei
2014-12-04 15:39 ` Kevin Wolf
2014-12-04 15:45 ` Ming Lei
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=20141204143710.GE5129@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=ming.lei@canonical.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--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).