[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220518114204.4d251b41@jacob-builder>
Date: Wed, 18 May 2022 11:42:04 -0700
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: iommu@...ts.linux-foundation.org,
LKML <linux-kernel@...r.kernel.org>, dmaengine@...r.kernel.org,
Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
Lu Baolu <baolu.lu@...ux.intel.com>, vkoul@...nel.org,
robin.murphy@....com, will@...nel.org, Yi Liu <yi.l.liu@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
Eric Auger <eric.auger@...hat.com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH v3 1/4] iommu/vt-d: Implement domain ops for
attach_dev_pasid
Hi Jason,
On Wed, 11 May 2022 15:29:08 -0300, Jason Gunthorpe <jgg@...dia.com> wrote:
> On Wed, May 11, 2022 at 10:25:21AM -0700, Jacob Pan wrote:
> > Hi Jason,
> >
> > On Wed, 11 May 2022 14:00:25 -0300, Jason Gunthorpe <jgg@...dia.com>
> > wrote:
> > > On Wed, May 11, 2022 at 10:02:16AM -0700, Jacob Pan wrote:
> > > > > > If not global, perhaps we could have a list of pasids (e.g.
> > > > > > xarray) attached to the device_domain_info. The TLB flush logic
> > > > > > would just go through the list w/o caring what the PASIDs are
> > > > > > for. Does it make sense to you?
> > > > >
> > > > > Sort of, but we shouldn't duplicate xarrays - the group already
> > > > > has this xarray - need to find some way to allow access to it
> > > > > from the driver.
> > > > >
> > > > I am not following, here are the PASIDs for devTLB flush which is
> > > > per device. Why group?
> > >
> > > Because group is where the core code stores it.
> > I see, with singleton group. I guess I can let dma-iommu code call
> >
> > iommu_attach_dma_pasid {
> > iommu_attach_device_pasid();
> > Then the PASID will be stored in the group xa.
>
> Yes, again, the dma-iommu should not be any different from the normal
> unmanaged path. At this point there is no longer any difference, we
> should not invent new ones.
>
> > The flush code can retrieve PASIDs from device_domain_info.device ->
> > group -> pasid_array. Thanks for pointing it out, I missed the new
> > pasid_array.
>
> Yes.. It seems inefficient to iterate over that xarray multiple times
> on the flush hot path, but maybe there is little choice. Try to use
> use the xas iterators under the xa_lock spinlock..
>
xas_for_each takes a max range, here we don't really have one. So I posted
v4 w/o using the xas advanced API. Please let me know if you have
suggestions.
xa_for_each takes RCU read lock, it should be fast for tlb flush, right? The
worst case maybe over flush when we have stale data but should be very rare.
> The challenge will be accessing the group xa in the first place, but
> maybe the core code can gain a function call to return a pointer to
> that XA or something..
>
I added a helper function to find the matching DMA API PASID in v4.
Thanks,
Jacob
Powered by blists - more mailing lists