[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 28/31] vdpa: Expose VHOST_F_LOG_ALL on SVQ
From: |
Eugenio Pérez |
Subject: |
[PATCH 28/31] vdpa: Expose VHOST_F_LOG_ALL on SVQ |
Date: |
Fri, 21 Jan 2022 21:27:30 +0100 |
SVQ is able to log the dirty bits by itself, so let's use it to not
block migration.
Also, ignore set and clear of VHOST_F_LOG_ALL on set_features if SVQ is
enabled. Even if the device supports it, the reports would be nonsense
because SVQ memory is in the qemu region.
The log region is still allocated. Future changes might skip that, but
this series is already long enough.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-vdpa.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index fb0a338baa..75090d65e8 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1022,6 +1022,9 @@ static int vhost_vdpa_get_features(struct vhost_dev *dev,
uint64_t *features)
if (ret == 0 && v->shadow_vqs_enabled) {
/* Filter only features that SVQ can offer to guest */
vhost_svq_valid_guest_features(features);
+
+ /* Add SVQ logging capabilities */
+ *features |= BIT_ULL(VHOST_F_LOG_ALL);
}
return ret;
@@ -1039,8 +1042,25 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
if (v->shadow_vqs_enabled) {
uint64_t dev_features, svq_features, acked_features;
+ uint8_t status = 0;
bool ok;
+ ret = vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &status);
+ if (unlikely(ret)) {
+ return ret;
+ }
+
+ if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
+ /*
+ * vhost is trying to enable or disable _F_LOG, and the device
+ * would report wrong dirty pages. SVQ handles it.
+ */
+ return 0;
+ }
+
+ /* We must not ack _F_LOG if SVQ is enabled */
+ features &= ~BIT_ULL(VHOST_F_LOG_ALL);
+
ret = vhost_vdpa_get_dev_features(dev, &dev_features);
if (ret != 0) {
error_report("Can't get vdpa device features, got (%d)", ret);
--
2.27.0
- Re: [PATCH 21/31] util: Add iova_tree_alloc, (continued)
- [PATCH 20/31] util: Store DMA entries in a list, Eugenio Pérez, 2022/01/21
- [PATCH 22/31] vhost: Add VhostIOVATree, Eugenio Pérez, 2022/01/21
- [PATCH 24/31] vhost: Add vhost_svq_get_last_used_idx, Eugenio Pérez, 2022/01/21
- [PATCH 23/31] vdpa: Add custom IOTLB translations to SVQ, Eugenio Pérez, 2022/01/21
- [PATCH 25/31] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ, Eugenio Pérez, 2022/01/21
- [PATCH 26/31] vdpa: Clear VHOST_VRING_F_LOG at vhost_vdpa_set_vring_addr in SVQ, Eugenio Pérez, 2022/01/21
- [PATCH 27/31] vdpa: Never set log_base addr if SVQ is enabled, Eugenio Pérez, 2022/01/21
- [PATCH 28/31] vdpa: Expose VHOST_F_LOG_ALL on SVQ,
Eugenio Pérez <=
- [PATCH 29/31] vdpa: Make ncs autofree, Eugenio Pérez, 2022/01/21
- [PATCH 30/31] vdpa: Move vhost_vdpa_get_iova_range to net/vhost-vdpa.c, Eugenio Pérez, 2022/01/21
- [PATCH 31/31] vdpa: Add x-svq to NetdevVhostVDPAOptions, Eugenio Pérez, 2022/01/21
- Re: [PATCH 00/31] vDPA shadow virtqueue, Jason Wang, 2022/01/28