[lkml]   [2019]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v6 2/5] dma-buf: heaps: Add heap helpers
On Mon, Jul 22, 2019 at 9:09 PM John Stultz <> wrote:
> On Thu, Jul 18, 2019 at 3:06 AM Christoph Hellwig <> wrote:
> >
> > Is there any exlusion between mmap / vmap and the device accessing
> > the data? Without that you are going to run into a lot of coherency
> > problems.

dma_fence is basically the way to handle exclusion between different
device access (since device access tends to be asynchronous). For
device<->device access, each driver is expected to take care of any
cache(s) that the device might have. (Ie. device writing to buffer
should flush it's caches if needed before signalling fence to let
reading device know that it is safe to read, etc.)

_begin/end_cpu_access() is intended to be the exclusion for CPU access
(which is synchronous)


> This has actually been a concern of mine recently, but at the higher
> dma-buf core level. Conceptually, there is the
> dma_buf_map_attachment() and dma_buf_unmap_attachment() calls drivers
> use to map the buffer to an attached device, and there are the
> dma_buf_begin_cpu_access() and dma_buf_end_cpu_access() calls which
> are to be done when touching the cpu mapped pages. These look like
> serializing functions, but actually don't seem to have any enforcement
> mechanism to exclude parallel access.
> To me it seems like adding the exclusion between those operations
> should be done at the dmabuf core level, and would actually be helpful
> for optimizing some of the cache maintenance rules w/ dmabuf. Does
> this sound like something closer to what your suggesting, or am I
> misunderstanding your point?
> Again, I really appreciate the review and feedback!
> Thanks so much!
> -john

 \ /
  Last update: 2019-07-23 22:10    [W:0.124 / U:63.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site