[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/40] vdpa: avoid mapping flush across reset
From: |
Si-Wei Liu |
Subject: |
[PATCH 20/40] vdpa: avoid mapping flush across reset |
Date: |
Thu, 7 Dec 2023 09:39:33 -0800 |
Leverage the IOTLB_PERSIST and DESC_ASID features to achieve
a slightly light weight reset path, without resorting to
suspend and resume. Not as best but it offers significant
time saving too, which should somehow play its role in live
migration down time reduction by large.
It benefits two cases:
- normal virtio reset in the VM, e.g. guest reboot, don't
have to tear down all iotlb mapping and set up again.
- SVQ switching, in which data vq's descriptor table and
vrings are moved to a different ASID than where its
buffers reside. Along with the use of persistent iotlb,
it would save substantial time from pinning and mapping
unneccessarily when moving descriptors on to or out of
shadow mode.
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
hw/virtio/vhost-vdpa.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 31e0a55..47c764b 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -633,6 +633,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void
*opaque, Error **errp)
0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH |
0x1ULL << VHOST_BACKEND_F_IOTLB_ASID |
0x1ULL << VHOST_BACKEND_F_DESC_ASID |
+ 0x1ULL << VHOST_BACKEND_F_IOTLB_PERSIST |
0x1ULL << VHOST_BACKEND_F_SUSPEND;
int ret;
@@ -1493,8 +1494,6 @@ static void vhost_vdpa_maybe_flush_map(struct vhost_dev
*dev)
static void vhost_vdpa_reset_status(struct vhost_dev *dev)
{
- struct vhost_vdpa *v = dev->opaque;
-
if (!vhost_vdpa_last_dev(dev)) {
return;
}
@@ -1502,9 +1501,7 @@ static void vhost_vdpa_reset_status(struct vhost_dev *dev)
vhost_vdpa_reset_device(dev);
vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE |
VIRTIO_CONFIG_S_DRIVER);
- memory_listener_unregister(&v->shared->listener);
- v->shared->listener_registered = false;
-
+ vhost_vdpa_maybe_flush_map(dev);
}
static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base,
--
1.8.3.1
- Re: [PATCH 08/40] vdpa: add back vhost_vdpa_net_first_nc_vdpa, (continued)
- [PATCH 22/40] vdpa: factor out vhost_vdpa_map_batch_begin, Si-Wei Liu, 2023/12/07
- [PATCH 25/40] vdpa: add asid to dma_batch_once API, Si-Wei Liu, 2023/12/07
- [PATCH 19/40] vdpa: should avoid map flushing with persistent iotlb, Si-Wei Liu, 2023/12/07
- [PATCH 21/40] vdpa: vhost_vdpa_dma_batch_end_once rename, Si-Wei Liu, 2023/12/07
- [PATCH 16/40] vdpa: indicate SVQ switching via flag, Si-Wei Liu, 2023/12/07
- [PATCH 24/40] vdpa: factor out vhost_vdpa_dma_batch_end, Si-Wei Liu, 2023/12/07
- [PATCH 26/40] vdpa: return int for dma_batch_once API, Si-Wei Liu, 2023/12/07
- [PATCH 27/40] vdpa: add asid to all dma_batch call sites, Si-Wei Liu, 2023/12/07
- [PATCH 20/40] vdpa: avoid mapping flush across reset,
Si-Wei Liu <=
- [PATCH 23/40] vdpa: vhost_vdpa_dma_batch_begin_once rename, Si-Wei Liu, 2023/12/07
- [PATCH 28/40] vdpa: support iotlb_batch_asid, Si-Wei Liu, 2023/12/07
- [PATCH 30/40] vdpa: batch map/unmap op per svq pair basis, Si-Wei Liu, 2023/12/07
- [PATCH 29/40] vdpa: expose API vhost_vdpa_dma_batch_once, Si-Wei Liu, 2023/12/07
- [PATCH 31/40] vdpa: batch map and unmap around cvq svq start/stop, Si-Wei Liu, 2023/12/07
- [PATCH 32/40] vdpa: factor out vhost_vdpa_net_get_nc_vdpa, Si-Wei Liu, 2023/12/07
- [PATCH 34/40] vdpa: fix network breakage after cancelling migration, Si-Wei Liu, 2023/12/07
- [PATCH 35/40] vdpa: add vhost_vdpa_set_address_space_id trace, Si-Wei Liu, 2023/12/07