On 12/2/26 14:28, Jason Gunthorpe wrote:
On Wed, Dec 02, 2026 at 02:54:07PM +1100, Alistair Popple wrote:
So what I'm hearing is that the exporter should be unmapping as a defense against bad importers. I can definitely understand why that might be useful, especially as some kind of debug thing, but I don't think we should be basing the whole API design around the concept we can't trust importer to implement the contract correctly. Especially as that defense might not actually exist in a lot of cases anyway (eg. IOMMU disabled), in which case you have no choice but to trust the importer got things right.
+1
I also sense there might be a deeper belief that the mapping of a resource (ie. the IOVA) is something owned by the resource rather than the user of that resource.
Well, this would be wrong. The IOVA is owned by the DMA API, the DMA API is owned by its bound driver. In the kernel it is *never* owned by the memory object being mapped by it.
Yeah I think that pretty much nailed the disagreement.
IOMMU was invented in the first place because both HW as well as it's SW driver is not trustworthy.
So for system memory the IOVA should be owned by the core memory management and not the SW driver who wants to use it.
The same is true for P2P mappings where the exporter who provides the backing store should handle the lifetime of the IOVA for an importer.
Letting the importer manage the lifetime is like putting the fox in charge of the henhouse and IOMMU pretty much looses its purpose.
Christian.
Jason