From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCjT-0005H2-Vd for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:19:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULCjO-0005As-S0 for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:19:07 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:44307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCjO-0005Am-Lp for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:19:02 -0400 Received: by mail-wi0-f182.google.com with SMTP id hi18so3217049wib.15 for ; Thu, 28 Mar 2013 06:19:02 -0700 (PDT) Date: Thu, 28 Mar 2013 14:18:58 +0100 From: Stefan Hajnoczi Message-ID: <20130328131858.GA22865@stefanha-thinkpad.redhat.com> References: <1363589264-31606-1-git-send-email-harryxiyou@gmail.com> <20130318111028.GC11058@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] HLFS driver for QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: harryxiyou Cc: cloudxy@googlegroups.com, qemu-devel On Thu, Mar 28, 2013 at 03:36:23PM +0800, harryxiyou wrote: > On Mon, Mar 18, 2013 at 7:10 PM, Stefan Hajnoczi 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