qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] HLFS driver for QEMU


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] HLFS driver for QEMU
Date: Thu, 28 Mar 2013 14:18:58 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Mar 28, 2013 at 03:36:23PM +0800, harryxiyou wrote:
> On Mon, Mar 18, 2013 at 7:10 PM, Stefan Hajnoczi <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]