aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2021-08-12 16:09:33 +0200
committerMichael S. Tsirkin <mst@redhat.com>2021-09-04 09:07:45 -0400
commite6db5df7e2c6e64846f47a6785a9a67f08574790 (patch)
tree5db9674e04eb8a82508f934462baf9e779914edb /include
parent8880cc4362fde4ecdac0b2092318893118206fcf (diff)
downloadqemu-e6db5df7e2c6e64846f47a6785a9a67f08574790.zip
qemu-e6db5df7e2c6e64846f47a6785a9a67f08574790.tar.gz
qemu-e6db5df7e2c6e64846f47a6785a9a67f08574790.tar.bz2
vhost-vdpa: Do not send empty IOTLB update batches
With the introduction of the batch hinting, meaningless batches can be created with no IOTLB updates if the memory region was skipped by vhost_vdpa_listener_skipped_section. This is the case of host notifiers memory regions, device un/realize, and others. This causes the vdpa device to receive dma mapping settings with no changes, a possibly expensive operation for nothing. To avoid that, VHOST_IOTLB_BATCH_BEGIN hint is delayed until we have a meaningful (not skipped section) mapping or unmapping operation, and VHOST_IOTLB_BATCH_END is not written unless at least one of _UPDATE / _INVALIDATE has been issued. v3: * Use a bool instead of a counter avoiding potential number wrapping * Fix bad check on _commit * Move VHOST_BACKEND_F_IOTLB_BATCH check to vhost_vdpa_iotlb_batch_begin_once v2 (from RFC): * Rename misleading name * Abstract start batching function for listener_add/del Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20210812140933.226288-1-eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/virtio/vhost-vdpa.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index 9188226..a8963da 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -22,6 +22,7 @@ typedef struct VhostVDPAHostNotifier {
typedef struct vhost_vdpa {
int device_fd;
uint32_t msg_type;
+ bool iotlb_batch_begin_sent;
MemoryListener listener;
struct vhost_dev *dev;
VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX];