Messages in this thread | | | Date | Thu, 10 Aug 2023 09:37:09 +0800 | Subject | Re: [PATCH 2/5] iommu: Call helper function to get assigned pasid value | From | Baolu Lu <> |
| |
On 2023/8/9 22:48, Jason Gunthorpe wrote: > On Wed, Aug 09, 2023 at 06:58:15PM +0800, Baolu Lu wrote: >> On 2023/8/9 17:49, Tian, Kevin wrote: >>>> From: Baolu Lu <baolu.lu@linux.intel.com> >>>> Sent: Wednesday, August 9, 2023 8:22 AM >>>> >>>> On 2023/8/8 15:49, Tina Zhang wrote: >>>>> Use the helper function mm_get_pasid() to get the mm assigned pasid >>>>> value. >>>> >>>> For internal iommu drivers, perhaps we should use another helper. >>>> Something like sva_domain_get_pasid()? >>>> >>>> Suppose that the iommu drivers should have no idea about the "mm". >>>> >>> >>> Aren't all touched functions accept a struct mm_struct pointer? >> >> In the end we should remove all mm reference in the individual drivers. >> The drivers only need to know what they need to know. All mm-aware code >> should eventually be moved to the core. >> >> For now, at least we should avoid using mm in the set/remove_dev_pasid >> code path. Later, once we complete consolidating mm notification in the >> core, drivers will have no need to use "mm" anymore. > > I'm not sure how this will play out... > > We don't want extra function indirections here so ultimately the > driver needs to hook the arch_invalidate_range() in the mm_notifier > with its own function.
Agreed. Given the mm notification callback is a performance path, an extra indirection call here is not good.
> > The core could put the mm_notifier in a common iommu_domain_sva struct > and it could stick in the driver's invalidate ops, that would be a > nice simplification (and discourage drivers from doing the crazy > things they are currently doing)
Yes. So the iommu driver can retrieve the sva domain from struct mmu_notifier. The callback implementation will still be domain centric. Hence, there will be no need to use mm.
Best regards, baolu
| |