Hi Kevin,

On Wed, 16 Mar 2022 07:41:34 +0000, "Tian, Kevin" <[email protected]>
wrote:

> > From: Jason Gunthorpe <[email protected]>
> > Sent: Tuesday, March 15, 2022 10:33 PM
> > 
> > On Mon, Mar 14, 2022 at 10:07:07PM -0700, Jacob Pan wrote:  
> > > + /*
> > > +  * Each domain could have multiple devices attached with
> > > shared or  
> > per  
> > > +  * device PASIDs. At the domain level, we keep track of
> > > unique PASIDs  
> > and  
> > > +  * device user count.
> > > +  * E.g. If a domain has two devices attached, device A has
> > > PASID 0, 1;
> > > +  * device B has PASID 0, 2. Then the domain would have PASID
> > > 0, 1, 2.
> > > +  */  
> > 
> > A 2d array of xarray's seems like a poor data structure for this task.  
> 
Perhaps i mis-presented here, I am not using 2D array. It is an 1D xarray
for domain PASIDs only. Then I use the existing device list in each domain,
adding another xa to track per-device-domain PASIDs.
> besides that it also doesn't work when we support per-device PASID
> allocation in the future. In that case merging device PASIDs together is
> conceptually wrong.
> 
Sorry, could you elaborate? If we do per-dev PASID allocation, we could use
the ioasid_set for each pdev, right?

> > 
> > AFACIT this wants to store a list of (device, pasid) tuples, so a
> > simple linked list, 1d xarray vector or a red black tree seems more
> > appropriate..
> >   
> 
> this tuple can well serve per-device PASID. 😊
> 
I commented on the other email, but a simple list of tuples could have
duplicated devices since each dev could attach multiple PASIDs, right?
Should we still do two level then?

> Thanks
> Kevin


Thanks,

Jacob
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to