Messages in this thread | | | Date | Wed, 16 Mar 2022 17:49:59 -0700 | From | Jacob Pan <> | Subject | Re: [PATCH v2 3/8] iommu/vt-d: Implement device_pasid domain attach ops |
| |
Hi Jason,
On Wed, 16 Mar 2022 19:15:50 -0300, Jason Gunthorpe <jgg@nvidia.com> wrote:
> On Wed, Mar 16, 2022 at 01:50:04PM -0700, Jacob Pan wrote: > > > I guess a list of (device, pasid) tuples as you suggested could work > > but it will have duplicated device entries since each device could have > > multiple PASIDs. right? > > Is assigning the same iommu_domain to multiple PASIDs of the same > device something worth optimizing for? Probably not, the current usage case has only two PASIDs at most (RID2PASID + a kernel PASID).
I was just thinking for the generalized case, device TLB flush would be more efficient if we don't go through the domain list. Use a per-domain-dev list instead. But it doesn't matter much for DMA domain which has one device mostly.
> I would expect real applications will try to use the same PASID for > the same IOVA map to optimize IOTLB caching. > > Is there a use case for that I'm missing? > Yes. it would be more efficient for PASID selective domain TLB flush. But on VT-d IOTLB is also tagged by domain ID, domain flush can use DID if there are many PASIDs. Not sure about other archs. Agree that optimizing PASIDs for TLB flush should be a common goal.
> Otherwise your explanation is what I was imagining as well. > > I would also think about expanding your struct so that the device > driver can track per-device per-domain data as well, that seems > useful IIRC? > yes, at least both VT-d and FSL drivers have struct device_domain_info.
> ie put a 'sizeof_iommu_dev_pasid_data' in the domain->ops and > allocate that much memory so the driver can use the trailer space for > its own purpose. > That sounds great to have but not sure i understood correctly how to do it.
Do you mean for each vendor driver's struct device_domain_info (or equivalent), we carve out sizeof_iommu_dev_pasid_data as common data, then the rest of the space is vendor specific? I don't feel I get your point, could you elaborate?
Thanks,
Jacob
| |