EFI memmap and other fixes, v3
Borislav Petkov
maintainercover EFI memmap and other fixes, v3
From: Borislav Petkov <[email protected]>
Hi all,
this is the latest incarnation which should hopefully work just fine. It tpasses esting at least on all our boxes so we have *some* coverage.
It took us a long time to debug the unmapping path and realize how exactly we're doing the PGD sharing between the kernel and the EFI page table. I've commented on this verbosely in 4/5 for future reference because this stuff is not trivial.
We definitely should have this in mind when we do more changes on how we handle the EFI page table and what we do with it, maybe even decouple it completely from the kernel one. I dunno - it is all future stuff to pay attention to.
Anyway, if anyone with an EFI box wants to give it a run, feel free to do so.
As always, all comments and suggestions are appreciated.
Thanks.
Changelog:
* v2:
here's v2 rebased and rediffed against tip (which has the relevant efi branches).
* v1:
this is the result of Toshi and me debugging a #GP on one of his big HP boxes sporting UEFI. Each commit message should be self-explanatory so please look there.
This has more or less an RFC nature thus I'm sending it now to collect feedback. It is going to wait in the EFI queue anyway after the kexec stuff gets sorted out first.
Borislav Petkov (5):
x86, ptdump: Add the functionality to dump an arbitrary pagetable
efi: Dump the EFI page table
x86, pageattr: Export page unmapping interface
efi: Make efi virtual runtime map passing more robust
efi: Split efi_enter_virtual_mode
arch/x86/Kconfig | 9 ++ arch/x86/include/asm/efi.h | 4 +- arch/x86/include/asm/pgtable.h | 3 +- arch/x86/include/asm/pgtable_types.h | 2 + arch/x86/mm/dump_pagetables.c | 84 +++++++++----- arch/x86/mm/pageattr.c | 44 +++++--- arch/x86/platform/efi/efi.c | 210 ++++++++++++++++++++++++++--------- arch/x86/platform/efi/efi_32.c | 7 +- arch/x86/platform/efi/efi_64.c | 41 ++++++- include/linux/efi.h | 1 + 10 files changed, 304 insertions(+), 101 deletions(-)
Signature · 1 line
1.8.5.2.192.g7794a68
Borislav Petkov
maintainerPATCH 1/5 x86, ptdump: Add the functionality to dump an arbitrary pagetable
From: Borislav Petkov <[email protected]>
With reusing the ->trampoline_pgd page table for mapping EFI regions in order to use them after having switched to EFI virtual mode, it is very useful to be able to dump aforementioned page table in dmesg. This adds that functionality through the walk_pgd_level() interface which can be called from somewhere else.
The original functionality of dumping to debugfs remains untouched.
--- arch/x86/include/asm/pgtable.h | 3 +- arch/x86/mm/dump_pagetables.c | 84 +++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 31 deletions(-)
arch/x86/include/asm/pgtable.h +2 -1
@@ -15,9 +15,10 @@ : (prot))#ifndef __ASSEMBLY__ -#include <asm/x86_init.h> +void ptdump_walk_pgd_level (struct seq_file *m,pgd_t *pgd); +/* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc..
arch/x86/mm/dump_pagetables.c +54 -30
171 lines not on this page · raw message
Signature · 1 line
1.8.5.2.192.g7794a68
Borislav Petkov
maintainerPATCH 2/5 efi: Dump the EFI page table
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
This is very useful for debugging issues with the recently added pagetable switching code for EFI virtual mode.
--- arch/x86/Kconfig | 9 +++++++++ arch/x86/include/asm/efi.h | 1 + arch/x86/platform/efi/efi.c | 1 + arch/x86/platform/efi/efi_32.c | 1 + arch/x86/platform/efi/efi_64.c | 9 +++++++++ 5 files changed, 21 insertions(+)
arch/x86/Kconfig +9 -0
@@ -1614,6 +1614,15 @@ config EFI_STUB See Documentation/efi-stub.txt for more information. +config EFI_PGT_DUMP + bool "Dump the EFI pagetable" + depends on EFI && X86_PTDUMP + ---help--- + Enable this if you want to dump the EFI page table before + enabling virtual mode. This can be used to debug miscellaneous + issues with the mapping of the EFI runtime regions into that + table. + config SECCOMP def_bool y prompt "Enable seccomp to safely compute untrusted bytecode"
arch/x86/include/asm/efi.h +1 -0
@@ -132,6 +132,7 @@ extern void __init efi_map_region_fixed(efi_memory_desc_t *md);extern void efi_sync_low_kernel_mappings (void );extern void efi_setup_page_tables (void );extern void __init old_map_region (efi_memory_desc_t *md); +extern void __init efi_dump_pagetable (void );struct efi_setup_data {u64 fw_vendor;
arch/x86/platform/efi/efi.c +1 -0
@@ -1033,6 +1033,7 @@ void __init efi_enter_virtual_mode(void)efi_setup_page_tables ();efi_sync_low_kernel_mappings (); +efi_dump_pagetable ();if (!efi_setup) { status = phys_efi_set_virtual_address_map(
arch/x86/platform/efi/efi_32.c +1 -0
@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags;void efi_sync_low_kernel_mappings (void ) {}void efi_setup_page_tables (void ) {} +void __init efi_dump_pagetable (void ) {}void __init efi_map_region (efi_memory_desc_t *md) {
arch/x86/platform/efi/efi_64.c +9 -0
@@ -233,3 +233,12 @@ void __init parse_efi_setup(u64 phys_addr, u32 data_len) { efi_setup = phys_addr +sizeof (struct setup_data ); } + +void __init efi_dump_pagetable (void ) +{ +#ifdef CONFIG_EFI_PGT_DUMP +pgd_t *pgd = (pgd_t *)__va (real_mode_header->trampoline_pgd); + +ptdump_walk_pgd_level (NULL , pgd); +#endif +}
Signature · 1 line
1.8.5.2.192.g7794a68
Re: [PATCH 2/5] efi: Dump the EFI page table
Quoted 22 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
This is very useful for debugging issues with the recently added pagetable switching code for EFI virtual mode.
Signed-off-by Borislav Petkov <[email protected]>Tested-by Toshi Kani <[email protected]>--- arch/x86/Kconfig | 9 +++++++++ arch/x86/include/asm/efi.h | 1 + arch/x86/platform/efi/efi.c | 1 + arch/x86/platform/efi/efi_32.c | 1 + arch/x86/platform/efi/efi_64.c | 9 +++++++++ 5 files changed, 21 insertions(+)arch/x86/Kconfig +0
-0@@ -1614,6 +1614,15 @@ config EFI_STUB See Documentation/efi-stub.txt for more information.
arch/x86/Kconfig config EFI_STUB · line 1625
Quoted 10 lines
arch/x86/Kconfig +9
-0+config EFI_PGT_DUMP + bool "Dump the EFI pagetable" + depends on EFI && X86_PTDUMP + ---help--- + Enable this if you want to dump the EFI page table before + enabling virtual mode. This can be used to debug miscellaneous + issues with the mapping of the EFI runtime regions into that + table. +
Would this be more suitable in arch/x86/Kconfig.debug?
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Borislav Petkov
maintainerRe: [PATCH 2/5] efi: Dump the EFI page table
Quoted 11 lines · Matt Fleming
arch/x86/Kconfig config EFI_STUB · line 1625
Quoted 9 lines
arch/x86/Kconfig +9
-0+config EFI_PGT_DUMP + bool "Dump the EFI pagetable" + depends on EFI && X86_PTDUMP + ---help--- + Enable this if you want to dump the EFI page table before + enabling virtual mode. This can be used to debug miscellaneous + issues with the mapping of the EFI runtime regions into that + table. +Would this be more suitable in
arch/x86/Kconfig.debug?
I wanted to keep it close to CONFIG_EFI if we decide to make EFI into a menu some day but I don't have a strong preference.
Just move it when applying.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Borislav Petkov
maintainerPATCH 3/5 x86, pageattr: Export page unmapping interface
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
We will use it in efi so expose it.
--- arch/x86/include/asm/pgtable_types.h | 2 ++ arch/x86/mm/pageattr.c | 44 +++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 13 deletions(-)
arch/x86/include/asm/pgtable_types.h +2 -0
@@ -384,6 +384,8 @@ extern pte_t *lookup_address(unsigned long address, unsigned int *level);extern phys_addr_t slow_virt_to_phys (void *__address);extern int kernel_map_pages_in_pgd (pgd_t *pgd,u64 pfn,unsigned long address,unsigned numpages,unsigned long page_flags); +void kernel_unmap_pages_in_pgd (pgd_t *root,unsigned long address, +unsigned numpages);#endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_PGTABLE_DEFS_H */
arch/x86/mm/pageattr.c +31 -13
84 lines not on this page · raw message
Signature · 1 line
1.8.5.2.192.g7794a68
Borislav Petkov
maintainerPATCH 4/5 efi: Make efi virtual runtime map passing more robust
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Currently, running SetVirtualAddressMap() and passing the physical address of the virtual map array was working only by a lucky coincidence because the memory was present in the EFI page table too. Until Toshi went and booted this on a big HP box - the krealloc() manner of resizing the memmap we're doing did allocate from such physical addresses which were not mapped anymore and boom:
http://lkml.kernel.org/r/[email protected]
One way to take care of that issue is to reimplement the krealloc thing but with pages. We start with contiguous pages of order 1, i.e. 2 pages, and when we deplete that memory (shouldn't happen all that often but you know firmware) we realloc the next power-of-two pages.
Having the pages, it is much more handy and easy to map them into the EFI page table with the already existing mapping code which we're using for building the virtual mappings.
Thanks to Toshi Kani and Matt for the great debugging help.
--- arch/x86/include/asm/efi.h | 3 +- arch/x86/platform/efi/efi.c | 99 +++++++++++++++++++++++++++++++++--------- arch/x86/platform/efi/efi_32.c | 6 ++- arch/x86/platform/efi/efi_64.c | 32 ++++++++++++-- 4 files changed, 114 insertions(+), 26 deletions(-)
arch/x86/include/asm/efi.h +2 -1
@@ -130,7 +130,8 @@ extern void efi_memory_uc(u64 addr, unsigned long size);extern void __init efi_map_region (efi_memory_desc_t *md);extern void __init efi_map_region_fixed (efi_memory_desc_t *md);extern void efi_sync_low_kernel_mappings (void ); -extern void efi_setup_page_tables (void ); +extern int efi_setup_page_tables (unsigned long pa_memmap,unsigned num_pages); +extern void efi_cleanup_page_tables (unsigned long pa_memmap,unsigned num_pages);extern void __init old_map_region (efi_memory_desc_t *md);extern void __init efi_dump_pagetable (void );
arch/x86/platform/efi/efi.c +78 -21
148 lines not on this page · raw message
arch/x86/platform/efi/efi_32.c +5 -1
@@ -40,8 +40,12 @@static unsigned long efi_rt_eflags;void efi_sync_low_kernel_mappings (void ) {} -void efi_setup_page_tables (void ) {}void __init efi_dump_pagetable (void ) {} +int efi_setup_page_tables (unsigned long pa_memmap,unsigned num_pages) +{ +return 0 ; +} +void efi_cleanup_page_tables (unsigned long pa_memmap,unsigned num_pages) {}void __init efi_map_region (efi_memory_desc_t *md) {
arch/x86/platform/efi/efi_64.c +29 -3
@@ -137,12 +137,38 @@ void efi_sync_low_kernel_mappings(void) sizeof(pgd_t) * num_pgds); } -void efi_setup_page_tables (void ) +int efi_setup_page_tables (unsigned long pa_memmap,unsigned num_pages) { +pgd_t *pgd; + +if (efi_enabled (EFI_OLD_MEMMAP )) +return 0 ; + efi_scratch.efi_pgt = (pgd_t *)(unsigned long )real_mode_header->trampoline_pgd; + pgd =__va (efi_scratch.efi_pgt); -if (!efi_enabled (EFI_OLD_MEMMAP )) - efi_scratch.use_pgd = true; +/* +* It can happen that the physical address of new_memmap lands in memory +* which is not mapped in the EFI page table. Therefore we need to go +* and ident-map those pages containing the map before calling +* phys_efi_set_virtual_address_map(). +*/ +if (kernel_map_pages_in_pgd (pgd, pa_memmap, pa_memmap, num_pages, _PAGE_NX)) { +pr_err ("Error ident-mapping new memmap (0x%lx)!\n" , pa_memmap); +return 1 ; + } + + efi_scratch.use_pgd = true; + + +return 0 ; +} + +void efi_cleanup_page_tables (unsigned long pa_memmap,unsigned num_pages) +{ +pgd_t *pgd = (pgd_t *)__va (real_mode_header->trampoline_pgd); + +kernel_unmap_pages_in_pgd (pgd, pa_memmap, num_pages); }static void __init __map_region (efi_memory_desc_t *md,u64 va)
Signature · 1 line
1.8.5.2.192.g7794a68
Borislav Petkov
maintainerPATCH 5/5 efi: Split efi_enter_virtual_mode
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
... into a kexec flavor for better code readability and simplicity. The original one was getting ugly with ifdeffery.
--- arch/x86/platform/efi/efi.c | 148 +++++++++++++++++++++++++++++--------------- include/linux/efi.h | 1 + 2 files changed, 99 insertions(+), 50 deletions(-)
arch/x86/platform/efi/efi.c +98 -50
@@ -891,8 +891,9 @@ static void __init get_systab_virt_addr(efi_memory_desc_t *md) } } -static int __init save_runtime_map (void ) +static void __init save_runtime_map (void ) { +#ifdef CONFIG_KEXEC efi_memory_desc_t *md;void *tmp, *p, *q =NULL ;int count =0 ;
@@ -914,28 +915,12 @@ static int __init save_runtime_map(void) }efi_runtime_map_setup (q, count, memmap.desc_size); +return ; -return 0 ; out:kfree (q); -return -ENOMEM ; -} - -/* -* Map efi regions which were passed via setup_data. The virt_addr is a fixed -* addr which was used in first kernel of a kexec boot. -*/ -static void __init efi_map_regions_fixed (void ) -{ -void *p; -efi_memory_desc_t *md; - -for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { - md = p; -efi_map_region_fixed (md);/* FIXME: add error handling */ -get_systab_virt_addr (md); - } - +pr_err ("Error saving runtime map, efi runtime on kexec non-functional!!\n" ); +#endif }static void *realloc_pages (void *old_memmap,int old_shift)
@@ -1001,6 +986,72 @@ static void * __init efi_map_regions(int *count, int *pg_shift)return new_memmap; } +void __init kexec_enter_virtual_mode (void ) +{ +#ifdef CONFIG_KEXEC +efi_memory_desc_t *md; +void *p; + + efi.systab =NULL ; + +/* +* We don't do virtual mode, since we don't do runtime services, on +* non-native EFI +*/ +if (!efi_is_native ()) { +efi_unmap_memmap (); +return ; + } + +/* +* Map efi regions which were passed via setup_data. The virt_addr is a +* fixed addr which was used in first kernel of a kexec boot. +*/ +for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { + md = p; +efi_map_region_fixed (md);/* FIXME: add error handling */ +get_systab_virt_addr (md); + } + +save_runtime_map (); + +BUG_ON (!efi.systab); + +efi_sync_low_kernel_mappings (); + +/* +* Now that EFI is in virtual mode, update the function +* pointers in the runtime service table to the new virtual addresses. +* +* Call EFI services through wrapper functions. +*/ + efi.runtime_version = efi_systab.hdr.revision; + efi.get_time = virt_efi_get_time; + efi.set_time = virt_efi_set_time; + efi.get_wakeup_time = virt_efi_get_wakeup_time; + efi.set_wakeup_time = virt_efi_set_wakeup_time; + efi.get_variable = virt_efi_get_variable; + efi.get_next_variable = virt_efi_get_next_variable; + efi.set_variable = virt_efi_set_variable; + efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count; + efi.reset_system = virt_efi_reset_system; + efi.set_virtual_address_map =NULL ; + efi.query_variable_info = virt_efi_query_variable_info; + efi.update_capsule = virt_efi_update_capsule; + efi.query_capsule_caps = virt_efi_query_capsule_caps; + +if (efi_enabled (EFI_OLD_MEMMAP ) && (__supported_pte_mask & _PAGE_NX)) +runtime_code_page_mkexec (); + +/* clean DUMMY object */ + efi.set_variable (efi_dummy_name, &EFI_DUMMY_GUID , +EFI_VARIABLE_NON_VOLATILE | +EFI_VARIABLE_BOOTSERVICE_ACCESS | +EFI_VARIABLE_RUNTIME_ACCESS , +0 ,NULL ); +#endif +} +/* * This function will switch the EFI runtime services to virtual mode. * Essentially, we look through the EFI memmap and map every region that
@@ -1020,11 +1071,12 @@ static void * __init efi_map_regions(int *count, int *pg_shift)* * Specially for kexec boot, efi runtime maps in previous kernel should * be passed in via setup_data. In that case runtime ranges will be mapped -* to the same virtual addresses as the first kernel. +* to the same virtual addresses as the first kernel, see +* kexec_enter_virtual_mode(). */ -void __init efi_enter_virtual_mode (void ) +static void __init __efi_enter_virtual_mode (void ) { -int err, count =0 , pg_shift =0 ; +int count =0 , pg_shift =0 ;void *new_memmap =NULL ;efi_status_t status;
@@ -1039,43 +1091,33 @@ void __init efi_enter_virtual_mode(void)return ; } -if (efi_setup) { -efi_map_regions_fixed (); - }else { -efi_merge_regions (); - new_memmap =efi_map_regions (&count, &pg_shift); -if (!new_memmap) { -pr_err ("Error reallocating memory, EFI runtime non-functional!\n" ); -return ; - } - - err =save_runtime_map (); -if (err) -pr_err ("Error saving runtime map, efi runtime on kexec non-functional!!\n" ); +efi_merge_regions (); + new_memmap =efi_map_regions (&count, &pg_shift); +if (!new_memmap) { +pr_err ("Error reallocating memory, EFI runtime non-functional!\n" ); +return ; } +save_runtime_map (); +BUG_ON (!efi.systab); -if (!efi_setup) { -if (efi_setup_page_tables (__pa (new_memmap),1 << pg_shift)) -return ; - } +if (efi_setup_page_tables (__pa (new_memmap),1 << pg_shift)) +return ;efi_sync_low_kernel_mappings ();efi_dump_pagetable (); -if (!efi_setup) { - status =phys_efi_set_virtual_address_map ( + status =phys_efi_set_virtual_address_map ( memmap.desc_size * count, memmap.desc_size, memmap.desc_version, (efi_memory_desc_t *)__pa (new_memmap)); -if (status !=EFI_SUCCESS ) { -pr_alert ("Unable to switch EFI into virtual mode (status=%lx)!\n" , - status); -panic ("EFI call to SetVirtualAddressMap() failed!" ); - } +if (status !=EFI_SUCCESS ) { +pr_alert ("Unable to switch EFI into virtual mode (status=%lx)!\n" , + status); +panic ("EFI call to SetVirtualAddressMap() failed!" ); }/*
@@ -1102,7 +1144,6 @@ void __init efi_enter_virtual_mode(void)if (efi_enabled (EFI_OLD_MEMMAP ) && (__supported_pte_mask & _PAGE_NX))runtime_code_page_mkexec (); -/* * We mapped the descriptor array into the EFI pagetable above but we're * not unmapping it here. Here's why:
@@ -1129,8 +1170,7 @@ void __init efi_enter_virtual_mode(void)* * efi_cleanup_page_tables(__pa(new_memmap), 1 << pg_shift); */ -if (!efi_setup) -free_pages ((unsigned long )new_memmap, pg_shift); +free_pages ((unsigned long )new_memmap, pg_shift);/* clean DUMMY object */ efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
@@ -1140,6 +1180,14 @@ void __init efi_enter_virtual_mode(void) 0, NULL); } +void __init efi_enter_virtual_mode (void ) +{ +if (efi_setup) +kexec_enter_virtual_mode (); +else +__efi_enter_virtual_mode (); +} +/* * Convenience functions to obtain memory types and attributes */
include/linux/efi.h +1 -0
@@ -594,6 +594,7 @@ extern void efi_map_pal_code (void);extern void efi_memmap_walk (efi_freemem_callback_t callback,void *arg);extern void efi_gettimeofday (struct timespec *ts);extern void efi_enter_virtual_mode (void );/* switch EFI to virtual mode, if possible */ +extern void kexec_enter_virtual_mode (void );#ifdef CONFIG_X86 extern void efi_late_init (void );extern void efi_free_boot_services (void );
Signature · 1 line
1.8.5.2.192.g7794a68
Re: [PATCH 5/5] efi: Split efi_enter_virtual_mode
Quoted 11 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
... into a kexec flavor for better code readability and simplicity. The original one was getting ugly with ifdeffery.
Signed-off-by Borislav Petkov <[email protected]>Tested-by Toshi Kani <[email protected]>--- arch/x86/platform/efi/efi.c | 148 +++++++++++++++++++++++++++++--------------- include/linux/efi.h | 1 + 2 files changed, 99 insertions(+), 50 deletions(-)
[...]
arch/x86/platform/efi/efi.c static void * __init efi_map_regions(int *count, int *pg_shift) · line 990
Quoted 6 lines
arch/x86/platform/efi/efi.c +2
-0@@ -1001,6 +986,72 @@ static void * __init efi_map_regions(int *count, int *pg_shift)return new_memmap; } +void __init kexec_enter_virtual_mode (void ) +{
Could this be static for now?
include/linux/efi.h extern void efi_map_pal_code (void); · line 600
Quoted 12 lines
include/linux/efi.h +1
-0@@ -594,6 +594,7 @@ extern void efi_map_pal_code (void);extern void efi_memmap_walk (efi_freemem_callback_t callback,void *arg);extern void efi_gettimeofday (struct timespec *ts);extern void efi_enter_virtual_mode (void );/* switch EFI to virtual mode, if possible */ +extern void kexec_enter_virtual_mode (void );#ifdef CONFIG_X86 extern void efi_late_init (void );extern void efi_free_boot_services (void );
Which would allow us to drop this change.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Borislav Petkov
maintainerRe: [PATCH 5/5] efi: Split efi_enter_virtual_mode
Quoted 4 lines · Matt Fleming
arch/x86/platform/efi/efi.c static void * __init efi_map_regions(int *count, int *pg_shift) · line 990
Quoted 2 lines
arch/x86/platform/efi/efi.c +2
-0+void __init kexec_enter_virtual_mode (void ) +{Could this be static for now?
Didn't you wanna do arch/x86/platform/efi/kexec.c anyway?
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [PATCH 5/5] efi: Split efi_enter_virtual_mode
Quoted 7 lines · Borislav Petkov
Quoted 4 lines · Matt Fleming
arch/x86/platform/efi/efi.c static void * __init efi_map_regions(int *count, int *pg_shift) · line 990
Quoted 2 lines
arch/x86/platform/efi/efi.c +2
-0+void __init kexec_enter_virtual_mode (void ) +{Could this be static for now?
Didn't you wanna do
arch/x86/platform/efi/kexec.canyway?
Yes, but the patches are easier to review if we make kexec_enter_virtual_mode() global when moving it into a new file.
Plus it makes this patch that little bit smaller because the modification to efi.h is unnecessary.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 17 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Hi all,
this is the latest incarnation which should hopefully work just fine. It tpasses esting at least on all our boxes so we have *some* coverage.
It took us a long time to debug the unmapping path and realize how exactly we're doing the PGD sharing between the kernel and the EFI page table. I've commented on this verbosely in 4/5 for future reference because this stuff is not trivial.
We definitely should have this in mind when we do more changes on how we handle the EFI page table and what we do with it, maybe even decouple it completely from the kernel one. I dunno - it is all future stuff to pay attention to.
Quoted 4 lines
Anyway, if anyone with an EFI box wants to give it a run, feel free to do so.
As always, all comments and suggestions are appreciated.
Thanks Borislav. I picked these up and applied them to my 'next' branch.
You'll notice that I haven't stuck them in my 'urgent' branch, so these won't be sent to Linus before v3.15 despite the fact that they're bug fixes. I think Toshi's box is special enough that most people shouldn't hit this issue, and since these patches involve rewriting the way we do SetVirtualAddressMap() I'm happy for people to hammer on the stuff that did make it into the merge window without this added complication.
Having said that, if people think it's worth the effort I don't mind setting up a new branch containing this series that can be sent to Linus much sooner.
Thoughts?
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 32 lines · Matt Fleming
Quoted 17 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Hi all,
this is the latest incarnation which should hopefully work just fine. It tpasses esting at least on all our boxes so we have *some* coverage.
It took us a long time to debug the unmapping path and realize how exactly we're doing the PGD sharing between the kernel and the EFI page table. I've commented on this verbosely in 4/5 for future reference because this stuff is not trivial.
We definitely should have this in mind when we do more changes on how we handle the EFI page table and what we do with it, maybe even decouple it completely from the kernel one. I dunno - it is all future stuff to pay attention to.
Quoted 4 lines
Anyway, if anyone with an EFI box wants to give it a run, feel free to do so.
As always, all comments and suggestions are appreciated.
Thanks Borislav. I picked these up and applied them to my 'next' branch.
You'll notice that I haven't stuck them in my 'urgent' branch, so these won't be sent to Linus before v3.15 despite the fact that they're bug fixes. I think Toshi's box is special enough that most people shouldn't hit this issue, and since these patches involve rewriting the way we do
SetVirtualAddressMap()I'm happy for people to hammer on the stuff that did make it into the merge window without this added complication.
Quoted 3 lines
Having said that, if people think it's worth the effort I don't mind setting up a new branch containing this series that can be sent to Linus much sooner.
Since this issue is quite serious on our systems (3.14 kernels won't boot up), I'd really appreciate if the fixes can be made into some 3.14-rc. It can hit on any EFI systems with large memory.
Thanks,
-Toshi
Borislav Petkov
maintainerQuoted 3 lines · Toshi Kani
Since this issue is quite serious on our systems (3.14 kernels won't boot up), I'd really appreciate if the fixes can be made into some 3.14-rc. It can hit on any EFI systems with large memory.
That's why we have "efi=old_map" - so that you can use the old mapping method which is a chicken bit for the new scheme.
And I told you privately already that you're better off merging Matt's 'next' branch than us exposing this to the world too early. So stop pushing this when there are clearly other solutions for your case and be patient!
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Quoted 7 lines · Borislav Petkov
Quoted 3 lines · Toshi Kani
Since this issue is quite serious on our systems (3.14 kernels won't boot up), I'd really appreciate if the fixes can be made into some 3.14-rc. It can hit on any EFI systems with large memory.
That's why we have "efi=old_map" - so that you can use the old mapping method which is a chicken bit for the new scheme.
Good point. Yes, that will help us a lot.
Quoted 4 lines
And I told you privately already that you're better off merging Matt's 'next' branch than us exposing this to the world too early. So stop pushing this when there are clearly other solutions for your case and be patient!
Right, but I just responded to Matt's query. :-)
Thanks,
-Toshi