From: Yuanhe Shu <xiangzao@linux.alibaba.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Yuanhe Shu <xiangzao@linux.alibaba.com>,
smostafa@google.com, joro@8bytes.org, will@kernel.org,
robin.murphy@arm.com, baolu.lu@linux.intel.com,
kevin.tian@intel.com, praan@google.com, skhawaja@google.com,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iommupt: Drop pagealloc references during domain deinit
Date: Mon, 31 Aug 2026 14:16:20 +0800 [thread overview]
Message-ID: <20260831061623.2164384-1-xiangzao@linux.alibaba.com> (raw)
In-Reply-To: <20260827161828.GA3769797@ziepe.ca>
On Thu, Aug 27, 2026 at 01:18:28PM -0300, Jason Gunthorpe wrote:
> It is not misusing iommupt, but it is definitely misusing any iommu
> API built on top of it. How did you trigger this?
The kunit suite, nothing else. test_pgsize_boundary() maps 128K at a
hard-coded OA and never unmaps it, so with iommu.debug_pagealloc=1 those
32 pages stay counted after pt_iommu_deinit() and every later allocation
or free of one of them WARNs. The out-of-tree module in the cover letter
was something I wrote to confirm the mechanism, not a real driver.
The only non-test path I found that frees a populated domain is
iommu_setup_default_domain(), which releases the old domain with its
IOMMU_RESV_DIRECT mappings still installed. I have not seen that WARN,
presumably because those pages do not come from the page allocator, so it
is not evidence of a bug and I am not proposing to change it.
> If this is the only trigger, then it is different testing things
> interacting badly and I don't think it should be fixed like this.
>
> Probably have the kunits directly unmap as they were being lazy
Agreed, and my "not driver misuse" framing was wrong: the iommupt deinit
contract says nothing about unmapping, but the iommu API above it does.
Dropping this series.
You were right about the tests: adding a count_valids() == 0 check to
pt_kunit_iommu_exit() without touching anything else fails exactly
test_increase_level(), test_pgsize_boundary() and test_mixed(); the other
cases already unmap. I will send that as a single patch.
Thanks,
Yuanhe
next prev parent reply other threads:[~2026-08-31 6:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 14:58 [PATCH 0/2] iommu: Drop IOMMU_DEBUG_PAGEALLOC refs on iommupt domain teardown Yuanhe Shu
2026-08-27 14:58 ` [PATCH 1/2] iommu: Add __iommu_debug_unmap_phys() to drop refs by physical address Yuanhe Shu
2026-08-27 16:13 ` Mostafa Saleh
2026-08-27 16:17 ` Mostafa Saleh
2026-08-27 16:21 ` Jason Gunthorpe
2026-08-31 6:21 ` Yuanhe Shu
2026-08-27 14:58 ` [PATCH 2/2] iommupt: Drop pagealloc references during domain deinit Yuanhe Shu
2026-08-27 16:18 ` Jason Gunthorpe
2026-08-31 6:16 ` Yuanhe Shu [this message]
2026-08-27 16:05 ` [PATCH 0/2] iommu: Drop IOMMU_DEBUG_PAGEALLOC refs on iommupt domain teardown Mostafa Saleh
2026-08-31 6:23 ` Yuanhe Shu
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=20260831061623.2164384-1-xiangzao@linux.alibaba.com \
--to=xiangzao@linux.alibaba.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--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®