Re: [PATCH v4] vfio/type1: Adopt fast IOTLB flush interface when unmap IOVAs

From: Suravee Suthikulpanit
Date: Thu Feb 01 2018 - 00:11:48 EST


Alex,

On 1/31/18 4:45 PM, Suravee Suthikulpanit wrote:
Currently, VFIO IOMMU type1 unmaps IOVA pages synchronously, which requires
IOTLB flush for every IOVA unmap. This results in a large number of IOTLB
flushes during initialization of pass-through devices.

This can be avoided using the asynchronous (fast) IOTLB flush interface.

Cc: Alex Williamson<alex.williamson@xxxxxxxxxx>
Cc: Joerg Roedel<joro@xxxxxxxxxx>
Signed-off-by: Suravee Suthikulpanit<suravee.suthikulpanit@xxxxxxx>
---

Changes from v3 (https://lkml.org/lkml/2018/1/21/244)
* Refactor the code to unmap_unpin_fast() and unmap_unpin_slow()
to improve code readability.
* Fix logic in vfio_unmap_unpin() to fallback to unmap_unpin_slow()
only for the failing iova unmapping, and continue the next unmapping
with the unmap_unpin_fast(). (per Alex)
* Fix error handling in case of failing to do fast unmapping to warn
only once.
* Remove reference to GPU in the commit message.

Please ignore v4. I found an issue in error handling logic. Also, I need to change
the return value back to size_t (as this was in a discussed in a separate thread).

Sorry for confusion. I'll clean up and send out v5.

Thanks,
Suravee