From: Baolu Lu <baolu.lu@linux.intel.com>
To: Nicolin Chen <nicolinc@nvidia.com>,
joro@8bytes.org, kevin.tian@intel.com, jgg@nvidia.com
Cc: will@kernel.org, robin.murphy@arm.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, xueshuai@linux.alibaba.com
Subject: Re: [PATCH rc v7 5/6] iommu: Fix ATS invalidation timeouts during __iommu_remove_group_pasid()
Date: Fri, 24 Apr 2026 14:23:17 +0800 [thread overview]
Message-ID: <5170df16-94f0-4d12-803a-a43bc44aed83@linux.intel.com> (raw)
In-Reply-To: <8914b746d0e19b05a26c1fc5d14f170336faa3d2.1776551790.git.nicolinc@nvidia.com>
On 4/19/26 07:41, Nicolin Chen wrote:
> If a device is blocked, its PASID domains are already detached. Repeating
> iommu_remove_dev_pasid() is unnecessary and might trigger ATS invalidation
> timeouts.
>
> Skip the iommu_remove_dev_pasid() call upon the blocked flag.
>
> Fixes: c279e83953d9 ("iommu: Introduce pci_dev_reset_iommu_prepare/done()")
> Cc: stable@vger.kernel.org
> Reported-by: Kevin Tian <kevin.tian@intel.com>
> Closes: https://lore.kernel.org/all/BN9PR11MB5276D60096EBF15C5753C4BB8C202@BN9PR11MB5276.namprd11.prod.outlook.com/
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> drivers/iommu/iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index ff181db687bbf..30ba18e613faa 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -3554,7 +3554,8 @@ static void __iommu_remove_group_pasid(struct iommu_group *group,
> struct group_device *device;
>
> for_each_group_device(group, device) {
> - if (device->dev->iommu->max_pasids > 0)
> + /* Device might be already detached for a device recovery */
> + if (!device->blocked && device->dev->iommu->max_pasids > 0)
> iommu_remove_dev_pasid(device->dev, pasid, domain);
> }
> }
If that is the case, why not add the same logic to the set_group_pasid
path? For example:
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 61c12ba78206..42a979ee0ced 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3532,7 +3532,7 @@ static int __iommu_set_group_pasid(struct
iommu_domain *domain,
int ret;
for_each_group_device(group, device) {
- if (device->dev->iommu->max_pasids > 0) {
+ if (!device->blocked && device->dev->iommu->max_pasids >
0) {
ret = domain->ops->set_dev_pasid(domain,
device->dev,
pasid, old);
if (ret)
By the way, now that I see the device->dev->iommu->max_pasids > 0 check
in the set_pasid path, I understand why you added the same check to the
remove path in patch 3/6. :-)
Thanks,
baolu
next prev parent reply other threads:[~2026-04-24 6:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 23:41 [PATCH rc v7 0/6] iommu: Fix pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 1/6] iommu: Fix kdocs of pci_dev_reset_iommu_done() Nicolin Chen
2026-04-24 5:09 ` Baolu Lu
2026-04-18 23:41 ` [PATCH rc v7 2/6] iommu: Replace per-group resetting_domain with per-gdev blocked flag Nicolin Chen
2026-04-24 5:27 ` Baolu Lu
2026-04-18 23:41 ` [PATCH rc v7 3/6] iommu: Fix pasid attach in pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-24 5:49 ` Baolu Lu
2026-04-24 19:28 ` Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 4/6] iommu: Fix nested pci_dev_reset_iommu_prepare/done() Nicolin Chen
2026-04-24 6:12 ` Baolu Lu
2026-04-18 23:41 ` [PATCH rc v7 5/6] iommu: Fix ATS invalidation timeouts during __iommu_remove_group_pasid() Nicolin Chen
2026-04-21 7:15 ` Tian, Kevin
2026-04-21 17:57 ` Nicolin Chen
2026-04-22 2:03 ` Tian, Kevin
2026-04-24 6:23 ` Baolu Lu [this message]
2026-04-24 19:39 ` Nicolin Chen
2026-04-18 23:41 ` [PATCH rc v7 6/6] iommu: Fix UAF in pci_dev_reset_iommu_done() due to concurrent detach Nicolin Chen
2026-04-21 7:41 ` Tian, Kevin
2026-04-21 18:10 ` Nicolin Chen
2026-04-22 1:56 ` Tian, Kevin
2026-04-24 6:44 ` Baolu Lu
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=5170df16-94f0-4d12-803a-a43bc44aed83@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=xueshuai@linux.alibaba.com \
/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