From patchwork Thu Mar 17 15:02:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8612151 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B09B59F3D1 for ; Thu, 17 Mar 2016 15:05:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 126572026F for ; Thu, 17 Mar 2016 15:05:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BDDD2026C for ; Thu, 17 Mar 2016 15:05:21 +0000 (UTC) Received: from localhost ([::1]:35740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agZUG-0001Tz-ER for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 11:05:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agZRo-00053B-7k for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agZRi-0001eb-Jf for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:02:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agZRb-0001Zf-RG; Thu, 17 Mar 2016 11:02:35 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5825FC942B; Thu, 17 Mar 2016 15:02:35 +0000 (UTC) Received: from [10.36.112.50] (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HF2UY9022828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Mar 2016 11:02:32 -0400 To: Christian Borntraeger , tu bo , Fam Zheng , qemu-devel@nongnu.org References: <1458123018-18651-1-git-send-email-famz@redhat.com> <56E9355A.5070700@redhat.com> <56E93A22.1080102@de.ibm.com> <56E93ECE.10103@redhat.com> <56E9425C.8030201@de.ibm.com> <56E957AD.2050005@redhat.com> <56E961EA.4090908@de.ibm.com> <56EAA170.1000904@linux.vnet.ibm.com> <56EAA576.8020709@de.ibm.com> From: Paolo Bonzini Message-ID: <56EAC706.2040006@redhat.com> Date: Thu, 17 Mar 2016 16:02:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56EAA576.8020709@de.ibm.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , cornelia.huck@de.ibm.com, Stefan Hajnoczi , qemu-block@nongnu.org, "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCH 0/4] Tweaks around virtio-blk start/stop 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 17/03/2016 13:39, Christian Borntraeger wrote: > As an interesting side note, I updated my system from F20 to F23 some days ago > (after the initial report). While To Bo is still on a F20 system. I was not able > to reproduce the original crash on f23. but going back to F20 made this > problem re-appear. > > Stack trace of thread 26429: > #0 0x00000000802008aa tracked_request_begin (qemu-system-s390x) > #1 0x0000000080203f3c bdrv_co_do_preadv (qemu-system-s390x) > #2 0x000000008020567c bdrv_co_do_readv (qemu-system-s390x) > #3 0x000000008025d0f4 coroutine_trampoline (qemu-system-s390x) > #4 0x000003ff943d150a __makecontext_ret (libc.so.6) > > this is with patch 2-4 plus the removal of virtio_queue_host_notifier_read. > > Without removing virtio_queue_host_notifier_read, I get the same mutex lockup (as expected). > > Maybe we have two independent issues here and this is some old bug in glibc or > whatever? I'm happy to try and reproduce on x86 if you give me some instruction (RHEL7 should be close enough to Fedora 20). Can you add an assert in virtio_blk_handle_output to catch reentrancy, like ? Paolo diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index a7ec572..96ea896 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -591,6 +591,8 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) return; } + int x = atomic_fetch_inc(&s->test); + assert(x == 0); blk_io_plug(s->blk); while ((req = virtio_blk_get_request(s))) { @@ -602,6 +604,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) } blk_io_unplug(s->blk); + atomic_dec(&s->test); } static void virtio_blk_dma_restart_bh(void *opaque) diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index ae84d92..6472503 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -48,6 +48,7 @@ typedef struct VirtIOBlock { BlockBackend *blk; VirtQueue *vq; void *rq; + int test; QEMUBH *bh; VirtIOBlkConf conf; unsigned short sector_mask;