]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit
authorFenghua Yu <fenghua.yu@intel.com>
Mon, 7 Feb 2022 23:02:48 +0000 (15:02 -0800)
committerBorislav Petkov <bp@suse.de>
Tue, 15 Feb 2022 10:31:35 +0000 (11:31 +0100)
commit3a76095704c5984af9f4401a7389669a5af688ec
tree1637d8cc005e07c28f7357b8a6dd8c538c9f5967
parentd2f54174f9964dba21581bd21e69675e6e843657
iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

PASIDs are process-wide. It was attempted to use refcounted PASIDs to
free them when the last thread drops the refcount. This turned out to
be complex and error prone. Given the fact that the PASID space is 20
bits, which allows up to 1M processes to have a PASID associated
concurrently, PASID resource exhaustion is not a realistic concern.

Therefore, it was decided to simplify the approach and stick with lazy
on demand PASID allocation, but drop the eager free approach and make an
allocated PASID's lifetime bound to the lifetime of the process.

Get rid of the refcounting mechanisms and replace/rename the interfaces
to reflect this new approach.

  [ bp: Massage commit message. ]

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20220207230254.3342514-6-fenghua.yu@intel.com
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
drivers/iommu/intel/iommu.c
drivers/iommu/intel/svm.c
drivers/iommu/ioasid.c
drivers/iommu/iommu-sva-lib.c
drivers/iommu/iommu-sva-lib.h
include/linux/ioasid.h
include/linux/sched/mm.h
kernel/fork.c