Re: [PATCH] iommupt/kunit: Unmap in the tests before freeing the domain
From: Jason Gunthorpe
Date: Wed Sep 09 2026 - 14:11:04 EST
On Mon, 31 Aug 2026 14:42:56 +0800, Yuanhe Shu <xiangzao@xxxxxxxxxxxxxxxxx> wrote:
> test_increase_level(), test_pgsize_boundary() and test_mixed() leave
> their mappings installed and let pt_kunit_iommu_exit() free the whole
> table, while the other cases unmap and then check that the table is
> empty.
>
> Besides being inconsistent, the mappings which survive into
> pt_iommu_deinit() keep the IOMMU_DEBUG_PAGEALLOC references that
> iommu_map() took on the mapped pages. Nothing drops them, so with
> iommu.debug_pagealloc=1 the pages behind the hard-coded test OAs stay
> counted as IOMMU-mapped and every later allocation or free of one of
> them reports:
>
> [...]
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
--
Jason