From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
gleb@redhat.com, Jason Wang <jasowang@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Jes Sorensen <Jes.Sorensen@redhat.com>,
Amit Shah <amit.shah@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
armbru@redhat.com, kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] vhost: don't exit on memory errors
Date: Mon, 28 Mar 2011 23:14:22 +0200 [thread overview]
Message-ID: <bf6d533cf690a6ba3b3512207260084f28ae6e88.1301346785.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1301346785.git.mst@redhat.com>
When memory including one of the VQs
goes away, handle that as a guest error
instead of exiting qemu.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/vhost.c | 8 +++++---
hw/vhost.h | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 97a1299..c17a831 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -287,11 +287,11 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev,
l = vq->ring_size;
p = cpu_physical_memory_map(vq->ring_phys, &l, 1);
if (!p || l != vq->ring_size) {
- fprintf(stderr, "Unable to map ring buffer for ring %d\n", i);
+ virtio_error(dev->vdev, "Unable to map ring buffer for ring %d\n", i);
return -ENOMEM;
}
if (p != vq->ring) {
- fprintf(stderr, "Ring buffer relocated for ring %d\n", i);
+ virtio_error(dev->vdev, "Ring buffer relocated for ring %d\n", i);
return -EBUSY;
}
cpu_physical_memory_unmap(p, l, 0, 0);
@@ -330,7 +330,9 @@ static void vhost_client_set_memory(CPUPhysMemoryClient *client,
if (dev->started) {
r = vhost_verify_ring_mappings(dev, start_addr, size);
- assert(r >= 0);
+ if (r < 0) {
+ return;
+ }
}
if (!dev->log_enabled) {
diff --git a/hw/vhost.h b/hw/vhost.h
index c8c595a..90b5bc8 100644
--- a/hw/vhost.h
+++ b/hw/vhost.h
@@ -39,6 +39,7 @@ struct vhost_dev {
vhost_log_chunk_t *log;
unsigned long long log_size;
bool force;
+ VirtIODevice *vdev;
};
int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force);
--
1.7.3.2.91.g446ac
next prev parent reply other threads:[~2011-03-28 21:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 21:13 [Qemu-devel] [PATCH 0/3] virtio and vhost error handling Michael S. Tsirkin
2011-03-28 21:14 ` [Qemu-devel] [PATCH 1/3] virtio: don't exit on guest errors Michael S. Tsirkin
2011-03-29 10:33 ` Amit Shah
2011-03-28 21:14 ` Michael S. Tsirkin [this message]
2011-03-28 21:14 ` [Qemu-devel] [PATCH 3/3] vhost: roll our own cpu map variant Michael S. Tsirkin
2011-03-29 10:53 ` Stefan Hajnoczi
2011-03-30 16:09 ` Michael S. Tsirkin
2011-03-30 16:26 ` Stefan Hajnoczi
2011-03-30 16:59 ` Michael S. Tsirkin
2011-03-30 17:59 ` Stefan Hajnoczi
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=bf6d533cf690a6ba3b3512207260084f28ae6e88.1301346785.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=Jes.Sorensen@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=amit.shah@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=gleb@redhat.com \
--cc=hch@infradead.org \
--cc=jasowang@redhat.com \
--cc=kwolf@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).