From patchwork Sun Apr 3 10:37:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 8733961 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 8D24E9F36E for ; Sun, 3 Apr 2016 10:37:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF520200E8 for ; Sun, 3 Apr 2016 10:37:44 +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 34ECE200DE for ; Sun, 3 Apr 2016 10:37:44 +0000 (UTC) Received: from localhost ([::1]:52803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amfPb-0001rK-HZ for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Apr 2016 06:37:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amfPU-0001q6-Pu for qemu-devel@nongnu.org; Sun, 03 Apr 2016 06:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1amfPT-0002yz-W1 for qemu-devel@nongnu.org; Sun, 03 Apr 2016 06:37:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38991) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1amfPN-0002xt-Ul; Sun, 03 Apr 2016 06:37:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42708811A2; Sun, 3 Apr 2016 10:37:29 +0000 (UTC) Received: from redhat.com (vpn1-4-6.ams2.redhat.com [10.36.4.6]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u33AbPLS026368; Sun, 3 Apr 2016 06:37:27 -0400 Date: Sun, 3 Apr 2016 13:37:25 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1459679740-17519-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Kevin Wolf , qemu-block@nongnu.org, Christian Borntraeger , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini Subject: [Qemu-devel] [PATCH] virtio-blk: assert on starting/stopping 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 Reentrancy cannot happen while the BQL is being held, so we should never enter this condition. Cc: Christian Borntraeger Cc: Cornelia Huck Cc: Paolo Bonzini Signed-off-by: Michael S. Tsirkin --- This is a replacement for [PATCH 9/9] virtio: remove starting/stopping checks Christian, could you please give it a spin with debug enabled? Since you reported above Paolo's patch triggers segfaults, I expect this one to trigger assertions as well, which should give us more info on the root cause. hw/block/dataplane/virtio-blk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index fd06726..04e0e0d 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -203,10 +203,12 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); int r; - if (vblk->dataplane_started || s->starting) { + if (vblk->dataplane_started) { return; } + assert(!s->starting); + s->starting = true; s->vq = virtio_get_queue(s->vdev, 0); @@ -257,10 +259,12 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); - if (!vblk->dataplane_started || s->stopping) { + if (!vblk->dataplane_started) { return; } + assert(!s->stopping); + /* Better luck next time. */ if (vblk->dataplane_disabled) { vblk->dataplane_disabled = false;