Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type

From: Matthew Brost

Date: Fri Dec 04 2026 - 04:10:23 EST


On Wed, Dec 02, 2026 at 02:47:54PM +0100, Christian König wrote:
> 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.
>

Yes, but that isn't how it works when exporting hands off a physical
address. For example, this is how scale-up fabrics operate unless you
want translation on fabric ingress, a TLB miss, and network
backpressure, none of which is desirable.

In the case of a physical address, the exporter literally cannot revoke
it unless the importer behaves according to our cross-driver contract.

Given that, I'm really unsure what this entire thread has devolved
into - I don't have solution but I will say:

The repeated "I'll nack this" responses, are beyond disappointing and,
in my opinion, not how a reasonable maintainer should behave.

Matt

> Christian.
>
> >
> > Jason
>