[PATCH 01/12] dma-buf: add dynamic caching of sg_table

2019-04-29 Thread Liam Mark
On Tue, 16 Apr 2019, Christian K??nig wrote: > To allow a smooth transition from pinning buffer objects to dynamic > invalidation we first start to cache the sg_table for an attachment > unless the driver explicitly says to not do so. > > --- > drivers/dma-buf/dma-buf.c | 24

Re: [RFC][PATCH 0/6 v3] DMA-BUF Heaps (destaging ION)

2019-03-31 Thread Liam Mark
ally unnecessary > > cache-management operations can be resolved properly for system > > and cma heaps (outstanding issue from ION). > > > > > > Eventual TODOS: > > * Sanity filtering for heap names > > * Reimplement performance optimizations for sys

Re: [RFC][PATCH 2/5 v2] dma-buf: heaps: Add heap helpers

2019-03-14 Thread Liam Mark
On Wed, 13 Mar 2019, Andrew F. Davis wrote: > On 3/13/19 3:18 PM, Liam Mark wrote: > > On Tue, 5 Mar 2019, John Stultz wrote: > > > >> Add generic helper dmabuf ops for dma heaps, so we can reduce > >> the amount of duplicative code for the exported dmabufs. &g

Re: [RFC][PATCH 5/5 v2] kselftests: Add dma-heap test

2019-03-14 Thread Liam Mark
On Tue, 5 Mar 2019, John Stultz wrote: > Add very trivial allocation test for dma-heaps. > > TODO: Need to actually do some validation on > the returned dma-buf. > > Cc: Laura Abbott > Cc: Benjamin Gaignard > Cc: Greg KH > Cc: Sumit Semwal > Cc: Liam Mark >

Re: [RFC][PATCH 2/5 v2] dma-buf: heaps: Add heap helpers

2019-03-14 Thread Liam Mark
rs: > Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others! > > Cc: Laura Abbott > Cc: Benjamin Gaignard > Cc: Greg KH > Cc: Sumit Semwal > Cc: Liam Mark > Cc: Brian Starkey > Cc: Andrew F. Davis > Cc: Chenbo Feng > Cc: Alistair Strachan > Cc: dr

Re: [RFC][PATCH 3/5 v2] dma-buf: heaps: Add system heap to dmabuf heaps

2019-03-14 Thread Liam Mark
hanks to its original authors and maintainters: > Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others! > > Cc: Laura Abbott > Cc: Benjamin Gaignard > Cc: Greg KH > Cc: Sumit Semwal > Cc: Liam Mark > Cc: Brian Starkey > Cc: Andrew F. Davis > Cc: Ch

Re: [RFC][PATCH 0/5 v2] DMA-BUF Heaps (destaging ION)

2019-03-14 Thread Liam Mark
On Wed, 13 Mar 2019, John Stultz wrote: > On Wed, Mar 13, 2019 at 1:11 PM Liam Mark wrote: > > On Tue, 5 Mar 2019, John Stultz wrote: > > > > > > Eventual TODOS: > > > * Reimplement page-pool for system heap (working on this) > > > * Add stats ac

Re: [RFC][PATCH 0/5 v2] DMA-BUF Heaps (destaging ION)

2019-03-14 Thread Liam Mark
On Tue, 5 Mar 2019, John Stultz wrote: > Here is a initial RFC of the dma-buf heaps patchset Andrew and I > have been working on which tries to destage a fair chunk of ION > functionality. > > The patchset implements per-heap devices which can be opened > directly and then an ioctl is used to all

