From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 From: Cornelia Huck Date: Wed, 15 Oct 2014 15:15:26 +0200 Message-Id: <1413378926-52442-4-git-send-email-cornelia.huck@de.ibm.com> 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> Subject: [Qemu-devel] [PATCH 3/3] virtio-scsi: dataplane: stop trying on notifier error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com, famz@redhat.com Cc: Cornelia Huck , qemu-devel@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; -- 1.8.5.5