From: Felipe Franciosi <felipe@nutanix.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Felipe Franciosi <felipe@nutanix.com>
Subject: [Qemu-devel] [PATCH] vhost-scsi: Update 'ioeventfd_started' with host notifiers
Date: Mon, 7 Nov 2016 09:23:05 -0800 [thread overview]
Message-ID: <1478539385-11249-1-git-send-email-felipe@nutanix.com> (raw)
Following the recent refactor of virtio notfiers [1], more specifically
the patch that uses virtio_bus_set_host_notifier [2] by default, core
virtio code requires 'ioeventfd_started' to be set to true/false when
the host notifiers are configured. Since vhost-scsi uses the legacy
interface, this value is not updated.
When booting a guest with a vhost-scsi backend controller, SeaBIOS will
initially configure the device which sets all notifiers. The guest will
continue to boot fine until the kernel virtio-scsi module reinitialises
the device causing a stop followed by another start. Since
ioeventfd_started was never set to true, the 'stop' operation triggered
by virtio_bus_set_host_notifier() will not result in a call to
virtio_pci_ioeventfd_assign(assign=false). This leaves the memory
regions with stale notifiers and results on the next start triggering
the following assertion:
kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
Aborted
This patch updates ioeventfd_started whenever the notifiers are set or
cleared, fixing this issue.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
[1] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07748.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07760.html
---
hw/scsi/vhost-scsi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 5b26946..1c6e6d4 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -95,6 +95,7 @@ static int vhost_scsi_start(VHostSCSI *s)
if (ret < 0) {
return ret;
}
+ VIRTIO_BUS(qbus)->ioeventfd_started = true;
s->dev.acked_features = vdev->guest_features;
ret = vhost_dev_start(&s->dev, vdev);
@@ -152,6 +153,7 @@ static void vhost_scsi_stop(VHostSCSI *s)
vhost_scsi_clear_endpoint(s);
vhost_dev_stop(&s->dev, vdev);
vhost_dev_disable_notifiers(&s->dev, vdev);
+ VIRTIO_BUS(qbus)->ioeventfd_started = false;
}
static uint64_t vhost_scsi_get_features(VirtIODevice *vdev,
--
1.9.4
next reply other threads:[~2016-11-07 17:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 17:23 Felipe Franciosi [this message]
2016-11-07 17:26 ` [Qemu-devel] [PATCH] vhost-scsi: Update 'ioeventfd_started' with host notifiers Felipe Franciosi
2016-11-07 17:32 ` Paolo Bonzini
2016-11-08 17:18 ` Paolo Bonzini
2016-11-08 17:23 ` Felipe Franciosi
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=1478539385-11249-1-git-send-email-felipe@nutanix.com \
--to=felipe@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).