[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 55/56] virtio: clear signalled_used_valid when swit
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 55/56] virtio: clear signalled_used_valid when switching from dataplane |
Date: |
Tue, 13 Aug 2013 10:11:19 -0500 |
From: Stefan Hajnoczi <address@hidden>
When the dataplane thread stops, its vring.c implementation synchronizes
vring state back to virtio.c so we can continue emulating the virtio
device.
This patch ensures that virtio.c's signalled_used_valid flag is reset so
that we do not suppress guest notifications due to stale signalled_used
values.
Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
(cherry picked from commit 6793dfd1b6a99a79b9f2e3c4d6625ccd6513f240)
Signed-off-by: Michael Roth <address@hidden>
---
hw/virtio/dataplane/vring.c | 1 +
hw/virtio/virtio.c | 5 +++++
include/hw/virtio/virtio.h | 1 +
3 files changed, 7 insertions(+)
diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
index 82cc151..351a343 100644
--- a/hw/virtio/dataplane/vring.c
+++ b/hw/virtio/dataplane/vring.c
@@ -52,6 +52,7 @@ bool vring_setup(Vring *vring, VirtIODevice *vdev, int n)
void vring_teardown(Vring *vring, VirtIODevice *vdev, int n)
{
virtio_queue_set_last_avail_idx(vdev, n, vring->last_avail_idx);
+ virtio_queue_invalidate_signalled_used(vdev, n);
hostmem_finalize(&vring->hostmem);
}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 8176c14..a5251cb 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1025,6 +1025,11 @@ void virtio_queue_set_last_avail_idx(VirtIODevice *vdev,
int n, uint16_t idx)
vdev->vq[n].last_avail_idx = idx;
}
+void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n)
+{
+ vdev->vq[n].signalled_used_valid = false;
+}
+
VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n)
{
return vdev->vq + n;
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index a6c5c53..f2aa6a3 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -233,6 +233,7 @@ hwaddr virtio_queue_get_used_size(VirtIODevice *vdev, int
n);
hwaddr virtio_queue_get_ring_size(VirtIODevice *vdev, int n);
uint16_t virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n);
void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx);
+void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n);
VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n);
uint16_t virtio_get_queue_index(VirtQueue *vq);
int virtio_queue_get_id(VirtQueue *vq);
--
1.7.9.5
- [Qemu-stable] [PATCH 38/56] dataplane: refuse to start if device is already in use, (continued)
- [Qemu-stable] [PATCH 38/56] dataplane: refuse to start if device is already in use, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 32/56] block: Add return value for bdrv_flush_all(), Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 39/56] xhci: handle USB_RET_IOERROR, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 33/56] cpus: Add return value for vm_stop(), Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 40/56] qemu-char: Register ring buffer driver with correct name "ringbuf", Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 41/56] qapi: Rename ChardevBackend member "memory" to "ringbuf", Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 43/56] pci-bridge: update mappings for migration/restore, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 34/56] cpus: Let vm_stop[_force_state]() always flush block devices, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 45/56] chardev: fix CHR_EVENT_OPENED events for mux chardevs, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 54/56] dataplane: sync virtio.c and vring.c virtqueue state, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 55/56] virtio: clear signalled_used_valid when switching from dataplane,
Michael Roth <=
- [Qemu-stable] [PATCH 49/56] target-i386: Fix X86CPU error handling, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 47/56] seccomp: add additional asynchronous I/O syscalls, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 56/56] vhost: clear signalled_used_valid on vhost stop, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 53/56] i82801b11: Fix i82801b11 PCI host bridge config space, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 48/56] iov: handle EOF in iov_send_recv, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 52/56] Bugfix for loading multiboot kernels, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 51/56] semaphore: fix a hangup problem under load on NetBSD hosts., Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 50/56] ignore SIGPIPE in qemu-img and qemu-io, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 46/56] seccomp: add arch_prctl() to the syscall whitelist, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 44/56] xhci: fix segfault, Michael Roth, 2013/08/13