Re: [PATCH 2/2] iommu: Undo pasid attachment only for the devices that have succeeded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/3/27 21:05, Jason Gunthorpe wrote:
On Wed, Mar 27, 2024 at 05:54:33AM -0700, Yi Liu wrote:
There is no error handling now in __iommu_set_group_pasid(), it relies on
its caller to loop all the devices to undo the pasid attachment. This is
not self-contained and has unnecessary remove_dev_pasid() calls on the
devices that have not changed in the __iommu_set_group_pasid() call. this
results in unnecessary warnings by the underlying iommu drivers. Like the
Intel iommu driver, it would warn when there is no pasid attachment to
destroy in the remove_dev_pasid() callback.

The ideal way is to handle the error within __iommu_set_group_pasid(). This
not only makes __iommu_set_group_pasid() self-contained, but also avoids
unnecessary warnings.

Fixes: 16603704559c7a68 ("iommu: Add attach/detach_dev_pasid iommu interfaces")
Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>
---
  drivers/iommu/iommu.c | 20 ++++++++++++++------
  1 file changed, 14 insertions(+), 6 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

This will need revising when we get to PASID replace, but good enough
for now

yes, the rollback part would be revised a bit when coming to support
PASID domain replacement. Already in the pending list, will send it
out soon. :)

--
Regards,
Yi Liu




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux