qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: pbonzini@redhat.com, famz@redhat.com
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] virtio-scsi: dataplane: stop trying on notifier error
Date: Wed, 15 Oct 2014 15:15:26 +0200	[thread overview]
Message-ID: <1413378926-52442-4-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1413378926-52442-1-git-send-email-cornelia.huck@de.ibm.com>

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 <cornelia.huck@de.ibm.com>
---
 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

  parent reply	other threads:[~2014-10-15 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15 13:15 [Qemu-devel] [PATCH 0/3] virtio-scsi-dataplane: graceful fail Cornelia Huck
2014-10-15 13:15 ` [Qemu-devel] [PATCH 1/3] virtio-scsi: dataplane: print why starting failed Cornelia Huck
2014-10-15 13:15 ` [Qemu-devel] [PATCH 2/3] virtio-scsi: dataplane: fail setup gracefully Cornelia Huck
2014-10-15 13:15 ` Cornelia Huck [this message]
2014-10-21 12:51 ` [Qemu-devel] [PATCH 0/3] virtio-scsi-dataplane: graceful fail Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413378926-52442-4-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).