[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 10/20] Gracefully handle ioctl failure in vhost_v
From: |
Antonios Motakis |
Subject: |
[Qemu-devel] [PATCH v9 10/20] Gracefully handle ioctl failure in vhost_virtqueue_stop |
Date: |
Tue, 4 Mar 2014 19:22:53 +0100 |
On stopping the vhost, a call to VHOST_GET_VRING_BASE is issued. The
received value is stored as last_avail_idx, so the virtqueue can continue
operating if the connection is resumed. Handle the failure of this call
and use the current avail_idx. Some packets from the avail ring may be
omitted but still we keep a sane value and can continue on reconnect.
Signed-off-by: Antonios Motakis <address@hidden>
Signed-off-by: Nikolay Nikolaev <address@hidden>
---
hw/virtio/vhost.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 9e336ad..322e2c0 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -758,12 +758,13 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
r = ioctl(dev->control, VHOST_GET_VRING_BASE, &state);
if (r < 0) {
+ state.num = virtio_queue_get_avail_idx(vdev, idx);
fprintf(stderr, "vhost VQ %d ring restore failed: %d\n", idx, r);
fflush(stderr);
}
virtio_queue_set_last_avail_idx(vdev, idx, state.num);
virtio_queue_invalidate_signalled_used(vdev, idx);
- assert (r >= 0);
+
cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, idx),
0, virtio_queue_get_ring_size(vdev, idx));
cpu_physical_memory_unmap(vq->used, virtio_queue_get_used_size(vdev, idx),
--
1.8.3.2
- [Qemu-devel] [PATCH v9 00/20] Vhost and vhost-net support for userspace based backends, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 08/20] Refactor virtio-net to use generic get_vhost_net, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 07/20] vhost_net should call the poll callback only when it is set, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 01/20] Convert -mem-path to QemuOpts and add share property, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 06/20] Add G_IO_HUP handler for socket chardev, Antonios Motakis, 2014/03/04
- Re: [Qemu-devel] [PATCH v9 00/20] Vhost and vhost-net support for userspace based backends, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH v9 12/20] Add vhost_ops to vhost_dev struct and replace all relevant ioctls, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 10/20] Gracefully handle ioctl failure in vhost_virtqueue_stop,
Antonios Motakis <=
- [Qemu-devel] [PATCH v9 05/20] Add chardev API qemu_chr_fe_get_msgfds, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 03/20] Add chardev API qemu_chr_fe_read_all, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 17/20] Add the vhost-user netdev backend to the command line, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 19/20] libqemustub: add stubs to be able to use qemu-char.c, Antonios Motakis, 2014/03/04
- [Qemu-devel] [PATCH v9 20/20] Add qtest for vhost-user, Antonios Motakis, 2014/03/04