All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "sochin.jiang" <sochin.jiang@huawei.com>
Cc: kwolf@redhat.com, mreitz@redhat.com,
	"Lulina (A)" <lina.lulina@huawei.com>,
	qemu-block@nongnu.org, "Subo (A)" <subo7@huawei.com>,
	"Fangyi (C)" <eric.fangyi@huawei.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Question: an IO hang problem
Date: Thu, 15 Mar 2018 14:37:46 +0800	[thread overview]
Message-ID: <20180315063746.GD2733@lemon.usersys.redhat.com> (raw)
In-Reply-To: <8848a27f-4bac-b6be-08ab-a366438791a6@huawei.com>

On Tue, 03/13 17:38, sochin.jiang wrote:
> 
>  Hi, guys,
> 
>  Recently, I encountered an IO hang problem in occasion which I cannot reproduce it now.
> 
>  I analyzed this problem carefully, the critical stack is as following:
> 
> 
> After reading the codes in linux-aio.c(see ioq_submit() function), I found two situations could lead us here.
> 
> 1) no AIOs are in flight(s->ioq.in_flight is 0) and another call to io_submit returns -EAGAIN

So if there is no inflight I/O, why it would return -EAGAIN? The tricky thing
here is that since we're not expecting a completion, when should we retry?

> 
> 2) no AIOs are in flight(s->ioq.in_flight is 0) and s->io_q.pending IOs reach to MAX_EVENTS at once

I don't understand this case. We have,

        len = 0;
        QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {
            iocbs[len++] = &aiocb->iocb;
            if (s->io_q.in_flight + len >= MAX_EVENTS) {
                break;
            }
        }

        ret = io_submit(s->ctx, len, iocbs);

If in_flight is 0, only (MAX_EVENTS - 1) requests can be added to iocbs, so
io_submit shouldn't return -EAGAIN.

> 
> In both the two situations above, the do{...}while loop breaks out and set s->io_q.blocked true.
> 
> After that, AIO completion callback will never be called,  ioq_submit() either, all pended requests will hang.
> 
> 
> Is there a proper way we can fix this while do not affect(stuck) the guest ?

Fam

      reply	other threads:[~2018-03-15  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  9:38 [Qemu-devel] Question: an IO hang problem sochin.jiang
2018-03-15  6:37 ` Fam Zheng [this message]

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=20180315063746.GD2733@lemon.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=eric.fangyi@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=lina.lulina@huawei.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sochin.jiang@huawei.com \
    --cc=subo7@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.