[RFC] Use SMMU HTTU for DMA dirty page tracking
kevin.tian at intel.com
Wed May 27 03:27:45 UTC 2020
> From: Xiang Zheng
> Sent: Monday, May 25, 2020 7:34 PM
> [+cc Kirti, Yan, Alex]
> On 2020/5/23 1:14, Jean-Philippe Brucker wrote:
> > Hi,
> > On Tue, May 19, 2020 at 05:42:55PM +0800, Xiang Zheng wrote:
> >> Hi all,
> >> Is there any plan for enabling SMMU HTTU?
> > Not outside of SVA, as far as I know.
> >> I have seen the patch locates in the SVA series patch, which adds
> >> support for HTTU:
> >> https://www.spinics.net/lists/arm-kernel/msg798694.html
> >> HTTU reduces the number of access faults on SMMU fault queue
> >> (permission faults also benifit from it).
> >> Besides reducing the faults, HTTU also helps to track dirty pages for
> >> device DMA. Is it feasible to utilize HTTU to get dirty pages on device
> >> DMA during VFIO live migration?
> > As you know there is a VFIO interface for this under discussion:
> > https://lore.kernel.org/kvm/1589781397-28368-1-git-send-email-
> kwankhede at nvidia.com/
> > It doesn't implement an internal API to communicate with the IOMMU
> > about dirty pages.
We plan to add such API later, e.g. to utilize A/D bit in VT-d 2nd-level
page tables (Rev 3.0).
> >> If SMMU can track dirty pages, devices are not required to implement
> >> additional dirty pages tracking to support VFIO live migration.
> > It seems feasible, though tracking it in the device might be more
> > efficient. I might have misunderstood but I think for live migration of
> > the Intel NIC they trap guest accesses to the device and introspect its
> > state to figure out which pages it is accessing.
Does HTTU implement A/D-like mechanism in SMMU page tables, or just
report dirty pages in a log buffer? Either way tracking dirty pages in IOMMU
side is generic thus doesn't require device-specific tweak like in Intel NIC.
> > With HTTU I suppose (without much knowledge about live migration) that
> > you'd need several new interfaces to the IOMMU drivers:
> > * A way for VFIO to query HTTU support in the SMMU. There are some
> > discussions about communicating more IOMMU capabilities through VFIO
> > no implementation yet. When HTTU isn't supported the DIRTY_PAGES
> > would report all pages as they do now.
> > * VFIO_IOMMU_DIRTY_PAGES_FLAG_START/STOP would clear the dirty bit
> > for all VFIO mappings (which is going to take some time). There is a
> > walker in io-pgtable for iova_to_phys() which could be extended. I
> > suppose it's also possible to atomically switch the HA and HD bits in
> > context descriptors.
> Maybe we need not switch HA and HD bits, just turn on them all the time?
> > * VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP would query the dirty
> bit for all
> > VFIO mappings.
> I think we need to consider the case of IOMMU dirty pages logging. We want
> to test Kirti's VFIO migration patches combined with SMMU HTTU, any
> iommu mailing list
> iommu at lists.linux-foundation.org
More information about the iommu