From: Jamie Lokier <jamie@shareable.org>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net,
Anthony Liguori <aliguori@us.ibm.com>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [Qemu-devel] Re: [kvm-devel] [PATCH 1/3] Refactor AIO interface to allow other AIO implementations
Date: Fri, 18 Apr 2008 13:43:19 +0100 [thread overview]
Message-ID: <20080418124319.GC25089@shareable.org> (raw)
In-Reply-To: <20080417200024.GC11916@redhat.com>
Daniel P. Berrange wrote:
> > Those cases aren't always discoverable. Linux-aio just falls back to
> > using synchronous IO. It's pretty terrible. We need a new AIO
> > interface for Linux (and yes, we're working on this). Once we have
> > something better, we'll change that to be the default and things will
> > Just Work for most users.
>
> If QEMU can't discover cases where it won't work, what criteria should
> the end user use to decide between the impls, or for that matter, what
> criteria should a management api/app like libvirt use ? If the only decision
> logic is 'try it & benchmark your VM' then its not a particularly useful
> option.
Good use of Linux-AIO requires that you basically "know" which cases
it handles well, and which ones it doesn't. Falling back to
synchronous I/O with no indication (except speed) is a pretty
atrocious API imho. But that's what the Linux folks decided to do.
I suspect what you have to do is:
1. Try opening the file with O_DIRECT.
2. Use fstat to check the filesystem type and block device type.
3. If it's on a whitelist of filesystem types,
4. and a whitelist of block device types,
5. and the kernel version is later than an fs+bd-dependent value,
6. then select an alignment size (kernel version dependent)
and use Linux-AIO with it.
Otherwise don't use Linux-AIO. You may then decide to use Glibc's
POSIX-AIO (which uses threads), or use threads for I/O yourself.
In future, the above recipe will be more complicated, in that you have
to use the same decision tree to decide between:
- Synchronous IO.
- Your own thread based IO.
- Glibc POSIX-AIO using threads.
- Linux-AIO.
- Virtio thing or whatever is based around vringfd.
- Syslets if they gain traction and perform well.
> I've basically got a choice of making libvirt always ad '-aio linux'
> or never add it at all. My inclination is to the latter since it is
> compatible with existing QEMU which has no -aio option. Presumably
> '-aio linux' is intended to provide some performance benefit so it'd
> be nice to use it. If we can't express some criteria under which it
> should be turned on, I can't enable it; where as if you can express
> some criteria, then QEMU should apply them automatically.
I'm of the view that '-aio auto' would be a really good option - and
when it's proven itself, it should be the default. It could work on
all QEMU hosts: it would pick synchronous IO when there is nothing else.
The criteria for selecting a good AIO strategy on Linux are quite
complex, and might be worth hard coding. In that case, putting that
into QEMU itself would be much better than every program which
launches QEMU having it's own implementation of the criteria.
> Pushing this choice of AIO impls to the app or user invoking QEMU just
> does not seem like a win here.
I think having the choice is very good, because whatever the hard
coded selection criteria, there will be times when it's wrong (ideally
in conservative ways - it should always be functional, just suboptimal).
So I do support this patch to add the switch.
But _forcing_ the user to decide is not good, since the criteria are
rather obscure and change with things like filesystem. At least, a
set of command line options to QEMU ought to work when you copy a VM
to another machine!
So I think '-aio auto', which invokes the selection criteria of the
day and is guaranteed to work (conservatively picking a slower method
if it cannot be sure a faster one will work) would be the most useful
option of all.
-- Jamie
next prev parent reply other threads:[~2008-04-18 12:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-17 19:26 [Qemu-devel] [PATCH 1/3] Refactor AIO interface to allow other AIO implementations Anthony Liguori
2008-04-17 19:26 ` [Qemu-devel] [PATCH 2/3] Split out posix-aio code Anthony Liguori
2008-04-17 19:26 ` [Qemu-devel] [PATCH 3/3] Implement linux-aio backend Anthony Liguori
2008-04-18 15:09 ` [Qemu-devel] " Marcelo Tosatti
2008-04-18 15:18 ` Anthony Liguori
2008-04-18 17:46 ` Marcelo Tosatti
2008-04-17 19:38 ` [Qemu-devel] Re: [kvm-devel] [PATCH 1/3] Refactor AIO interface to allow other AIO implementations Daniel P. Berrange
2008-04-17 19:41 ` Anthony Liguori
2008-04-17 20:00 ` Daniel P. Berrange
2008-04-17 20:05 ` Anthony Liguori
2008-04-18 12:43 ` Jamie Lokier [this message]
2008-04-18 15:23 ` Anthony Liguori
2008-04-18 16:22 ` Jamie Lokier
2008-04-18 16:32 ` [kvm-devel] [Qemu-devel] " Avi Kivity
2008-04-20 15:49 ` Jamie Lokier
2008-04-20 18:43 ` Avi Kivity
2008-04-20 23:39 ` Jamie Lokier
2008-04-21 6:39 ` Avi Kivity
2008-04-21 12:10 ` Jamie Lokier
2008-04-22 8:10 ` Avi Kivity
2008-04-22 14:28 ` Jamie Lokier
2008-04-22 14:53 ` Anthony Liguori
2008-04-22 15:05 ` Avi Kivity
2008-04-22 15:23 ` Jamie Lokier
2008-04-22 15:12 ` Jamie Lokier
2008-04-22 15:03 ` Avi Kivity
2008-04-22 15:36 ` Jamie Lokier
2008-05-02 16:37 ` Antonio Vargas
2008-05-02 17:18 ` Jamie Lokier
2008-05-02 17:52 ` Anthony Liguori
2008-05-02 18:24 ` Jamie Lokier
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=20080418124319.GC25089@shareable.org \
--to=jamie@shareable.org \
--cc=aliguori@us.ibm.com \
--cc=berrange@redhat.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=mtosatti@redhat.com \
--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 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).