[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c92d014a-9332-27d2-688b-48fc07efdebb@linux.intel.com>
Date: Wed, 13 Apr 2022 19:57:33 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>,
Jason Gunthorpe <jgg@...dia.com>,
Christoph Hellwig <hch@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.com>
Cc: baolu.lu@...ux.intel.com, Eric Auger <eric.auger@...hat.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC v3 08/12] iommu/sva: Use attach/detach_pasid_dev in
SVA interfaces
On 2022/4/13 7:36, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@...ux.intel.com>
>> Sent: Tuesday, April 12, 2022 8:53 PM
>>
>>>
>>>> + if (!handle) {
>>>> + ret = -ENOMEM;
>>>> + goto out_put_ioas;
>>>> + }
>>>> +
>>>> + /* The reference to ioas will be kept until domain free. */
>>>> + domain = iommu_sva_alloc_domain(dev, ioas);
>>>
>>> Shouldn't we first try whether existing domains are compatible to this
>>> device?
>>
>> If we think that here domain represents a hardware pagetable actually
>> used by IOMMU for a {device, pasid}, we are able to use per-{device,
>> pasid} domain without checking compatibility. Sharing a domain among
>> devices under the same IOMMU may be an optimization. That could be done
>> in the IOMMU driver just like what vt-d driver is doing for pass-through
>> DMA domains.
>>
>
> there is only one hardware page table per mm in this case. Multiple domains
> are required only due to compatibility reason as Jason/Robin pointed out
> in SMMU case. Given all other places create multiple domains per ioas only
> upon incompatibility, probably it's more consistent to doing so in this path
> too...
Sharing domain for compatible devices is valuable when the domain
supports map/unmap operations. That can reduce the number of map/unmap
calls and the resulting synchronization of IOTLB. But for SVA case, it's
a dumb domain which only provides attach/detach operations.
A similar case could be found on pass-through DMA domains. The iommu
core allocates a default domain for each group although all the domains
represent a same page table for the compatible devices. The VT-d driver
optimizes this by exporting a static identity domain.
Anyway, I am open for this. I can add a compatible domain list if most
of you like that way. :-)
Best regards,
baolu
Powered by blists - more mailing lists