From: Stefan Hajnoczi <stefanha@gmail.com>
To: harryxiyou <harryxiyou@gmail.com>
Cc: cloudxy@googlegroups.com, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] HLFS driver for QEMU
Date: Thu, 28 Mar 2013 14:18:58 +0100 [thread overview]
Message-ID: <20130328131858.GA22865@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAD+1EGPdEPnZ5Y31LdPsbgo4xOw6LuQt8G2cUcF437jSx+O-Zw@mail.gmail.com>
On Thu, Mar 28, 2013 at 03:36:23PM +0800, harryxiyou wrote:
> On Mon, Mar 18, 2013 at 7:10 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> [...]
> > read/write/flush should be either .bdrv_co_* or .bdrv_aio_*.
> >
> > The current code pauses the guest while I/O is in progress! Try running
> > disk I/O benchmarks inside the guest and you'll see that performance and
> > interactivity are poor.
> >
> > QEMU has two ways of implementing efficient block drivers:
> >
> > 1. Coroutines - .bdrv_co_*
> >
> > Good for image formats or block drivers that have internal logic.
> >
> > Each request runs inside a coroutine - see include/block/coroutine.h.
> > In order to wait for I/O, submit an asynchronous request or worker
> > thread and yield the coroutine. When the request completes, re-enter
> > the coroutine and continue.
> >
> > Examples: block/sheepdog.c or block/qcow2.c.
> >
> > 2. Asynchronous I/O - .bdrv_aio_*
> >
> > Good for low-level block drivers that have little logic.
> >
> > The request processing code is split into callbacks. I/O requests are
> > submitted and then the code returns back to QEMU's main loop. When the
> > I/O request completes, a callback is invoked.
> >
> > Examples: block/rbd.c or block/qed.c.
> >
>
> HLFS do not use QEMU's AIO way. HLFS, itself, has realized internal AIO.
You need to perform I/O in a way that does not block QEMU's main loop.
The code you posted blocks the caller until I/O completes, and therefore
blocks QEMU's main loop.
Either you need to use a worker thread approach or add async APIs to
HLFS so it can be integrated into the application (QEMU) main loop
properly.
Stefan
next prev parent reply other threads:[~2013-03-28 13:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 6:47 [Qemu-devel] [PATCH] HLFS driver for QEMU harryxiyou
2013-03-18 11:10 ` Stefan Hajnoczi
2013-03-18 13:36 ` harryxiyou
2013-03-18 15:16 ` Stefan Hajnoczi
2013-03-20 8:43 ` harryxiyou
2013-03-20 10:04 ` Stefan Hajnoczi
2013-03-20 11:17 ` harryxiyou
2013-03-28 7:36 ` harryxiyou
2013-03-28 13:18 ` Stefan Hajnoczi [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-03-18 6:39 harryxiyou
2013-03-16 14:04 harryxiyou
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=20130328131858.GA22865@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=cloudxy@googlegroups.com \
--cc=harryxiyou@gmail.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).