Article View: linux.kernel.netdev
Article #25550Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type
From: Jason Gunthorpe
Date: Wed, 02 Dec 2026 01:30
Date: Wed, 02 Dec 2026 01:30
76 lines
16061 bytes
16061 bytes
On Wed, Dec 02, 2026 at 10:47:28AM +1000, Dave Airlie wrote: > I think this is clearly where the divide is. I'm with Christian here, > the exporter allocate the resource, then it owns the lifetime of the > resource. In order for it to have complete ownership of the lifetime > of the resource it needs the ability to remove the resource from other > users (i.e. importers). If the exporter wasn't to free some pages, it > should have all the information necessary to do so but traversing a > list of places the object has been imported and a method to forcible > unlink it from that side. If you change iommu mappings without telling the driver you will create data corruption as new mappings can fall to places the device is still doing DMA. The driver MUST be involved in any reclaim/move/revoke process and DMABUF already has APIs for that. Managing this lifetime is one of the main things it does. I don't like this notion we can trust one side more than the other, it isn't like the exporter drivers are amazing clean things either. There is a reasonable level of nannying.. Importers are expected to unmap. I think we have to consider any one that doesn't to be broken. You can't fix broken with more broken things like force DMA unmapping and hoping that there is an iommu, then hoping no corruption happens to crash the system. > This directly conflicts with Jason's idea that I'm not giving > exporters the importers iommu_domain. I think we have to break this > deadlock to move forward. I just saw someone in drivers/media do the most insane thing with the new DMA API, unbelievable. No matter what we build someone will find a creative way to abuse it. We need to have a 3rd party "Switzerland" if you want to keep this direction that limits the exposure of either side to the details. > I think I'm still with Christian though. I think you need to export a > "dma-buf" with a list of supported both platform and device specific > types that it can be imported into. This was the entire idea behind the mapping type series, it came out of Intel asking for support for ualink. > for dma-buf the import meta-data is the struct device, the output > meta-data is a mapped sg for that device. > for PCI P2P, import meta-data might be just the PCI address of the > importer, snooping, atomic access?, maybe we validate it can be > reached, but then we return PCI BAR + offset/length lists. No, the output is always a dma_addr_t, the dma api natively supports P2P. You have to decorate it in a special flow to make it work. Also nothing uses PCI BAR + offset/length. If you want to make that you can in your own "Switzerland" <shrug> but it is an unnatural interface in practice. Even the P2P permitted placement selection shouldn't be open coded in drivers, this is a bit tricky to do well and none of the DRM drivers get there. > for iommufd, import meta-data is the iommu_domain, the exporter maps, > and hands back the correct table of addresses FWIW it is a huge pita to make things work like this inside iommufd and if it gets messed up then iommufd will explode in a bad way. It is so much easier to feed through phys_addr_t since we already have this infrastructure. But if that end up being the only thing that we disagree on then fine, but no giving it directly to any DRM drivers. Jason
Technical Details
Message-ID:
<20261202013043.GC351887@ziepe.ca>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375472-linux-kernel-netdev=dewy.ruReferences:
<79d62f9a-cea8-4149-a673-7ef86942410d@amd.com> <20261127125753.GS246011@ziepe.ca> <eae24bcc-5d49-4f7a-a66b-164e8ff73bdd@amd.com> <aw1S9_aGYflXPzjU@nvdebian.thelocal> <CAPM=9txfgbKW9BN1Uwp0A6a-J35a=uzJf8LwsJ_j3i6nksqtcQ@mail.gmail.com> <aw5yDFk2u_bzMZD8@nvdebian.thelocal> <20f5fb10-b71a-40f9-bbb2-f99b4002bf08@amd.com> <aw6MunWRlt-_MIke@nvdebian.thelocal> <53a32383-4cf6-42ac-bbd5-476e69a3be5f@amd.com> <CAPM=9txYvRT=bdSk5D56W9Wu5+UnfcGz-8Msj+wOns-XNXw1Ww@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!feed-us-ny.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375472-linux-kernel-netdev=dewy.ru
From: jgg@ziepe.ca (Jason Gunthorpe)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type
Date: Tue, 1 Dec 2026 21:30:43 -0400
Organization: Usenet Network
Message-ID: <20261202013043.GC351887@ziepe.ca>
References: <79d62f9a-cea8-4149-a673-7ef86942410d@amd.com>
<20261127125753.GS246011@ziepe.ca>
<eae24bcc-5d49-4f7a-a66b-164e8ff73bdd@amd.com>
<aw1S9_aGYflXPzjU@nvdebian.thelocal>
<CAPM=9txfgbKW9BN1Uwp0A6a-J35a=uzJf8LwsJ_j3i6nksqtcQ@mail.gmail.com>
<aw5yDFk2u_bzMZD8@nvdebian.thelocal>
<20f5fb10-b71a-40f9-bbb2-f99b4002bf08@amd.com>
<aw6MunWRlt-_MIke@nvdebian.thelocal>
<53a32383-4cf6-42ac-bbd5-476e69a3be5f@amd.com>
<CAPM=9txYvRT=bdSk5D56W9Wu5+UnfcGz-8Msj+wOns-XNXw1Ww@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="1860709"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:GZItETfBpOl9urASogjyQL4eph0= sha256:JE+fQIx38i7R17v788ve8lMwlW4wqmKNtR5dOMlCGow=
sha1:Mr/3qPzhai+m0bbBHNPqoh0C5ik= sha256:X7aSKjyqZcFg+V7y54IaCJfl1vZYEH5LHYUk0zJoq38=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id BBACB11750A; Wed, 2 Dec 2026 04:31:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=ziepe.ca
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id uy3R9VhbCfVs;
Wed, 2 Dec 2026 04:31:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375472-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=ziepe.ca
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id A1B091171EB; Wed, 2 Dec 2026 04:30:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 7F6342CCAF; Wed, 2 Dec 2026 01:30:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796175049;
b=X5REx/rM3GSzf2FC3YHFIuizTtGW4AddWl8TFQ3QOijcEqjYoPk03cbSOIwb5bJDwj95
4ueh8AYIkPub738xG61SUmkV4QM/BB0ncTUsinQGrwwphrjN7lvv/IHVcGSaOp51EZxyG
YU1wPRo4cjSHD45FN7ahpxGPOU49KFJdCy/1wTA0NSv9hnZpM0Iv96L14inl1+ZZHtdSi
RD6La5AedQ3sbAlnVSYPRfFwUL6xrh7+VjUo3Mcm4C8+4i8or3OQjWtBsvHW+t5qwUezr
1s5MV3haHsSw1uvPTAg3JcXeRIMzMlP8EW7Iq4RHwQZ/gQRE/DUI/Io3XHKMdqmeE0g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796175049;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Received:Date:From:To:Cc:Subject:
Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=VcUZtXBpZV3hq1xptmeqiTmPBPnOG37CB0gnMZjEpPQ=;
b=Kgeio8SEt8ryyq+3qVb6U8ppJVx2Olgjl2enrOxF0mZCdI6a5l1rVVoagL7HXhAXle1P
faKHY1ofGCpay6Nl+8cbLSAd1oZTAH2PK48V8G0Ss/Jibo/rQEQ5yPnhIefECTEdpwqF7
8OZamU3M+u02Z3IexzrxL/dezHBWDz75je8CkgoW2E9JkZUJ4hogxbkk1rVRsNRthZcrv
+2Go5KvZtX6KuwDJtAwAfSF8ZW/DraKtVbhsJE4+BP6smbu4k0q7wjQsR4BsPvXBSj11i
MqL3o8Ax1DkDMepjVKSK8bY/A5BsMAvkCtWbEpJE75ZccQRSckzeN+beblmg61ocCMA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=QKJ9x5qU;
dmarc=none header.from=ziepe.ca;
spf=pass smtp.mailfrom=ziepe.ca;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DD48606A322;
Wed, 2 Dec 2026 01:30:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=QKJ9x5qU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.170
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796175048;
b=1AYvzCwX9i6eWNU/mgEsKLy/0WClTxDv8rPtuItj5oWpNbzmN38G3cCZ83vxTVmx4q4c
nI+hyJQdoMToMC92CKDCKvTmLnvovyMke4U4zmwKX3idTMFN9xwa/ZT3Nf8ageJutJUFk
pY74y28zRV7V571IgEwajQjBdsZkyuDTMMNbgw/sofFWA1I6oanwIhRoeHMTSeWFBX3d9
hh5CGs5pfR8Rc4cbGE6MmIkM/wNeFhekru06VevN18mTsj39gWlGiBi+FRxJcd0Ip2xwu
kO2rNSIiCZr9R74q4qAD4oigw+PiTOzwFV65GHaQjMyEzm8NIb+FqO11q724OlhZkdA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796175048;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=VcUZtXBpZV3hq1xptmeqiTmPBPnOG37CB0gnMZjEpPQ=;
b=n7OvAWDo+ZgEjdCWrsRl7VZwksh/c8RumyWOwmUDcs2yOY0wgaeCXBD9GiCkECMla/X6
ZE+n26jUWtrYBRJtG69tJ95Oa5a3Jq6ECcgcFbWdFiaNDm3TlN7jJJWi5VSOTHrW7Xrh4
sKP1b6L+dYwrwe6J2EQ4LtLBuapspmm+KMBGET35vt9SNTQ6pQAuWCYy+ge9MePC8CRM2
JvGVS4ufHcN/c/Hgo6sWKHBwATUvP0xAcTGG6dtM7VhIUF/tbqOrA7l+LbE0dgicgDRcX
rOQddH9MG1RuK+/VtKEU89U9CI+FMFjl3+Mno3dp0CgOnKn8M01WH27+0GTGEdqAAEg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=ziepe.ca;
spf=pass smtp.mailfrom=ziepe.ca;
dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=QKJ9x5qU;
arc=none smtp.remote-ip=209.85.160.170
X-Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4221606A32E
for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 01:30:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E4221606A32E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca
X-Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-5495d549924so129857181cf.1
for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 17:30:47 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ziepe.ca; s=google; t=1796175047; x=1796779847; darn=vger.kernel.org;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=VcUZtXBpZV3hq1xptmeqiTmPBPnOG37CB0gnMZjEpPQ=;
b=QKJ9x5qUTmfOmMErfBU+M/Zo2IsiX2zJa9nKHCZH6sxVbNca1LCnmfkMlZHL1TRLrq
zXbnFJd3xwOC06E5o4UHI7gvekbRh1wBQJIrbkDso0hhfsiHNvi7/wcQOtRGGSCOjBUR
XXrDL7VbbY2v264Ews8QX5uXCbXoNz8GYcukA5sfzqp5LTFuDHHdCzJssS4krH/1Ng4K
WIpwWe48tCL7Z/CPnKKV00EeVk0czeM00k5St3Iz+0sfKSLR101S8UWgTiMzFdqOB94q
7vK9n/1bfAH/K9Sg4JJ0iLdIiaHDllaFihjWNuCU55XhavXjcySiI1Cgw+K1MFzBq8o9
EDzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796175047; x=1796779847;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=VcUZtXBpZV3hq1xptmeqiTmPBPnOG37CB0gnMZjEpPQ=;
b=YKX7LtaIwCwsygbMkmEv9XlkANVAtdVn6+9da+8EhvO1MFIEmZlDeKNPnSJgeKWHTj
Hc1zgvfTrVmgkPY+DA1ibrDwsD4GXXZNBtztmG6Ciyhv92TtMaGsQpsUS8pAPIbNbeDm
UmNq3z7Xmq6ar+T5Q0TmLjrfYvdNFwMgmt921WF4U5+g8Vm3IwUXry2H7ukTiTZsa1nz
iNg9u6g6TJ415V79Bf8NV3DiT2DaRyrH9zHp4J/Ai2/6p2wdQY/4eEAcMW2Vpoa4QpeK
AV9bVXl9kyJk0/YNs5QI7rxZtYTYovjs1e7Qi7Cv7uq1xiEiv4LaIrG3MpKBlhS6ViYQ
JI6A==
X-Forwarded-Encrypted: i=1; AL+hErE0FIr8Xd8hq07qJiNYWaqxSDr1iz3awoAj4t1Aieie2eSGONdp547tV9tEuvD0YZ/Y4LRiWH0=@vger.kernel.org
X-Gm-Message-State: APuU4Z/16jDwMfbHcbiJb/9JqppUcURBL28czQge4d7/8sni9hpRO+dv
KLHVmY3jU8fmnfRvI8wfswc27lF1BL1NBqpMXq5Jnu17/FPltjtLO5Ln6Zc4j6U4ugI=
X-Gm-Gg: AZFdTZeiNHAKVips7dBioEniVzELhBK+NgJ8Ykh+g8F/j3AMhr36dq9zr7D5sGfTWQu
qERxPa2FyIbgR7TJ8IlWdN8/jb6QaNPZUhg2/nMdI21SYgTMxGAHWPMQLz0tuPapfdvbSkmZ1xG
t7hY0ASdOrFfN0pBakFXPfWPZe1zVH4wP/P4LAx+DqPJ+kPZ/dS2RmUJgw8/NQVp+UaDGV05eCx
6asHpLa+74rEVLAMmN8jyrn0uELl0e0nZWGxoJ6SGKtbQ7p2VACkP/ESwkeUXxmawbupzIYN3Nf
ySYepY6BvswTOIMTuO45mfgfXNaFBKVz5ZCDQenT5ocWaoEb6o/zn5UKiGYIZJm2ClgKZSfNi9z
aCeU2FhS7UZOHqTb1fzxBl2pPW8LDxdMZz1e7eQmQyMQcgV6IN5vKCjinbEssKQlwQX8aea8EY6
uMdRCFFYUM+7K09tL7MAsrdUChme4aA8bfHt/qQl0HepkYp6lleDQHxBCxQ7/+6dyLbiLFJFb45
rn67xuhX3S0fP8SpyBZthuy/7ZUC+ag+C1F0L8tVV3oSR72hYrQfUIPFfNbqv6b0EXlsOX2YoRA
5LHKMR1UDEu4hFaAScZicQFSVw==
X-Received: by 2002:a05:622a:ab0a:10b0:55d:bd82:16b3 with SMTP id d75a77b69052e-55dbd821b79mr299151141cf.77.1796175044341;
Tue, 01 Dec 2026 17:30:44 -0800 (PST)
X-Received: from ziepe.ca ([142.177.118.84])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-9217efd0637sm181779596d6.42.2026.12.01.17.30.43
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 01 Dec 2026 17:30:43 -0800 (PST)
X-Received: from jgg by wakko with local (Exim 4.97)
(envelope-from <jgg@ziepe.ca>)
id 1xYZBD-00000002Dzt-0J13;
Tue, 01 Dec 2026 21:30:43 -0400
X-Cc: Christian König <christian.koenig@amd.com>,
Alistair Popple <apopple@nvidia.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Thomas Hellström <thomas.hellstrom@linux.intel.com>,
Simona Vetter <simona.vetter@ffwll.ch>,
Matthew Brost <matthew.brost@intel.com>,
Vivek Kasireddy <vivek.kasireddy@intel.com>,
Dongwon Kim <dongwon.kim@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Xu Yilun <yilun.xu@linux.intel.com>,
Karl Mehltretter <kmehltretter@gmail.com>,
Baolu Lu <baolu.lu@linux.intel.com>,
Felix Kuehling <felix.kuehling@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
linux-rdma@vger.kernel.org, iommu@lists.linux.dev,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Mina Almasry <almasrymina@google.com>, netdev@vger.kernel.org,
Alexey Kardashevskiy <aik@amd.com>, zhipingz@meta.com,
treding@nvidia.com, jhubbard@nvidia.com, chaitanyak@nvidia.com,
Leon Romanovsky <leon@kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CAPM=9txYvRT=bdSk5D56W9Wu5+UnfcGz-8Msj+wOns-XNXw1Ww@mail.gmail.com>