From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCUNx-0000Kj-8Y for qemu-devel@nongnu.org; Tue, 27 Mar 2012 07:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCUNr-00066E-2M for qemu-devel@nongnu.org; Tue, 27 Mar 2012 07:16:20 -0400 Received: from mail-wg0-f53.google.com ([74.125.82.53]:56432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCUNq-000665-Q1 for qemu-devel@nongnu.org; Tue, 27 Mar 2012 07:16:14 -0400 Received: by wgbfm10 with SMTP id fm10so4667554wgb.10 for ; Tue, 27 Mar 2012 04:16:12 -0700 (PDT) Date: Tue, 27 Mar 2012 07:52:59 +0100 From: Stefan Hajnoczi Message-ID: <20120327065259.GA17933@stefanha-thinkpad.localdomain> References: <1331603611-9103-1-git-send-email-zwu.kernel@gmail.com> <4F685230.9040209@redhat.com> <4F6854B2.8000209@redhat.com> <20120320114442.GA30819@stefanha-thinkpad.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] block: add the support to drain throttled requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: Kevin Wolf , Paolo Bonzini , Zhi Yong Wu , qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, Mar 27, 2012 at 12:29:09PM +0800, Zhi Yong Wu wrote: > On Mon, Mar 26, 2012 at 10:21 PM, Stefan Hajnoczi wrote: > > On Tue, Mar 20, 2012 at 11:44 AM, Stefan Hajnoczi > > wrote: > >> On Tue, Mar 20, 2012 at 10:58:10AM +0100, Kevin Wolf wrote: > >>> Am 20.03.2012 10:47, schrieb Paolo Bonzini: > >>> > Il 20/03/2012 10:40, Zhi Yong Wu ha scritto: > >>> >> HI, Kevin, > >>> >> > >>> >> We hope that I/O throttling can be shipped without known issue in QEMU > >>> >> 1.1, so if you are available, can you give this patch some love? > >>> > > >>> > I'm sorry to say this, but I think I/O throttling is impossible to save. > >>> >  As it is implemented now, it just cannot work in the presence of > >>> > synchronous I/O, except at the cost of busy waiting with the global > >>> > mutex taken.  See the message from Stefan yesterday. > >>> > >>> qemu_aio_flush() is busy waiting with the global mutex taken anyway, so > >>> it doesn't change that much. > >> > >> Yesterday I only posted an analysis of the bug but here are some > >> thoughts on how to move forward.  Throttling itself is not the problem. > >> We've known that synchronous operations in the vcpu thread are a problem > >> long before throttling.  This is just another reason to convert device > >> emulation to use asynchronous interfaces. > >> > >> Here is the list of device models that perform synchronous block I/O: > >> hw/fdc.c > >> hw/ide/atapi.c > >> hw/ide/core.c > >> hw/nand.c > >> hw/onenand.c > >> hw/pflash_cfi01.c > >> hw/pflash_cfi02.c > >> hw/sd.c > >> > >> Zhi Hui Li is working on hw/fdc.c and recently sent a patch. > >> > >> I think it's too close to QEMU 1.1 to convert all the remaining devices > >> and test them properly before the soft-freeze.  But it's probably > >> possible to convert IDE before the soft-freeze. > >> > >> In the meantime we could add this to bdrv_rw_co(): > >> > >> if (bs->io_limits_enabled) { > >>    fprintf(stderr, "Disabling I/O throttling on '%s' due " > >>            "to synchronous I/O\n", bdrv_get_device_name(bs)); > >>    bdrv_io_limits_disable(bs); > >> } > >> > >> It's not pretty but tells the user there is an issue and avoids > >> deadlocking. > > > > No one has commented on this suggestion.  I think leaving a known hang > > in QEMU 1.1 is undesirable.  Better to have this warning and disable > > throttling in the case we cannot support right now. > IDE is using both sync API and async API when guest boot. Yes, a warning patch must handle the synchronous I/O case during startup (guessing disk geometry), which I think happens even for virtio-blk. Stefan