Hi Faith and Boris,

Thank you a lot for your feedback!

On 12/11/26 12:09, Boris Brezillon wrote:
On Thu, 12 Nov 2026 08:54:29 -0500
Faith Ekstrand <[email protected]> wrote:
>> [...]
Not entirely included in the mailing list discussion was why we
abandon this approach for panfrost/panthor:  CPU mapping shared
dma-bufs is tricky, especialy with non-coherent caching.  Gone are
the days when we dma-buf had an ownership concept and clients
properly bookended usage with begin/end.  With explicit cache
management, there are too many ways that one client can screw up
another if the BO is shared.

The solution was to disallow BO sharing for any BOs that weren't
mapped write-combined or uncached. A number of DRM drivers already
have a concept of non-sharable BOs for locking reasons.  We simply
required that for write-back caching.

Hm, I think the confusion comes from the fact I kept this logic in
panthor/panfrost, just made it panfrost/panthor specific. We also don't
enforce !WB_MMAP on shareable at the KMD level, but we have it filtered
out in panvk.

Honestly, I still have a hard time making sense of how this whole
dma-buf sharing can work if importers/exporter clients are free to CPU
map the thing without proper signalling of CPU accesses, and
importers/exporter devices are not IO coherent (which is often the case
on Arm SoCs). Yes, making the CPU mapping non-cached ensures that two
CPU accesses from two clients can't step on each other, but there's
still device <-> CPU synchronization I can't make sense of, especially
if the importer doesn't know about CPU accesses done by the exporter
and has device accesses that weren't flushed for some reason.

From my understanding, with WC mappings, CPU accesses will bypass the
CPU caches, so there's no cache maintenance to signal and the device <->
CPU synchronization is reduced to waiting on fences (and trusting that
everybody is following the contract).

About "device accesses that weren't flushed", do you mean device-side
caches? If so, I'd expect the importer driver to flush them before
signaling its fence, regardless of the CPU mapping type.


Anyway, I'm happy to drop all the cpu_start/end implementation in
panfrost/panthor if that helps clearing the confusion.


Considering your feedback, I'll proceed with the following steps:

1. Drop patches [01/12] and [02/12], but keep [03/12], as we still need
drm_gem_shmem_sync();

2. Drop the begin/end_cpu_access() implementation in Panfrost/
Panthor and enforce in the kernel that WB_MMAP BOs can't be shared;

3. Follow the same idea for V3D.

Let me know if have any problems with this plan.

Best regards,
- Maíra

Reply via email to