Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH 0/2] Two enhancements to iommu_at[de]tach_device_pasid()
@ 2024-03-27 12:54 Yi Liu
  2024-03-27 12:54 ` [PATCH 1/2] iommu: Pass domain to remove_dev_pasid() op Yi Liu
  2024-03-27 12:54 ` [PATCH 2/2] iommu: Undo pasid attachment only for the devices that have succeeded Yi Liu
  0 siblings, 2 replies; 12+ messages in thread
From: Yi Liu @ 2024-03-27 12:54 UTC (permalink / raw)
  To: joro, jgg, kevin.tian, baolu.lu
  Cc: alex.williamson, robin.murphy, eric.auger, nicolinc, kvm,
	chao.p.peng, yi.l.liu, iommu, zhenzhong.duan, jacob.jun.pan

There are minor mistakes in the iommu set_dev_pasid() and remove_dev_pasid()
paths. The set_dev_pasid() path updates the group->pasid_array first, and
then may call into remove_dev_pasid() in error handling when there are devices
within the group failed to set_dev_pasid. The remove_dev_pasid() callbacks of
the underlying iommu drivers get domain for pasid from the group->pasid_array.
So the remove_dev_pasid() callback may get a wrong domain in the set_dev_pasid()
path. [1] Even the group is singleton, the existing code logic would have
unnecessary warnings in the error handling of the set_dev_pasid() path.

The fix is passing the domain to be detached to the remove_dev_pasid()
callback, and only undo the set_dev_pasid result on the devices that have
succeeded.

[1] https://lore.kernel.org/linux-iommu/20240320123803.GD159172@nvidia.com/

Regards,
	Yi Liu

Yi Liu (2):
  iommu: Pass domain to remove_dev_pasid() op
  iommu: Undo pasid attachment only for the devices that have succeeded

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  9 ++-----
 drivers/iommu/intel/iommu.c                 | 11 +++------
 drivers/iommu/iommu.c                       | 27 ++++++++++++++-------
 include/linux/iommu.h                       |  3 ++-
 4 files changed, 25 insertions(+), 25 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2024-03-28 12:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27 12:54 [PATCH 0/2] Two enhancements to iommu_at[de]tach_device_pasid() Yi Liu
2024-03-27 12:54 ` [PATCH 1/2] iommu: Pass domain to remove_dev_pasid() op Yi Liu
2024-03-27 13:02   ` Jason Gunthorpe
2024-03-27 13:10     ` Yi Liu
2024-03-28 12:38     ` Yi Liu
2024-03-28  3:12   ` Tian, Kevin
2024-03-28  6:28     ` Yi Liu
2024-03-27 12:54 ` [PATCH 2/2] iommu: Undo pasid attachment only for the devices that have succeeded Yi Liu
2024-03-27 13:05   ` Jason Gunthorpe
2024-03-27 13:12     ` Yi Liu
2024-03-28  3:15   ` Tian, Kevin
2024-03-28  6:29     ` Yi Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox