ION doesn't set the cache attributes according to ION_FLAG_CACHED buffer flag

Alexey Skidanov alexey.skidanov at intel.com
Sun May 12 09:13:43 UTC 2019


Hi,

Mapping the buffer to user space, ION failed to set the cache attributes
according to ION_FLAG_CACHED flag on x86.

When the reserved memory (reserved by memmap= kernel boot option) or
part of it is mapped to the user space, the user space memory mapping is
always *uncachable*.

ION uses remap_pfn_range to create the mapping. On x86 arch, the actual
cache attributes may be different from the requested ones due to the PAT
implementation. When we map the PFNs one by one to some VMA, the cache
attributes are set by lookup_memtype, completely ignoring the cache
attributes of VMA. For example:
- if the requested memory region is managed by the OS (has struct page
object), the actual cache attribute is set based on struct page cache
attributes saved in its flag member
- if the memory region is not managed by the OS (there are no struct
page object), the PAT internal RBT of memory types is scanned. If RBT
defines the memory type for the requested PFN, this memory type is used,
otherwise the PFN is mapped as uncachable.

Is it x86 specific issue?

I have implemented and tested the fix for this issue, but it looks like
it should be submitted to the PAT.

Thanks,
Alexey


More information about the devel mailing list