On Mon, Aug 27, 2012 at 9:25 AM, Laura Abbott lauraa@codeaurora.org wrote:
On 8/24/2012 12:09 PM, Rebecca Schultz Zavin wrote:
You are correct, there is a bug in map_kernel for the contigious heap -- it's bit rotted a bit as it's not in use on the program I am currently working on. It shouldn't be using ioremap, it should be using vmap for highmem or can just return the mapping for lowmem if appropriate. I will take a patch that fixes this or fix it myself when I get a chance.
But ION use dma_sync_sg_for_devices() to flush cache that means they're using linear address from page. So they're using the NOT-EXISTED virtual address that is removed by memblock_remove().
When I modified ion to use the dma api's I made a conscious decision to stop supporting memory that was removed from the kernel. The benefits of the dma api's outweighed the small cost of having the metadata around in my mind. Memory for contiguous heaps can be put aside using memblock_reserve instead.
I'm concerned about dropping support for memblock_remove'd memory. On ARMv7 targets, this places a restriction on only having carveout regions in highmem to avoid the multiple mapping problems if we need to use writecombined memory. This thread has established that using the dma apis on memory reserved with memblock_remove can't happen, but what about memory that just needs to be uncached? This seems like an appropriate use of memblock_remove, especially for lowmem areas.
Also, what about targets that lack highmem?
You don't have to have carveout regions in highmem. If you read the section of the ARM reference manual on mismatched memory attributes they've qualified the conditions that cause problems -- at one point I think it just said behavior was undefined. The issues only occur if you have two mappings with different sharability attributes. In our case we have two normal mappings, one for the unity map and one for ion. In this case you must properly manage in software the two mappings to ensure coherency, i.e. flushing and invalidating when necessary between accesses to the two mappings, but otherwise no issues with occur. Note that I've checked this with both ARM and Qualcomm architects to make sure it is correct. Hope this helps clarify things for you.
Rebecca
Laura
Linaro-mm-sig mailing list Linaro-mm-sig@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-mm-sig
-- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.