From: Pranjal Shrivastava <praan@google.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>,
Alex Williamson <alex@shazbot.org>,
David Matlack <dmatlack@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>
Cc: Mostafa Saleh <smostafa@google.com>,
Daniel Mentz <danielmentz@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
iommu@lists.linux.dev, kvm@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
Logan Odell <loganodell@google.com>,
Pranjal Shrivastava <praan@google.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 3/7] iommupt: Enable per-domain IOPT attribution
Date: Thu, 1 Oct 2026 22:45:27 +0000 [thread overview]
Message-ID: <20261001224531.765278-4-praan@google.com> (raw)
In-Reply-To: <20261001224531.765278-1-praan@google.com>
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 <praan@google.com>
---
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
next prev parent reply other threads:[~2026-10-01 22:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261001224531.765278-1-praan@google.com>
2026-10-01 22:45 ` [RFC PATCH 1/7] iommu: Add infrastructure for per-domain IOPT accounting Pranjal Shrivastava
2026-10-01 22:45 ` [RFC PATCH 2/7] iommu: Implement domain-attributed page allocation Pranjal Shrivastava
2026-10-01 22:45 ` Pranjal Shrivastava [this message]
2026-10-01 22:45 ` [RFC PATCH 4/7] vfio/type1: Expose IO page table usage via fdinfo Pranjal Shrivastava
2026-10-01 22:45 ` [RFC PATCH 5/7] iommufd: " Pranjal Shrivastava
2026-10-01 22:45 ` [RFC PATCH 6/7] iommufd/selftest: Add observability test for iommu-nr-pages Pranjal Shrivastava
2026-10-01 22:45 ` [RFC PATCH 7/7] vfio/selftests: Add observability test for IO page table usage Pranjal Shrivastava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261001224531.765278-4-praan@google.com \
--to=praan@google.com \
--cc=alex@shazbot.org \
--cc=corbet@lwn.net \
--cc=danielmentz@google.com \
--cc=dmatlack@google.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=loganodell@google.com \
--cc=rdunlap@infradead.org \
--cc=robin.murphy@arm.com \
--cc=skhan@linuxfoundation.org \
--cc=skhawaja@google.com \
--cc=smostafa@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®