aboutsummaryrefslogtreecommitdiff
path: root/kmod
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-02-25 11:31:45 -0500
committerThanos <tmakatos@gmail.com>2020-02-28 11:06:47 +0000
commit4af9ad8d3428d49ff0a7d668441d47eb5b7be89a (patch)
tree80ae3f24dce60db4a24fc591a9fce4f1af098da4 /kmod
parentc563455c4bc76bd8b3635545d2c38cff3a57db81 (diff)
downloadlibvfio-user-4af9ad8d3428d49ff0a7d668441d47eb5b7be89a.zip
libvfio-user-4af9ad8d3428d49ff0a7d668441d47eb5b7be89a.tar.gz
libvfio-user-4af9ad8d3428d49ff0a7d668441d47eb5b7be89a.tar.bz2
ignore non-existent DMA regions when unmapping
The problem of not receiving a DMA unmap looks like it will be solved by having VFIO send us the DMA unmap even if we haven't called vfio_pin_pages, so instead of failing for regions we haven't mapped (e.g. non-shared regions) we simply ignore that operation. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'kmod')
-rw-r--r--kmod/muser.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kmod/muser.c b/kmod/muser.c
index 718c5fa..796b6b1 100644
--- a/kmod/muser.c
+++ b/kmod/muser.c
@@ -714,9 +714,18 @@ static int muser_iommu_dma_unmap(struct muser_dev *const mudev,
mutex_lock(&mudev->dev_lock);
dma_map = __find_dma_map(mudev, unmap->iova);
if (!dma_map) {
+ /*
+ * XXX We no longer use vfio_pin_pages() so VFIO doesn't send
+ * DMA unmap events at all. We've patched vfio_iommu_type1 to
+ * send DMA unmap events even if we haven't pinned any of the
+ * pages of a particular region (e.g. the VMA is not
+ * shareable), so we have to ignore requests for such regions.
+ * This behaviormight be temprorary, depending on whether or
+ * not this solution gets accepted. For more information see:
+ * https://www.redhat.com/archives/vfio-users/2020-February/msg00016.html.
+ */
mutex_unlock(&mudev->dev_lock);
- muser_dbg("failed to find dma map for iova:%llu\n", unmap->iova);
- return -EINVAL;
+ return 0;
}
list_del(&dma_map->entry);
mutex_unlock(&mudev->dev_lock);