lkml.org 
[lkml]   [2019]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 2/5] dma-buf: heaps: Add heap helpers
On Tue, Jul 23, 2019 at 01:09:55PM -0700, Rob Clark wrote:
> On Mon, Jul 22, 2019 at 9:09 PM John Stultz <john.stultz@linaro.org> wrote:
> >
> > On Thu, Jul 18, 2019 at 3:06 AM Christoph Hellwig <hch@infradead.org> 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)

What I mean is that we need a clear state machine (preferably including
ownership tracking ala dma-debug) where a piece of memory has one
owner at a time that can access it. Only the owner can access is at
that time, and at any owner switch we need to flush/invalidate all
relevant caches. And with memory that is vmaped and mapped to userspace
that can get really complicated.

The above sounds like you have some of that in place, but we'll really
need clear rules to make sure we don't have holes in the scheme.

\
 
 \ /
  Last update: 2019-07-24 08:56    [W:1.090 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site