Update the _table_alloc() helper in the Generic Page Table library to use the attributed allocator.
By leveraging the pt_iommu structure, which already contains a pointer to the iommu_domain, the library can now automatically attribute page table allocations for all drivers that utilize the generic_pt framework. Thus, any IOMMU driver using the generic PT automatically gains IOPT observability without any additional changes. Signed-off-by: Pranjal Shrivastava <[email protected]> --- drivers/iommu/generic_pt/iommu_pt.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/generic_pt/iommu_pt.h b/drivers/iommu/generic_pt/iommu_pt.h index 07ec2b3ab986..cf07946801d4 100644 --- a/drivers/iommu/generic_pt/iommu_pt.h +++ b/drivers/iommu/generic_pt/iommu_pt.h @@ -416,8 +416,9 @@ static inline struct pt_table_p *_table_alloc(struct pt_common *common, struct pt_iommu *iommu_table = iommu_from_common(common); struct pt_table_p *table_mem; - table_mem = iommu_alloc_pages_node_sz(iommu_table->nid, gfp, - log2_to_int(lg2sz)); + table_mem = iommu_alloc_pages_node_sz_attributed(&iommu_table->domain, + iommu_table->nid, gfp, + log2_to_int(lg2sz)); if (!table_mem) return ERR_PTR(-ENOMEM); @@ -1177,6 +1178,8 @@ static void NS(deinit)(struct pt_iommu *iommu_table) iommu_pages_stop_incoherent_list(&collect.pending.free_list, iommu_table->iommu_device); iommu_put_pages_list(&collect.pending.free_list); + + WARN_ON_ONCE(atomic_long_read(&iommu_table->domain.nr_pages) != 0); } static const struct pt_iommu_ops NS(ops) = { -- 2.56.0.rc1.315.gc6ed9934b7-goog

