[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 02/12] vhost: use SVQ element ndescs instead of opaque data fo
From: |
Eugenio Pérez |
Subject: |
[PATCH v9 02/12] vhost: use SVQ element ndescs instead of opaque data for desc validation |
Date: |
Fri, 19 Aug 2022 19:00:38 +0200 |
Since we're going to allow SVQ to add elements without the guest's
knowledge and without its own VirtQueueElement, it's easier to check if
an element is a valid head checking a different thing than the
VirtQueueElement.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-shadow-virtqueue.c
b/hw/virtio/vhost-shadow-virtqueue.c
index a1261d4a0f..b35aeef4bd 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -414,7 +414,7 @@ static VirtQueueElement
*vhost_svq_get_buf(VhostShadowVirtqueue *svq,
return NULL;
}
- if (unlikely(!svq->desc_state[used_elem.id].elem)) {
+ if (unlikely(!svq->desc_state[used_elem.id].ndescs)) {
qemu_log_mask(LOG_GUEST_ERROR,
"Device %s says index %u is used, but it was not available",
svq->vdev->name, used_elem.id);
@@ -422,6 +422,7 @@ static VirtQueueElement
*vhost_svq_get_buf(VhostShadowVirtqueue *svq,
}
num = svq->desc_state[used_elem.id].ndescs;
+ svq->desc_state[used_elem.id].ndescs = 0;
last_used_chain = vhost_svq_last_desc_of_chain(svq, num, used_elem.id);
svq->desc_next[last_used_chain] = svq->free_head;
svq->free_head = used_elem.id;
--
2.31.1
- [PATCH v9 00/12] NIC vhost-vdpa state restore via Shadow CVQ, Eugenio Pérez, 2022/08/19
- [PATCH v9 01/12] vhost: stop transfer elem ownership in vhost_handle_guest_kick, Eugenio Pérez, 2022/08/19
- [PATCH v9 03/12] vhost: Delete useless read memory barrier, Eugenio Pérez, 2022/08/19
- [PATCH v9 04/12] vhost: Do not depend on !NULL VirtQueueElement on vhost_svq_flush, Eugenio Pérez, 2022/08/19
- [PATCH v9 05/12] vhost_net: Add NetClientInfo start callback, Eugenio Pérez, 2022/08/19
- [PATCH v9 09/12] vdpa: extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail, Eugenio Pérez, 2022/08/19
- [PATCH v9 06/12] vhost_net: Add NetClientInfo stop callback, Eugenio Pérez, 2022/08/19
- [PATCH v9 02/12] vhost: use SVQ element ndescs instead of opaque data for desc validation,
Eugenio Pérez <=
- [PATCH v9 07/12] vdpa: add net_vhost_vdpa_cvq_info NetClientInfo, Eugenio Pérez, 2022/08/19
- [PATCH v9 08/12] vdpa: Move command buffers map to start of net device, Eugenio Pérez, 2022/08/19
- [PATCH v9 11/12] vdpa: Add virtio-net mac address via CVQ at start, Eugenio Pérez, 2022/08/19
- [PATCH v9 12/12] vdpa: Delete CVQ migration blocker, Eugenio Pérez, 2022/08/19
- [PATCH v9 10/12] vhost_net: add NetClientState->load() callback, Eugenio Pérez, 2022/08/19