From patchwork Fri Aug 15 17:06:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 380383 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 72BE4140093 for ; Sat, 16 Aug 2014 03:30:24 +1000 (EST) Received: from localhost ([::1]:60822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XILKY-0004wt-HV for incoming@patchwork.ozlabs.org; Fri, 15 Aug 2014 13:30:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIKzN-0007HL-V2 for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIKzH-0000Px-Lg for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIKzH-0000Pg-D1 for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:23 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7FH8IMY015741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Aug 2014 13:08:18 -0400 Received: from localhost (ovpn-112-32.ams2.redhat.com [10.36.112.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7FH8Gho023054; Fri, 15 Aug 2014 13:08:17 -0400 From: Stefan Hajnoczi To: Date: Fri, 15 Aug 2014 18:06:41 +0100 Message-Id: <1408122422-13935-35-git-send-email-stefanha@redhat.com> In-Reply-To: <1408122422-13935-1-git-send-email-stefanha@redhat.com> References: <1408122422-13935-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Cornelia Huck , Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 34/55] dataplane: stop trying on notifier error 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 From: Cornelia Huck If we fail to set up guest or host notifiers, there's no use trying again every time the guest kicks, so disable dataplane in that case. Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 94e1a29..24a6b71 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -28,6 +28,7 @@ struct VirtIOBlockDataPlane { bool started; bool starting; bool stopping; + bool disabled; VirtIOBlkConf *blk; @@ -220,7 +221,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) VirtQueue *vq; int r; - if (s->started) { + if (s->started || s->disabled) { return; } @@ -274,6 +275,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) k->set_guest_notifiers(qbus->parent, 1, false); fail_guest_notifiers: vring_teardown(&s->vring, s->vdev, 0); + s->disabled = true; fail_vring: s->starting = false; } @@ -284,6 +286,13 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); + + + /* Better luck next time. */ + if (s->disabled) { + s->disabled = false; + return; + } if (!s->started || s->stopping) { return; }