[PATCH 0/2] iommu/io-pgtable-arm: fix missed dirty pages in read_and_clear_dirty()

Seongjun Hong hsj0512 at snu.ac.kr
Mon Oct 26 06:36:42 PDT 2026


Fix missed dirty pages report in read_and_clear_dirty(), which is
caused by 1) unaligned iova walk address, and 2) missing iotlb invalidation.

First, align down the iova walk address with page size, noticing that
small dirty pages following large page block (e.g., 2M) because requested
iova start address can be in the middle of the page block.

Second, use io_pgtable_tlb_add_page() on visiting dirty ptes instead of
iommu_iotlb_gather_add_range(), which is called in iommu_dirty_bitmap_record()
and does not update gather->pgsize, so that arm_smmu_iotlb_sync() does not
invalidate the cleared pte from the iotlb.

Thanks,
Seongjun

Signed-off-by: Seongjun Hong <hsj0512 at snu.ac.kr>
---
Seongjun Hong (2):
      iommu/io-pgtable-arm: align next walk address to large page size
      iommu/io-pgtable-arm: invalidate iotlb on dirty pte read_and_clear

 drivers/iommu/io-pgtable-arm.c | 15 ++++++++++++---
 include/linux/iommu.h          | 17 -----------------
 2 files changed, 12 insertions(+), 20 deletions(-)
---
base-commit: 6b4b543fa18757297ac756a6fe6e64f506b7844a
change-id: 20261026-iommu-arm-fix-missing-dirty-pages-3754a7b18b19

Best regards,
-- 
Seongjun Hong




More information about the linux-arm-kernel mailing list