From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Parav Pandit <parav@mellanox.com>,
Liuxiangdong <liuxiangdong5@huawei.com>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Eric Blake <eblake@redhat.com>,
Zhu Lingshan <lingshan.zhu@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Gonglei (Arei)" <arei.gonglei@huawei.com>,
Eli Cohen <eli@mellanox.com>, Cornelia Huck <cohuck@redhat.com>,
Gautam Dawar <gdawar@xilinx.com>,
Jason Wang <jasowang@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Harpreet Singh Anand <hanand@xilinx.com>,
Cindy Lu <lulu@redhat.com>
Subject: [PATCH v10 02/12] vhost: use SVQ element ndescs instead of opaque data for desc validation
Date: Tue, 23 Aug 2022 20:30:27 +0200 [thread overview]
Message-ID: <20220823183037.98470-3-eperezma@redhat.com> (raw)
In-Reply-To: <20220823183037.98470-1-eperezma@redhat.com>
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
next prev parent reply other threads:[~2022-08-23 18:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 18:30 [PATCH v10 00/12] NIC vhost-vdpa state restore via Shadow CVQ Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 01/12] vhost: stop transfer elem ownership in vhost_handle_guest_kick Eugenio Pérez
2022-08-23 18:30 ` Eugenio Pérez [this message]
2022-08-23 18:30 ` [PATCH v10 03/12] vhost: Delete useless read memory barrier Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 04/12] vhost: Do not depend on !NULL VirtQueueElement on vhost_svq_flush Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 05/12] vhost_net: Add NetClientInfo start callback Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 06/12] vhost_net: Add NetClientInfo stop callback Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 07/12] vdpa: add net_vhost_vdpa_cvq_info NetClientInfo Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 08/12] vdpa: Move command buffers map to start of net device Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 09/12] vdpa: extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 10/12] vhost_net: add NetClientState->load() callback Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 11/12] vdpa: Add virtio-net mac address via CVQ at start Eugenio Pérez
2022-08-23 18:30 ` [PATCH v10 12/12] vdpa: Delete CVQ migration blocker Eugenio Pérez
2022-08-24 2:32 ` [PATCH v10 00/12] NIC vhost-vdpa state restore via Shadow CVQ Jason Wang
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=20220823183037.98470-3-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=eblake@redhat.com \
--cc=eli@mellanox.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=jasowang@redhat.com \
--cc=lingshan.zhu@intel.com \
--cc=liuxiangdong5@huawei.com \
--cc=lulu@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
/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).