From: Lu Baolu <baolu.lu@linux.intel.com>
To: iommu@lists.linux.dev
Cc: Kevin Tian <kevin.tian@intel.com>,
linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com>,
stable@vger.kernel.org
Subject: [PATCH 1/1] iommu/vt-d: Block translation before removing IOPF in blocking attach
Date: Mon, 23 Nov 2026 08:43:10 +0800 [thread overview]
Message-ID: <20261123004310.2828884-1-baolu.lu@linux.intel.com> (raw)
blocking_domain_attach_dev() drops the old domain's IOPF reference before
it calls device_block_translation(). When that is the last reference,
intel_iommu_disable_iopf() calls iopf_queue_remove_device() while the RID
still translates through the old domain and its page requests are still
being reported. This is wrong in two ways:
- iopf_queue_remove_device() requires that no iommu_report_device_fault()
is still running for the device. A report can have linked its group
into the pending list without having called the iopf_handler yet;
iopf_queue_remove_device() then responds to and frees that group, and
the reporter hands the freed group to the handler.
- With iopf_refcount already zero, the drain in
device_block_translation() -> intel_pasid_tear_down_entry() ->
intel_iommu_drain_pasid_prq() returns early, so the PRQ for the RID is
never drained on this path at all.
The removal was placed first by commit 17fce9d2336d ("iommu/vt-d: Put
iopf enablement in domain attach path") because the old domain was then
taken from info->domain, which device_block_translation() clears.
Commit 91b55eb171cb ("iommu/vt-d: Use old domain parameter when attaching
the blocking domain") switched to the @old parameter, so the order can now
be swapped. Backports need that commit as well.
Fixes: 17fce9d2336d ("iommu/vt-d: Put iopf enablement in domain attach path")
Cc: stable@vger.kernel.org
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 5a2e705a2f2e..a8c0ccae844e 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2897,8 +2897,8 @@ static int blocking_domain_attach_dev(struct iommu_domain *domain,
struct device *dev,
struct iommu_domain *old)
{
- iopf_for_domain_remove(old, dev);
device_block_translation(dev);
+ iopf_for_domain_remove(old, dev);
return 0;
}
--
2.43.0
reply other threads:[~2026-11-23 0:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261123004310.2828884-1-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.