Re: [Linaro-mm-sig] [PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory

2019-03-01 Thread Liam Mark
+ Sumit Hi Sumit, Do you have any thoughts on this patch? It fixes a potential crash in on older kernel and I think limiting begin/end_cpu_access to only apply cache maintenance when the buffer is dma mapped makes sense from a logical perspective and performance perspective. On Wed, 6 Feb

Re: [PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory

2019-01-30 Thread Liam Mark
On Fri, 18 Jan 2019, Liam Mark wrote: > On Fri, 18 Jan 2019, Andrew F. Davis wrote: > > > On 1/18/19 12:37 PM, Liam Mark wrote: > > > The ION begin_cpu_access and end_cpu_access functions use the > > > dma_sync_sg_for_cpu and dma_sync_sg_for_device APIs to p

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-23 Thread Liam Mark
On Tue, 22 Jan 2019, Andrew F. Davis wrote: > On 1/21/19 4:12 PM, Liam Mark wrote: > > On Mon, 21 Jan 2019, Christoph Hellwig wrote: > > > >> On Mon, Jan 21, 2019 at 11:44:10AM -0800, Liam Mark wrote: > >>> The main use case is for allowing clients to pass

Re: [PATCH 4/4] staging: android: ion: Support for mapping with dma mapping attributes

2019-01-23 Thread Liam Mark
On Mon, 21 Jan 2019, Brian Starkey wrote: > Hi Liam, > > On Fri, Jan 18, 2019 at 10:37:47AM -0800, Liam Mark wrote: > > Add support for configuring dma mapping attributes when mapping > > and unmapping memory through dma_buf_map_attachment and > > dma_buf_unmap_attac

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-23 Thread Liam Mark
On Tue, 22 Jan 2019, Andrew F. Davis wrote: > On 1/21/19 4:18 PM, Liam Mark wrote: > > On Mon, 21 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/21/19 2:20 PM, Liam Mark wrote: > >>> On Mon, 21 Jan 2019, Andrew F. Davis wrote: > >>> > >>&

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-23 Thread Liam Mark
On Mon, 21 Jan 2019, Brian Starkey wrote: > Hi, > > Sorry for being a bit sporadic on this. I was out travelling last week > with little time for email. > > On Fri, Jan 18, 2019 at 11:16:31AM -0600, Andrew F. Davis wrote: > > On 1/17/19 7:11 PM, Liam Mark wrote: &

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Andrew F. Davis wrote: > On 1/21/19 2:20 PM, Liam Mark wrote: > > On Mon, 21 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/21/19 1:44 PM, Liam Mark wrote: > >>> On Mon, 21 Jan 2019, Christoph Hellwig wrote: > >>> > >>

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Christoph Hellwig wrote: > On Mon, Jan 21, 2019 at 11:44:10AM -0800, Liam Mark wrote: > > The main use case is for allowing clients to pass in > > DMA_ATTR_SKIP_CPU_SYNC in order to skip the default cache maintenance > > which happens in dma_b

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Andrew F. Davis wrote: > On 1/21/19 1:44 PM, Liam Mark wrote: > > On Mon, 21 Jan 2019, Christoph Hellwig wrote: > > > >> On Sat, Jan 19, 2019 at 08:50:41AM -0800, Laura Abbott wrote: > >>>> And who is going to decide which ones to pas

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Christoph Hellwig wrote: > On Sat, Jan 19, 2019 at 08:50:41AM -0800, Laura Abbott wrote: > > > And who is going to decide which ones to pass? And who documents > > > which ones are safe? > > > > > > I'd much rather have explicit, well documented dma-buf flags that > > > migh

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Christoph Hellwig wrote: > On Mon, Jan 21, 2019 at 12:20:42PM -0800, Liam Mark wrote: > > I have left this to clients, but if they own the buffer they can have the > > knowledge as to whether CPU access is needed in that use case (example for > > post-p

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-22 Thread Liam Mark
On Mon, 21 Jan 2019, Andrew F. Davis wrote: > On 1/18/19 3:43 PM, Liam Mark wrote: > > On Fri, 18 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/17/19 7:04 PM, Liam Mark wrote: > >>> On Thu, 17 Jan 2019, Andrew F. Davis wrote: > >>> > >>&

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-22 Thread Liam Mark
On Fri, 18 Jan 2019, Andrew F. Davis wrote: > On 1/17/19 7:11 PM, Liam Mark wrote: > > On Thu, 17 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/16/19 4:54 PM, Liam Mark wrote: > >>> On Wed, 16 Jan 2019, Andrew F. Davis wrote: > >>> > >&

Re: [PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-20 Thread Liam Mark
On Fri, 18 Jan 2019, Laura Abbott wrote: > On 1/18/19 10:37 AM, Liam Mark wrote: > > Add support for configuring dma mapping attributes when mapping > > and unmapping memory through dma_buf_map_attachment and > > dma_buf_unmap_attachment. > > > > Signed-off-by:

[PATCH 3/4] dma-buf: add support for mapping with dma mapping attributes

2019-01-20 Thread Liam Mark
Add support for configuring dma mapping attributes when mapping and unmapping memory through dma_buf_map_attachment and dma_buf_unmap_attachment. Signed-off-by: Liam Mark --- include/linux/dma-buf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/dma-buf.h b/include/linux

Re: [PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory

2019-01-20 Thread Liam Mark
On Fri, 18 Jan 2019, Andrew F. Davis wrote: > On 1/18/19 12:37 PM, Liam Mark wrote: > > The ION begin_cpu_access and end_cpu_access functions use the > > dma_sync_sg_for_cpu and dma_sync_sg_for_device APIs to perform cache > > maintenance. > > > > Curren

[PATCH 2/4] staging: android: ion: Restrict cache maintenance to dma mapped memory

2019-01-20 Thread Liam Mark
("staging: android: ion: Call dma_map_sg for syncing and mapping") Signed-off-by: Liam Mark --- drivers/staging/android/ion/ion.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android

[PATCH 4/4] staging: android: ion: Support for mapping with dma mapping attributes

2019-01-20 Thread Liam Mark
been accessed by the CPU. Signed-off-by: Liam Mark --- drivers/staging/android/ion/ion.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 1fe633a7fdba..0aae845b20ba 100644 --- a/drivers/staging/androi

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-20 Thread Liam Mark
On Fri, 18 Jan 2019, Andrew F. Davis wrote: > On 1/17/19 7:04 PM, Liam Mark wrote: > > On Thu, 17 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/16/19 4:48 PM, Liam Mark wrote: > >>> On Wed, 16 Jan 2019, Andrew F. Davis wrote: > >>> > >>&

[PATCH 1/4] staging: android: ion: Support cpu access during dma_buf_detach

2019-01-20 Thread Liam Mark
Fixes: 2a55e7b5e544 ("staging: android: ion: Call dma_map_sg for syncing and mapping") Signed-off-by: Liam Mark --- drivers/staging/android/ion/ion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/

[PATCH 0/4] ION stability and perf changes

2019-01-20 Thread Liam Mark
Some stability changes to improve ION robustness and a perf related change to make it easier for clients to avoid unnecessary cache maintenance, such as when buffers are clean and haven't had any CPU access. Liam Mark (4): staging: android: ion: Support cpu access during dma_buf_d

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-18 Thread Liam Mark
On Thu, 17 Jan 2019, Andrew F. Davis wrote: > On 1/16/19 4:54 PM, Liam Mark wrote: > > On Wed, 16 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/16/19 9:19 AM, Brian Starkey wrote: > >>> Hi :-) > >>> > >>> On Tue, Jan 15, 2019 at 12:4

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-18 Thread Liam Mark
On Thu, 17 Jan 2019, Andrew F. Davis wrote: > On 1/16/19 4:48 PM, Liam Mark wrote: > > On Wed, 16 Jan 2019, Andrew F. Davis wrote: > > > >> On 1/15/19 1:05 PM, Laura Abbott wrote: > >>> On 1/15/19 10:38 AM, Andrew F. Davis wrote: > >>>> On 1/

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-17 Thread Liam Mark
On Wed, 16 Jan 2019, Andrew F. Davis wrote: > On 1/16/19 9:19 AM, Brian Starkey wrote: > > Hi :-) > > > > On Tue, Jan 15, 2019 at 12:40:16PM -0600, Andrew F. Davis wrote: > >> On 1/15/19 12:38 PM, Andrew F. Davis wrote: > >>> On 1/15/19 11:45 AM, L

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-17 Thread Liam Mark
On Wed, 16 Jan 2019, Andrew F. Davis wrote: > On 1/15/19 1:05 PM, Laura Abbott wrote: > > On 1/15/19 10:38 AM, Andrew F. Davis wrote: > >> On 1/15/19 11:45 AM, Liam Mark wrote: > >>> On Tue, 15 Jan 2019, Andrew F. Davis wrote: > >>> > >>>>

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-16 Thread Liam Mark
On Tue, 15 Jan 2019, Andrew F. Davis wrote: > On 1/14/19 11:13 AM, Liam Mark wrote: > > On Fri, 11 Jan 2019, Andrew F. Davis wrote: > > > >> Buffers may not be mapped from the CPU so skip cache maintenance here. > >> Accesses from the CPU to a cached heap should

Re: [PATCH 13/14] staging: android: ion: Do not sync CPU cache on map/unmap

2019-01-14 Thread Liam Mark
On Fri, 11 Jan 2019, Andrew F. Davis wrote: > Buffers may not be mapped from the CPU so skip cache maintenance here. > Accesses from the CPU to a cached heap should be bracketed with > {begin,end}_cpu_access calls so maintenance should not be needed anyway. > > Signed-off-by: Andrew F. Davis > -

Re: [RFC PATCH v2] android: ion: How to properly clean caches for uncached allocations

2018-11-29 Thread Liam Mark
On Wed, 28 Nov 2018, Brian Starkey wrote: > Hi Liam, > > On Tue, Nov 27, 2018 at 10:46:07PM -0800, Liam Mark wrote: > > On Tue, 27 Nov 2018, Brian Starkey wrote: > > > > > Hi Liam, > > > > > > On Mon, Nov 26, 2018 at 08:59:44PM -0800, Liam Mark w

Re: [RFC PATCH v2] android: ion: How to properly clean caches for uncached allocations

2018-11-28 Thread Liam Mark
On Tue, 27 Nov 2018, Brian Starkey wrote: > Hi Liam, > > On Mon, Nov 26, 2018 at 08:59:44PM -0800, Liam Mark wrote: > > On Tue, 20 Nov 2018, Brian Starkey wrote: > > > > > Hi Liam, > > > > > > I'm missing a bit of context here, but I did re

Re: [RFC PATCH v2] android: ion: How to properly clean caches for uncached allocations

2018-11-27 Thread Liam Mark
hich > certainly seem to be related to what you're trying to fix here. > > On Thu, Nov 01, 2018 at 03:15:06PM -0700, Liam Mark wrote: > >Based on the suggestions from Laura I created a first draft for a change > >which will attempt to ensure that uncached mappings are onl

Re: [RFC PATCH v2] android: ion: How to properly clean caches for uncached allocations

2018-11-07 Thread Liam Mark
On Fri, 2 Nov 2018, John Stultz wrote: > On Thu, Nov 1, 2018 at 3:15 PM, Liam Mark wrote: > > Based on the suggestions from Laura I created a first draft for a change > > which will attempt to ensure that uncached mappings are only applied to > > ION memory who's cac

[RFC PATCH v2] android: ion: How to properly clean caches for uncached allocations

2018-11-02 Thread Liam Mark
apping. Please let me know if this is heading in the right direction and if there are any concerns. Signed-off-by: Liam Mark --- drivers/staging/android/ion/ion.c | 146 +- drivers/staging/android/ion/ion.h | 9 +++ 2 files changed, 152 insertions(+), 3 del

Re: [PATCH] staging: ion: Rework ion_map_dma_buf() to minimize re-mapping

2018-10-15 Thread Liam Mark
very > > ion_map_dma_buf/ion_unmap_dma_buf call, and instead try to do > > the work in attach/detach paths. > > > > I'm not 100% sure of the correctness here, so close review would > > be good, but it gets the performance back to being similar to > >