[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 25/27] vhost: Do not commit vhost used idx on vhost_virtqueue
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 25/27] vhost: Do not commit vhost used idx on vhost_virtqueue_stop |
Date: |
Fri, 20 Nov 2020 19:51:03 +0100 |
... if sw lm is enabled
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index cb44b9997f..cf000b979f 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1424,17 +1424,22 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
struct vhost_vring_state state = {
.index = vhost_vq_index,
};
- int r;
+ int r = -1;
if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
/* Don't stop the virtqueue which might have not been started */
return;
}
- r = dev->vhost_ops->vhost_get_vring_base(dev, &state);
- if (r < 0) {
- VHOST_OPS_DEBUG("vhost VQ %u ring restore failed: %d", idx, r);
- /* Connection to the backend is broken, so let's sync internal
+ if (!dev->sw_lm_enabled) {
+ r = dev->vhost_ops->vhost_get_vring_base(dev, &state);
+ if (r < 0) {
+ VHOST_OPS_DEBUG("vhost VQ %u ring restore failed: %d", idx, r);
+ }
+ }
+
+ if (!dev->sw_lm_enabled || r < 0) {
+ /* Connection to the backend is unusable, so let's sync internal
* last avail idx to the device used idx.
*/
virtio_queue_restore_last_avail_idx(vdev, idx);
--
2.18.4
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, (continued)
- [RFC PATCH 16/27] virtio: Expose virtqueue_alloc_element, Eugenio Pérez, 2020/11/20
- [RFC PATCH 17/27] vhost: add vhost_vring_set_notification_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 18/27] vhost: add vhost_vring_poll_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 19/27] vhost: add vhost_vring_get_buf_rcu, Eugenio Pérez, 2020/11/20
- [RFC PATCH 20/27] vhost: Return used buffers, Eugenio Pérez, 2020/11/20
- [RFC PATCH 21/27] vhost: Add vhost_virtqueue_memory_unmap, Eugenio Pérez, 2020/11/20
- [RFC PATCH 22/27] vhost: Add vhost_virtqueue_memory_map, Eugenio Pérez, 2020/11/20
- [RFC PATCH 23/27] vhost: unmap qemu's shadow virtqueues on sw live migration, Eugenio Pérez, 2020/11/20
- [RFC PATCH 24/27] vhost: iommu changes, Eugenio Pérez, 2020/11/20
- [RFC PATCH 25/27] vhost: Do not commit vhost used idx on vhost_virtqueue_stop,
Eugenio Pérez <=
- [RFC PATCH 26/27] vhost: Add vhost_hdev_can_sw_lm, Eugenio Pérez, 2020/11/20
- [RFC PATCH 27/27] vhost: forbid vhost devices logging, Eugenio Pérez, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Eugenio Perez Martin, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, no-reply, 2020/11/20
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Jason Wang, 2020/11/25
- Re: [RFC PATCH 00/27] vDPA software assisted live migration, Stefano Garzarella, 2020/11/27