x86/boot: Avoid global attribute in early memory mappings
PATCH 1/1 x86/boot: Avoid global attribute in early memory mappings
From: Ard Biesheuvel <[email protected]>
The decompressor uses the __PAGE_KERNEL_LARGE_EXEC template to create page table entries, and this includes the 'G' global bit. Global mappings are a performance optimization that requires more elaborate TLB maintenance, which the decompressor does not implement, and so global mappings are disabled entirely, by clearing CR4.PGE in the startup code.
Since global mappings are not used, it is better to avoid setting the bit altogether, so clear it from the 'flag' variable used to populate page table entries.
Signed-off-by Ard Biesheuvel <[email protected]>
--- arch/x86/boot/compressed/ident_map_64.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/boot/compressed/ident_map_64.c +6 -0
@@ -121,6 +121,12 @@ void initialize_identity_maps(void *rmode) mapping_info.page_flag = __PAGE_KERNEL_LARGE_EXEC | sme_me_mask; mapping_info.kernpg_flag = _KERNPG_TABLE; +/* +* Entries with the G bit require more elaborate TLB maintenance, +* so avoid them for these early mappings. +*/ + mapping_info.page_flag &= ~_PAGE_GLOBAL; +/* * It should be impossible for this not to already be true, * but since calling this a second time would rewind the other
Signature · 1 line
2.45.0.rc1.225.g2a3ae87e7f-goog