Re: [PATCH v5 2/4] iommu: Add calls for IOMMU_DEBUG_PAGEALLOC
From: Pranjal Shrivastava
Date: Wed Jan 07 2026 - 10:28:22 EST
On Tue, Jan 06, 2026 at 04:21:58PM +0000, Mostafa Saleh wrote:
> Add calls for the new iommu debug config IOMMU_DEBUG_PAGEALLOC:
> - iommu_debug_init: Enable the debug mode if configured by the user.
> - iommu_debug_map: Track iommu pages mapped, using physical address.
> - iommu_debug_unmap_begin: Track start of iommu unmap operation, with
> IOVA and size.
> - iommu_debug_unmap_end: Track the end of unmap operation, passing the
> actual unmapped size versus the tracked one at unmap_begin.
>
> We have to do the unmap_begin/end as once pages are unmapped we lose
> the information of the physical address.
> This is racy, but the API is racy by construction as it uses refcounts
> and doesn't attempt to lock/synchronize with the IOMMU API as that will
> be costly, meaning that possibility of false negative exists.
>
> Signed-off-by: Mostafa Saleh <smostafa@xxxxxxxxxx>
> ---
> drivers/iommu/iommu-debug-pagealloc.c | 28 +++++++++++++
> drivers/iommu/iommu-priv.h | 58 +++++++++++++++++++++++++++
> drivers/iommu/iommu.c | 11 ++++-
> include/linux/iommu-debug-pagealloc.h | 1 +
> 4 files changed, 96 insertions(+), 2 deletions(-)
>
Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
Thanks