Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-17 Thread Christoph Hellwig
On Sat, Dec 15, 2018 at 12:14:29AM +1000, Greg Ungerer wrote: > Yep, that is right. Certainly the MMU case is broken. Some noMMU cases work > by virtue of the SoC only having an instruction cache (the older V2 cores). Is there a good an easy case to detect if a core has a cache? Either runtime

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 07:10:56PM +0100, Sam Ravnborg wrote: > Hi Christoph, > > I stumbled upon this one: > > #define __get_dma_pages(gfp_mask, order) \ > __get_free_pages((gfp_mask) | GFP_DMA, (order)) This isn't directly related to the dma mapping, but another place that

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Sam Ravnborg
Hi Christoph, I stumbled upon this one: #define __get_dma_pages(gfp_mask, order) \ __get_free_pages((gfp_mask) | GFP_DMA, (order)) (include/linux/gfp.h) Should it also have the __GFP_ZERO treatment? Or maybe this is already done in your tree.. As for the sparc bits: Acked-by:

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Greg Ungerer
On 14/12/18 9:47 pm, Christoph Hellwig wrote: On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: - page = alloc_pages(flag, order); + page = alloc_pages(flag | GFP_ZERO, order); if (!page) return NULL; There's second implementation

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Dec 14, 2018 at 12:47 PM Christoph Hellwig wrote: > > On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: > > > - page = alloc_pages(flag, order); > > > + page = alloc_pages(flag | GFP_ZERO, order); > > > if (!page) > > >

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Eugeniy Paltsev
Hi Christoph, do you have any public git repository with all your dma changes? I want to test them for ARC. Thanks. On Fri, 2018-12-14 at 09:25 +0100, Christoph Hellwig wrote: > If we want to map memory from the DMA allocator to userspace it must be > zeroed at allocation time to prevent stale

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread h...@lst.de
On Fri, Dec 14, 2018 at 12:12:00PM +, Eugeniy Paltsev wrote: > Hi Christoph, > > do you have any public git repository with all your dma changes? Most of the tree show up in my misc.git repo for testing. This series is here:

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages()

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > If we want to map memory from the DMA allocator to userspace it must be > zeroed at allocation time to prevent stale data leaks. We already do > this on most common architectures, but some architectures don't do this >

[PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
If we want to map memory from the DMA allocator to userspace it must be zeroed at allocation time to prevent stale data leaks. We already do this on most common architectures, but some architectures don't do this yet, fix them up, either by passing GFP_ZERO when we use the normal page allocator