Skip to content

Commit

Permalink
sel4utils: properly cache ept pages (#43)
Browse files Browse the repository at this point in the history
A kernel bug previously always cached EPT page regardless of the
cacheable flag. When the bug was fixed, this function would always map
EPT pages as uncacheable, due to the attributes difference between an
EPT map and a normal page map. This commit checks if the function is
mapping an EPT and provides the proper cache attribute to the kernel.

Signed-off-by: Chris Guikema <[email protected]>
  • Loading branch information
chrisguikema authored Sep 6, 2021
1 parent 6de2249 commit dd02025
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libsel4utils/src/mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ static int map_page(vka_t *vka, vspace_map_page_fn_t map_page_fn, vspace_get_map
seL4_ARCH_VMAttributes attr = cacheable ? seL4_ARCH_Default_VMAttributes :
seL4_ARCH_Uncached_VMAttributes;

/* EPT attributes are different than a standard page table. Previously, a kernel bug
* masked the problem by always setting EPT mappings to WriteBack. Once the bug was
* fixed, every page became uncached, killing VM performance.
*
* This check ensure the pages are properly cached
*/
#ifdef CONFIG_VTX
if (seL4_X86_Page_MapEPT == map_page_fn) {
attr = cacheable ? seL4_X86_EPT_Default_VMAttributes :
seL4_X86_EPT_Uncached_VMAttributes;
}
#endif

*num_objects = 0;
int error = map_page_fn(frame, root, (seL4_Word) vaddr, rights, attr);
while (error == seL4_FailedLookup) {
Expand Down

0 comments on commit dd02025

Please sign in to comment.