From patchwork Wed Oct 15 13:15:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 399981 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 31998140085 for ; Thu, 16 Oct 2014 00:18:11 +1100 (EST) Received: from localhost ([::1]:44699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeOSv-0004JN-Ay for incoming@patchwork.ozlabs.org; Wed, 15 Oct 2014 09:18:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeOQd-0000YQ-1F for qemu-devel@nongnu.org; Wed, 15 Oct 2014 09:15:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeOQT-0003ef-Rg for qemu-devel@nongnu.org; Wed, 15 Oct 2014 09:15:46 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:44608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeOQT-0003di-2d for qemu-devel@nongnu.org; Wed, 15 Oct 2014 09:15:37 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 Oct 2014 14:15:36 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 15 Oct 2014 14:15:34 +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 8DEA81B08051 for ; Wed, 15 Oct 2014 14:16:52 +0100 (BST) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9FDFYPR62193912 for ; Wed, 15 Oct 2014 13:15:34 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9FDFXVm005251 for ; Wed, 15 Oct 2014 07:15:33 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s9FDFTGg005084; Wed, 15 Oct 2014 07:15:32 -0600 From: Cornelia Huck To: pbonzini@redhat.com, famz@redhat.com Date: Wed, 15 Oct 2014 15:15:26 +0200 Message-Id: <1413378926-52442-4-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1413378926-52442-1-git-send-email-cornelia.huck@de.ibm.com> References: <1413378926-52442-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14101513-0009-0000-0000-0000018C39E4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.108 Cc: Cornelia Huck , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 3/3] virtio-scsi: 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 There's no use to constantly trying to enable dataplane if we failed to set up guest or host notifiers, so fence it off in that case. We'll try again if the device is reinitialized. Signed-off-by: Cornelia Huck --- hw/scsi/virtio-scsi-dataplane.c | 8 ++++++++ include/hw/virtio/virtio-scsi.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 445219c..30366d9 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -52,6 +52,7 @@ static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s, if (rc != 0) { fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n", rc); + s->dataplane_fenced = true; return NULL; } r->host_notifier = *virtio_queue_get_host_notifier(vq); @@ -191,6 +192,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s) if (s->dataplane_started || s->dataplane_starting || + s->dataplane_fenced || s->ctx != iothread_get_aio_context(vs->conf.iothread)) { return; } @@ -202,6 +204,7 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s) if (rc != 0) { fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), " "ensure -enable-kvm is set\n", rc); + s->dataplane_fenced = true; goto fail_guest_notifiers; } @@ -253,6 +256,11 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s) VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); int i; + /* Better luck next time. */ + if (s->dataplane_fenced) { + s->dataplane_fenced = false; + return; + } if (!s->dataplane_started || s->dataplane_stopping) { return; } diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index d6e5e79..916c320 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -195,6 +195,7 @@ typedef struct VirtIOSCSI { bool dataplane_starting; bool dataplane_stopping; bool dataplane_disabled; + bool dataplane_fenced; Notifier migration_state_notifier; } VirtIOSCSI;