Re: [PATCHv8 00/12] Contiguous Memory Allocator

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Russell King - ARM Linux
Date: Thursday, December 23, 2010 - 6:44 am

On Thu, Dec 23, 2010 at 02:09:44PM +0100, Marek Szyprowski wrote:

So, here you've confirmed that it's for DMA.


I have considered - and tried - to do that with the dma_alloc_coherent()
spec, but it is NOT POSSIBLE to do so - too many factors stand in the
way of making it work, such as the need bring the system to a complete
halt to modify all the L1 page tables and broadcast the TLB operations
to invalidate the old mappings.  None of that can be done from all the
contexts under which dma_alloc_coherent() is called from.


Rubbish - if you think that, then you have very little understanding of
modern CPUs.  Modern CPUs speculatively access _any_ memory which is
visible to them, and as the ARM architecture progresses, the speculative
prefetching will become more aggressive.  So if you have memory mapped
in the kernel direct map, then you _have_ to assume that the CPU will
fire off accesses to that memory at any time, loading it into its cache.


The only solution I've come up for dma_alloc_coherent() is to reserve
the entire coherent DMA region at boot time, taking it out of the
kernel's view of available memory and thereby preventing it from ever
being mapped or the kernel using that memory for any other purpose.
That's about the best we can realistically do for ARM to conform to the
spec.

Every time I've brought this issue up with you, you've brushed it aside.
So if you feel that the right thing to do is to ignore such issues, you
won't be surprised if I keep opposing your efforts to get this into
mainline.

If you're serious about making this work, then provide some proper code
which shows how to use this for DMA on ARM systems without violating
the architecture specification.  Until you do, I see no hope that CMA
will ever be suitable for use on ARM.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv8 00/12] Contiguous Memory Allocator, Michal Nazarewicz, (Wed Dec 15, 1:34 pm)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Kyungmin Park, (Thu Dec 23, 2:30 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 3:06 am)
RE: [PATCHv8 00/12] Contiguous Memory Allocator, Marek Szyprowski, (Thu Dec 23, 3:58 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 5:19 am)
RE: [PATCHv8 00/12] Contiguous Memory Allocator, Marek Szyprowski, (Thu Dec 23, 6:09 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Tomasz Fujak, (Thu Dec 23, 6:35 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Michal Nazarewicz, (Thu Dec 23, 6:41 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 6:44 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 6:48 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 6:51 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Tomasz Fujak, (Thu Dec 23, 7:04 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Tomasz Fujak, (Thu Dec 23, 7:08 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 7:16 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Thu Dec 23, 7:20 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Felipe Contreras, (Thu Dec 23, 7:42 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Michal Nazarewicz, (Thu Dec 23, 8:02 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Tomasz Fujak, (Thu Dec 23, 8:35 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, David Brown, (Thu Dec 23, 11:04 am)
RE: [PATCHv8 00/12] Contiguous Memory Allocator, Johan MOSSBERG, (Tue Jan 4, 9:23 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Michał Nazarewicz, (Tue Jan 4, 9:59 am)
Re: [PATCHv8 00/12] Contiguous Memory Allocator, Russell King - ARM Linux, (Tue Jan 4, 10:19 am)
RE: [PATCHv8 00/12] Contiguous Memory Allocator, Santosh Shilimkar, (Tue Jan 4, 10:31 am)