[PATCH 00/12] iommu/vt-d: Optimize the use of locks

Lu Baolu
2022-05-27T06:34:01Z

Hi folks,

This series tries to optimize the uses of two locks in the Intel IOMMU
driver:

- The intel_iommu::lock is used to protect the IOMMU resources shared by
devices. They include the IOMMU root and context tables, the pasid
tables and the domain IDs.
- The global device_domain_lock is used to protect the global and the
per-domain device tracking lists.

The optimization includes:

- Remove the unnecessary global device tracking list;
- Remove unnecessary locking;
- Reduce the scope of the lock as much as possible, that is, use the
lock only where necessary;
- The global lock is transformed into a local lock to improve the
efficiency.
- Convert spinlock into mutex so that non-critical functions could be
called when the lock is held.

This series is also available on github:
https://github.com/LuBaolu/intel-iommu/commits/intel-iommu-lock-optimization-v1

Your comments and suggestions are very appreciated.

Best regards,
baolu

Lu Baolu (12):
iommu/vt-d: Use iommu_get_domain_for_dev() in debugfs
iommu/vt-d: Remove for_each_device_domain()
iommu/vt-d: Remove clearing translation data in disable_dmar_iommu()
iommu/vt-d: Use pci_get_domain_bus_and_slot() in pgtable_walk()
iommu/vt-d: Unncessary spinlock for root table alloc and free
iommu/vt-d: Acquiring lock in domain ID allocation helpers
iommu/vt-d: Acquiring lock in pasid manipulation helpers
iommu/vt-d: Replace spin_lock_irqsave() with spin_lock()
iommu/vt-d: Check device list of domain in domain free path
iommu/vt-d: Fold __dmar_remove_one_dev_info() into its caller
iommu/vt-d: Use device_domain_lock accurately
iommu/vt-d: Convert device_domain_lock into per-domain mutex

drivers/iommu/intel/iommu.h | 5 +-
drivers/iommu/intel/debugfs.c | 26 ++--
drivers/iommu/intel/iommu.c | 271 +++++++++-------------------------
drivers/iommu/intel/pasid.c | 143 +++++++++---------
drivers/iommu/intel/svm.c | 5 +-
5 files changed, 147 insertions(+), 303 deletions(-)

--
2.25.1