All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Remove iommu_group_mutex_assert() from amd_iommu_clear_gcr3()
@ 2026-08-14 10:40 Vasant Hegde
  2026-08-17 13:51 ` Jason Gunthorpe
  2026-09-07 12:28 ` Jörg Rödel
  0 siblings, 2 replies; 3+ messages in thread
From: Vasant Hegde @ 2026-08-14 10:40 UTC (permalink / raw)
  To: iommu, joro
  Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde, Max Zhen,
	Liang Wendy

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-07 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 10:40 [PATCH] iommu/amd: Remove iommu_group_mutex_assert() from amd_iommu_clear_gcr3() Vasant Hegde
2026-08-17 13:51 ` Jason Gunthorpe
2026-09-07 12:28 ` Jörg Rödel

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.