[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0b963b02-dec0-4bf5-aea9-dbe3050716ee@amd.com>
Date: Fri, 15 Aug 2025 11:41:17 +0200
From: Christian König <christian.koenig@....com>
To: Andrew Davis <afd@...com>, Gerd Hoffmann <kraxel@...hat.com>,
Sumit Semwal <sumit.semwal@...aro.org>, Paul Cercueil
<paul@...pouillou.net>, Vivek Kasireddy <vivek.kasireddy@...el.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: dri-devel@...ts.freedesktop.org, linux-media@...r.kernel.org,
linaro-mm-sig@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 0/3] udmabuf: Sync to attached devices
On 14.08.25 18:10, Andrew Davis wrote:
> Hello all,
>
> This series makes it so the udmabuf will sync the backing buffer
> with the set of attached devices as required for DMA-BUFs when
> doing {begin,end}_cpu_access.
Yeah the reason why we didn't do that is that this doesn't even work 100% reliable in theory. So this patchset here might make your use case work but is a bit questionable in general.
udmabuf is about turning a file descriptor created by memfd_create() into a DMA-buf. Mapping that memory can happen through the memfd as well and so it is perfectly valid to skip the DMA-buf begin_access and end_access callbacks.
Additional to that when CONFIG_DMABUF_DEBUG is enabled the DMA-buf code mangles the page addresses in the sg table to prevent importers from abusing it. That makes dma_sync_sgtable_for_cpu() and dma_sync_sgtable_for_device() on the exporter side crash.
That's the reason why DMA-buf heaps uses a copy of the sg table for calling dma_sync_sgtable_for_cpu()/dma_sync_sgtable_for_device().
It's basically a hack and should be removed, but for this we need to change all clients which is tons of work.
Regards,
Christian.
>
> Thanks
> Andrew
>
> Changes for v2:
> - fix attachment table use-after-free
> - rebased on v6.17-rc1
>
> Andrew Davis (3):
> udmabuf: Keep track current device mappings
> udmabuf: Sync buffer mappings for attached devices
> udmabuf: Use module_misc_device() to register this device
>
> drivers/dma-buf/udmabuf.c | 133 +++++++++++++++++++-------------------
> 1 file changed, 67 insertions(+), 66 deletions(-)
>
Powered by blists - more mailing lists