From patchwork Mon Jun 10 14:38:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 250257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E94912C007B for ; Tue, 11 Jun 2013 00:39:20 +1000 (EST) Received: from localhost ([::1]:59956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um3Fe-00081G-KC for incoming@patchwork.ozlabs.org; Mon, 10 Jun 2013 10:39:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um3FJ-00080z-IQ for qemu-devel@nongnu.org; Mon, 10 Jun 2013 10:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um3FI-0005cc-4h for qemu-devel@nongnu.org; Mon, 10 Jun 2013 10:38:57 -0400 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:60718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um3FH-0005cQ-UV for qemu-devel@nongnu.org; Mon, 10 Jun 2013 10:38:56 -0400 Received: by mail-ee0-f49.google.com with SMTP id b57so3021761eek.36 for ; Mon, 10 Jun 2013 07:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=rZi3/klpUgkQah9Z5bnJX4oepWxDQyl4js2C4rICA/o=; b=ZwxGrosRFEmHs5HhPgtZc7vZtraOrUZH+Ue2ZwEA4MzHGQpT9GDwBV97GWZb/nXOVI FZPY0lbVELPVBnbNU+GF3ZZHEEF+nozPr6miaKN3TLdZuVj1+DF2WqjMcY1CFF+5Lt0n Alf8JU32lSWZLvP/TrTHaCaBTuBhPlMXR9k8vmMg/hegPUwqAfSQSRJWn4QDb5jUOTa5 /5vcJ46fROG8tFRl2yMziI6hdki7hX3X1pJ5F4++DVSMv9m5U2kqIfWiF9E9wQkfAMh5 sZ9UMltx7nuGnNQIwZBJVDFR+nJVuyikG1H74ywRxOdCZYB13sawuWHfxbtwgGNG89Co /Q8w== X-Received: by 10.14.211.69 with SMTP id v45mr11708225eeo.45.1370875124877; Mon, 10 Jun 2013 07:38:44 -0700 (PDT) Received: from localhost (178-26-141-215-dynip.superkabel.de. [178.26.141.215]) by mx.google.com with ESMTPSA id bk1sm23524315eeb.5.2013.06.10.07.38.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Jun 2013 07:38:44 -0700 (PDT) Date: Mon, 10 Jun 2013 16:38:42 +0200 From: Stefan Hajnoczi To: Kevin Wolf Message-ID: <20130610143842.GB4838@stefanha-thinkpad.redhat.com> References: <1370867173-25755-1-git-send-email-stefanha@redhat.com> <1370867173-25755-2-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1370867173-25755-2-git-send-email-stefanha@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::231 Cc: Kevin Wolf , Anthony Liguori , Ping Fan Liu , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini Subject: Re: [Qemu-devel] [PATCH v3 01/17] block: stop relying on io_flush() in bdrv_drain_all() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Jun 10, 2013 at 02:25:57PM +0200, Stefan Hajnoczi wrote: > @@ -1427,26 +1456,18 @@ void bdrv_close_all(void) > void bdrv_drain_all(void) > { > BlockDriverState *bs; > - bool busy; > - > - do { > - busy = qemu_aio_wait(); > > + while (bdrv_requests_pending_all()) { > /* FIXME: We do not have timer support here, so this is effectively > * a busy wait. > */ > QTAILQ_FOREACH(bs, &bdrv_states, list) { > if (!qemu_co_queue_empty(&bs->throttled_reqs)) { > qemu_co_queue_restart_all(&bs->throttled_reqs); > - busy = true; > } > } > - } while (busy); > > - /* If requests are still pending there is a bug somewhere */ > - QTAILQ_FOREACH(bs, &bdrv_states, list) { > - assert(QLIST_EMPTY(&bs->tracked_requests)); > - assert(qemu_co_queue_empty(&bs->throttled_reqs)); > + qemu_aio_wait(); > } > } tests/ide-test found an issue here: block.c invokes callbacks from a BH so we may not yet have completed the request when this loop terminates. Kevin: can you fold in this patch? diff --git a/block.c b/block.c index 31f7231..e176215 100644 --- a/block.c +++ b/block.c @@ -1469,6 +1469,9 @@ void bdrv_drain_all(void) qemu_aio_wait(); } + + /* Process pending completion BHs */ + aio_poll(qemu_get_aio_context(), false); } /* make a BlockDriverState anonymous by removing from bdrv_state list.