From: Andrea Arcangeli <aarcange@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] fix bdrv_read/write_em and qemu_aio_flush
Date: Sat, 30 May 2009 14:17:10 +0200 [thread overview]
Message-ID: <20090530121709.GA22104@random.random> (raw)
In-Reply-To: <20090530100842.GA28053@lst.de>
Hi Christoph,
On Sat, May 30, 2009 at 12:08:42PM +0200, Christoph Hellwig wrote:
> On Thu, May 28, 2009 at 06:33:10PM +0200, Andrea Arcangeli wrote:
> > Hello,
> >
> > the debug code in my ide_dma_cancel patch (not yet included upstream)
> > made us notice that when qemu_aio_flush returns, there are still
> > pending aio commands that waits to complete. Auditing the code I found
> > strange stuff like the fact qemu_aio_waits does nothing if there's an
> > unrelated (no aio related) bh executed. And I think I found the reason
> > of why there was still pending aio when qemu_aio_flush because
> > qemu_aio_wait does a lot more than wait, it can start aio, and if the
> > previous ->io_flush returned zero, the loop ends and ->io_flush isn't
> > repeated. The fact an unrelated bh can make qemu_aio_wait a noop seems
> > troublesome for all callers that aren't calling qemu_aio_wait in a
> > loop like qemu_aio_flush, so I preferred to change those callers to a
> > safer qemu_aio_flush in case the bh executed generates more pending
> > I/O. What you think about this patch against qemu git?
>
> Looks good to me. In my unsubmitted aio support patches for qemu-io
> I had to call qemu_aio_wait at least twice to get aio requests reliably
> completed, but with this patch and calling qemu_aio_flush it always
> completes all requests.
Exactly! In effect this could be slightly optimized in the future, if
we could track a single aio request, instead of waiting for them all.
This is a bit the equivalent of 'sync' instead of wait_on_page in the
kernel, because we don't have a wait_on_page here, so we've to flush
them all to be safe from bh execution. Given the potential of not
waiting and I/O corruption or misbehavior of ide.c because of
qemu_aio_flush returning too early without my patch, I think it's good
idea to apply.
next prev parent reply other threads:[~2009-05-30 12:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 16:33 [Qemu-devel] fix bdrv_read/write_em and qemu_aio_flush Andrea Arcangeli
2009-05-30 10:08 ` Christoph Hellwig
2009-05-30 12:17 ` Andrea Arcangeli [this message]
2009-06-04 11:26 ` [Qemu-devel] [PATCH] fix qemu_aio_flush Andrea Arcangeli
2009-06-04 11:51 ` [Qemu-devel] " Kevin Wolf
2009-06-05 15:57 ` [Qemu-devel] " Christoph Hellwig
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=20090530121709.GA22104@random.random \
--to=aarcange@redhat.com \
--cc=hch@lst.de \
--cc=qemu-devel@nongnu.org \
/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.