Received: from eggs.gnu.org ([2001:4830:134:3::10]:36663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK278-0006ae-7r for qemu-devel@nongnu.org; Tue, 28 Jul 2015 06:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK273-0003O1-9T for qemu-devel@nongnu.org; Tue, 28 Jul 2015 06:28:02 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:42297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK273-0003NY-17 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 06:27:57 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 28 Jul 2015 11:27:53 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 545931B08077 for ; Tue, 28 Jul 2015 11:27:49 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t6SAQTTI34799664 for ; Tue, 28 Jul 2015 10:26:29 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t6SAQTpp031534 for ; Tue, 28 Jul 2015 04:26:29 -0600 Date: Tue, 28 Jul 2015 12:26:26 +0200 From: Cornelia Huck Message-ID: <20150728122626.7d9eeabf.cornelia.huck@de.ibm.com> In-Reply-To: <20150728083446.GC32719@stefanha-thinkpad.redhat.com> References: <1438014819-18125-1-git-send-email-stefanha@redhat.com> <20150728090700.73f001d3.cornelia.huck@de.ibm.com> <20150728100226.49bafc67.cornelia.huck@de.ibm.com> <20150728083446.GC32719@stefanha-thinkpad.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.4 0/2] AioContext: fix deadlock after aio_context_acquire() race List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, Paolo Bonzini On Tue, 28 Jul 2015 09:34:46 +0100 Stefan Hajnoczi wrote: > On Tue, Jul 28, 2015 at 10:02:26AM +0200, Cornelia Huck wrote: > > On Tue, 28 Jul 2015 09:07:00 +0200 > > Cornelia Huck wrote: > > > > > On Mon, 27 Jul 2015 17:33:37 +0100 > > > Stefan Hajnoczi wrote: > > > > > > > See Patch 2 for details on the deadlock after two aio_context_acquire() calls > > > > race. This caused dataplane to hang on startup. > > > > > > > > Patch 1 is a memory leak fix for AioContext that's needed by Patch 2. > > > > > > > > Stefan Hajnoczi (2): > > > > AioContext: avoid leaking BHs on cleanup > > > > AioContext: force event loop iteration using BH > > > > > > > > async.c | 29 +++++++++++++++++++++++++++-- > > > > include/block/aio.h | 3 +++ > > > > 2 files changed, 30 insertions(+), 2 deletions(-) > > > > > > > > > > Just gave this a try: The stripped-down guest that hangs during startup > > > on master is working fine with these patches applied, and my full setup > > > works as well. > > > > > > So, > > > > > > Tested-by: Cornelia Huck > > > > Uh-oh, spoke too soon. It starts, but when I try a virsh managedsave, I > > get > > > > qemu-system-s390x: /data/git/yyy/qemu/async.c:242: aio_ctx_finalize: Assertion `ctx->first_bh->deleted' failed. > > Please pretty-print ctx->first_bh in gdb. In particular, which function > is ctx->first_bh->cb pointing to? (gdb) p/x *(QEMUBH *)ctx->first_bh $2 = {ctx = 0x9aab3730, cb = 0x801b7c5c, opaque = 0x3ff9800dee0, next = 0x3ff9800dfb0, scheduled = 0x0, idle = 0x0, deleted = 0x0} cb is pointing at spawn_thread_bh_fn. > > I tried reproducing with qemu-system-x86_64 and a RHEL 7 guest but > couldn't trigger the assertion failure. I use the old x-data-plane attribute; if I turn it off, I don't hit the assertion. > > This assertion means that there is an *existing* QEMUBH memory leak. It > is not introduced by this patch series. If we run out of time for QEMU > 2.4, it would be acceptable to replace the assertion with: > > /* TODO track down leaked BHs and turn this into an assertion */ > if (ctx->first_bh->deleted) { > g_free(ctx->first_bh); > }