All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: <iommu@lists.linux.dev>, <joro@8bytes.org>
Cc: <will@kernel.org>, <robin.murphy@arm.com>,
	<suravee.suthikulpanit@amd.com>,
	Vasant Hegde <vasant.hegde@amd.com>,
	"Max Zhen" <max.zhen@amd.com>, Liang Wendy <Wendy.Liang@amd.com>
Subject: [PATCH] iommu/amd: Remove iommu_group_mutex_assert() from amd_iommu_clear_gcr3()
Date: Fri, 14 Aug 2026 10:40:29 +0000	[thread overview]
Message-ID: <20260814104029.71021-1-vasant.hegde@amd.com> (raw)

amd_iommu_clear_gcr3() is called from sva_mn_release() during the
mmu_notifier release path to detach a PASIDs when a process exits.
This path does not hold the iommu group mutex, since it is invoked
asynchronously from mm teardown context rather than through the normal
IOMMU group/attach APIs.

As a result, the iommu_group_mutex_assert() check in
amd_iommu_clear_gcr3() logs a kernel warning.

[62863.761300] ------------[ cut here ]------------
[62863.761320] WARNING: drivers/iommu/iommu.c:1361 at iommu_group_mutex_assert+0x3a/0x50, CPU#14: kworker/14:2/621
...
[62863.761706]  <TASK>
[62863.761712]  amd_iommu_clear_gcr3+0x1e/0x50
[62863.761724]  sva_mn_release+0x68/0xd0
[62863.761739]  __mmu_notifier_release+0xb9/0x2d0
[62863.761763]  exit_mmap+0x427/0x460
[62863.761836]  __mmput+0x41/0x120
[62863.761844]  mmput_async_fn+0x15/0x20
[62863.761852]  process_one_work+0x22e/0x780
[62863.761876]  worker_thread+0x1b5/0x380
[62863.761892]  kthread+0x10d/0x150
[62863.761913]  ret_from_fork+0x346/0x3c0
[62863.761930]  ret_from_fork_asm+0x1a/0x30
[62863.761964]  </TASK>

Remove the iommu_group_mutex_assert() call from
amd_iommu_clear_gcr3(), since PASID teardown via the mmu_notifier
release path is a legitimate caller that does not and need not hold
the group mutex.

Fixes: 1af95763e0a3 ("iommu/amd: Initial SVA support for AMD IOMMU")
Reported-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Tested-by: Liang Wendy <Wendy.Liang@amd.com>
---
 drivers/iommu/amd/iommu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 29dc18d3d22e..1fe99fb98793 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2063,8 +2063,6 @@ int amd_iommu_clear_gcr3(struct iommu_dev_data *dev_data, ioasid_t pasid)
 	struct gcr3_tbl_info *gcr3_info = &dev_data->gcr3_info;
 	int ret;
 
-	iommu_group_mutex_assert(dev_data->dev);
-
 	ret = update_gcr3(dev_data, pasid, 0, false);
 	if (ret)
 		return ret;
-- 
2.31.1


             reply	other threads:[~2026-08-14 10:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 10:40 Vasant Hegde [this message]
2026-08-17 13:51 ` [PATCH] iommu/amd: Remove iommu_group_mutex_assert() from amd_iommu_clear_gcr3() Jason Gunthorpe
2026-09-07 12:28 ` Jörg Rödel

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=20260814104029.71021-1-vasant.hegde@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=Wendy.Liang@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=max.zhen@amd.com \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.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 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.