RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-09-26 Thread Marek Szyprowski
Hello, I'm sorry for the late reply. I must have missed this mail... On Wednesday, August 03, 2011 7:44 PM James Bottomley wrote: [cc to ks-discuss added, since this may be a relevant topic] On Tue, 2011-07-05 at 14:27 +0200, Arnd Bergmann wrote: On Tuesday 05 July 2011, Russell King -

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-09-26 Thread Russell King - ARM Linux
On Wed, Aug 03, 2011 at 12:43:50PM -0500, James Bottomley wrote: I assume from the above that ARM has a hardware page walker? Correct, and speculative prefetch (which isn't prevented by not having TLB entries), so you can't keep entries out of the TLB. If it's in the page tables it can end up

[PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-08-19 Thread Marek Szyprowski
The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and gives back to the system. Kernel is allowed to allocate movable pages within CMA's

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-08-03 Thread James Bottomley
[cc to ks-discuss added, since this may be a relevant topic] On Tue, 2011-07-05 at 14:27 +0200, Arnd Bergmann wrote: On Tuesday 05 July 2011, Russell King - ARM Linux wrote: On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote: The Contiguous Memory Allocator is a set of helper

[PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-20 Thread Marek Szyprowski
The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and gives back to the system. Kernel is allowed to allocate movable pages within CMA's

RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-14 Thread Marek Szyprowski
Hello, I've just found two nasty bugs in this version of CMA. Sadly, both are the results of posting the patches in a big hurry. I'm really sorry. Alignment argument was not passed correctly to the bitmap_find_next_zero_area() function and there was an ugly bug in the

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-12 Thread Arnd Bergmann
On Friday 08 July 2011, Russell King - ARM Linux wrote: On Tue, Jul 05, 2011 at 03:58:39PM +0200, Arnd Bergmann wrote: If I'm reading your ARM: DMA: steal memory for DMA coherent mappings correctly, the idea is to have a per-platform compile-time amount of memory that is reserved purely

RE: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-11 Thread Marek Szyprowski
Hello, On Saturday, July 09, 2011 4:57 PM Janusz Krzysztofik wrote: On Wed, 6 Jul 2011 at 16:59:45 Arnd Bergmann wrote: On Wednesday 06 July 2011, Nicolas Pitre wrote: On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: Another issue is that when a platform has restricted DMA

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-11 Thread Janusz Krzysztofik
Dnia poniedziałek, 11 lipca 2011 o 15:47:32 Marek Szyprowski napisał(a): Hello, On Saturday, July 09, 2011 4:57 PM Janusz Krzysztofik wrote: On Wed, 6 Jul 2011 at 16:59:45 Arnd Bergmann wrote: On Wednesday 06 July 2011, Nicolas Pitre wrote: On Wed, 6 Jul 2011, Russell King - ARM Linux

RE: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-11 Thread Marek Szyprowski
Hello, On Monday, July 11, 2011 9:01 PM Janusz Krzysztofik wrote: Dnia poniedziałek, 11 lipca 2011 o 15:47:32 Marek Szyprowski napisał(a): Hello, On Saturday, July 09, 2011 4:57 PM Janusz Krzysztofik wrote: On Wed, 6 Jul 2011 at 16:59:45 Arnd Bergmann wrote: On Wednesday 06

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-09 Thread Janusz Krzysztofik
On Wed, 6 Jul 2011 at 16:59:45 Arnd Bergmann wrote: On Wednesday 06 July 2011, Nicolas Pitre wrote: On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: Another issue is that when a platform has restricted DMA regions, they typically don't fall into the highmem zone. As the dmabounce

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-08 Thread Russell King - ARM Linux
On Tue, Jul 05, 2011 at 03:58:39PM +0200, Arnd Bergmann wrote: Ah, sorry I missed that patch on the mailing list, found it now in your for-next branch. I've been searching for this email to reply to for the last day or so... If I'm reading your ARM: DMA: steal memory for DMA coherent mappings

RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Marek Szyprowski
Hello, On Tuesday, July 05, 2011 1:34 PM Russell King - ARM Linux wrote: On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote: The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Arnd Bergmann
On Wednesday 06 July 2011, Marek Szyprowski wrote: The only problem that might need to be resolved is GFP_ATOMIC allocation (updating page properties probably requires some locking), but it can be served from a special area which is created on boot without low-memory mapping at all. None sane

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Russell King - ARM Linux
On Wed, Jul 06, 2011 at 04:09:29PM +0200, Arnd Bergmann wrote: Maybe you can simply adapt the default location of the contiguous memory are like this: - make CONFIG_CMA depend on CONFIG_HIGHMEM on ARM, at compile time - if ZONE_HIGHMEM exist during boot, put the CMA area in there - otherwise,

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Nicolas Pitre
On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: Another issue is that when a platform has restricted DMA regions, they typically don't fall into the highmem zone. As the dmabounce code allocates from the DMA coherent allocator to provide it with guaranteed DMA-able memory, that would be

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Arnd Bergmann
On Wednesday 06 July 2011, Russell King - ARM Linux wrote: On Wed, Jul 06, 2011 at 04:09:29PM +0200, Arnd Bergmann wrote: Maybe you can simply adapt the default location of the contiguous memory are like this: - make CONFIG_CMA depend on CONFIG_HIGHMEM on ARM, at compile time - if

RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Marek Szyprowski
Hello, On Wednesday, July 06, 2011 4:09 PM Arnd Bergmann wrote: On Wednesday 06 July 2011, Marek Szyprowski wrote: The only problem that might need to be resolved is GFP_ATOMIC allocation (updating page properties probably requires some locking), but it can be served from a special area

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Arnd Bergmann
On Wednesday 06 July 2011, Nicolas Pitre wrote: On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: Another issue is that when a platform has restricted DMA regions, they typically don't fall into the highmem zone. As the dmabounce code allocates from the DMA coherent allocator to

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Russell King - ARM Linux
On Wed, Jul 06, 2011 at 04:56:23PM +0200, Marek Szyprowski wrote: This will not solve our problems. We need CMA also to create at least one device private area that for sure will be in low memory (video codec). You make these statements but you don't say why. Can you please explain why the

RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Marek Szyprowski
Hello, On Wednesday, July 06, 2011 5:37 PM Russell King - ARM Linux wrote: On Wed, Jul 06, 2011 at 04:56:23PM +0200, Marek Szyprowski wrote: This will not solve our problems. We need CMA also to create at least one device private area that for sure will be in low memory (video codec).

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Russell King - ARM Linux
On Wed, Jul 06, 2011 at 04:51:49PM +0200, Arnd Bergmann wrote: On Wednesday 06 July 2011, Russell King - ARM Linux wrote: On Wed, Jul 06, 2011 at 04:09:29PM +0200, Arnd Bergmann wrote: Maybe you can simply adapt the default location of the contiguous memory are like this: - make

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Michal Nazarewicz
On Wed, 06 Jul 2011 18:05:00 +0200, Christoph Lameter c...@linux.com wrote: ZONE_DMA is a zone for memory of legacy (crippled) devices that cannot DMA into all of memory (and so is ZONE_DMA32). Memory from ZONE_NORMAL can be used for DMA as well and a fully capable device would be expected to

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Christoph Lameter
On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: they typically don't fall into the highmem zone. As the dmabounce code allocates from the DMA coherent allocator to provide it with guaranteed DMA-able memory, that would be rather inconvenient. True. The dmabounce code would

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Christoph Lameter
On Wed, 6 Jul 2011, Michal Nazarewicz wrote: On Wed, 06 Jul 2011 18:05:00 +0200, Christoph Lameter c...@linux.com wrote: ZONE_DMA is a zone for memory of legacy (crippled) devices that cannot DMA into all of memory (and so is ZONE_DMA32). Memory from ZONE_NORMAL can be used for DMA as

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Arnd Bergmann
On Wednesday 06 July 2011, Russell King - ARM Linux wrote: On Wed, Jul 06, 2011 at 04:51:49PM +0200, Arnd Bergmann wrote: On Wednesday 06 July 2011, Russell King - ARM Linux wrote: I don't see how. The pages get allocated from an unmapped area or memory, mapped into the kernel address

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Russell King - ARM Linux
On Wed, Jul 06, 2011 at 11:05:00AM -0500, Christoph Lameter wrote: On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: they typically don't fall into the highmem zone. As the dmabounce code allocates from the DMA coherent allocator to provide it with guaranteed DMA-able memory,

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Russell King - ARM Linux
On Wed, Jul 06, 2011 at 11:19:00AM -0500, Christoph Lameter wrote: What I described is the basic memory architecture of Linux. I am not that familiar with ARM and the issue discussed here. Only got involved because ZONE_DMA was mentioned. The nature of ZONE_DMA is often misunderstood. The

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Christoph Lameter
On Wed, 6 Jul 2011, Russell King - ARM Linux wrote: So, ARM is no different from x86, with the exception that the 16MB DMA zone due to ISA ends up being different sizes on ARM depending on our restrictions. Sounds good. Thank you. -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Nicolas Pitre
On Wed, 6 Jul 2011, Arnd Bergmann wrote: On Wednesday 06 July 2011, Russell King - ARM Linux wrote: On Wed, Jul 06, 2011 at 04:51:49PM +0200, Arnd Bergmann wrote: On Wednesday 06 July 2011, Russell King - ARM Linux wrote: I don't see how. The pages get allocated from an unmapped area

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Arnd Bergmann
On Wednesday 06 July 2011 21:10:07 Nicolas Pitre wrote: If you get a highmem page, because the cache is VIPT, that page might still be cached even if it wasn't mapped. With a VIVT cache we must flush the cache whenever a highmem page is unmapped. There is no such restriction with VIPT

Re: [Linaro-mm-sig] [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-06 Thread Nicolas Pitre
On Wed, 6 Jul 2011, Arnd Bergmann wrote: On Wednesday 06 July 2011 21:10:07 Nicolas Pitre wrote: If you get a highmem page, because the cache is VIPT, that page might still be cached even if it wasn't mapped. With a VIVT cache we must flush the cache whenever a highmem page is unmapped.

[PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Marek Szyprowski
The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and gives back to the system. Kernel is allowed to allocate movable pages within CMA's

RE: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Marek Szyprowski
Hello, On Tuesday, July 05, 2011 9:42 AM Marek Szyprowski wrote: The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and gives back to

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Russell King - ARM Linux
On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote: The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and gives back to

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Arnd Bergmann
On Tuesday 05 July 2011, Russell King - ARM Linux wrote: On Tue, Jul 05, 2011 at 09:41:48AM +0200, Marek Szyprowski wrote: The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Russell King - ARM Linux
On Tue, Jul 05, 2011 at 02:27:44PM +0200, Arnd Bergmann wrote: It's also a preexisting problem as far as I can tell, and it needs to be solved in __dma_alloc for both cases, dma_alloc_from_contiguous and __alloc_system_pages as introduced in patch 7. Which is now resolved in linux-next, and

Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator

2011-07-05 Thread Arnd Bergmann
On Tuesday 05 July 2011, Russell King - ARM Linux wrote: On Tue, Jul 05, 2011 at 02:27:44PM +0200, Arnd Bergmann wrote: It's also a preexisting problem as far as I can tell, and it needs to be solved in __dma_alloc for both cases, dma_alloc_from_contiguous and __alloc_system_pages as