Skip to content

Commit eff8962

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/arm: Defer persistent reservations until after paging_init()
The new memory EFI reservation feature we introduced to allow memory reservations to persist across kexec may trigger an unbounded number of calls to memblock_reserve(). The memblock subsystem can deal with this fine, but not before memblock resizing is enabled, which we can only do after paging_init(), when the memory we reallocate the array into is actually mapped. So break out the memreserve table processing into a separate routine and call it after paging_init() on arm64. On ARM, because of limited reviewing bandwidth of the maintainer, we cannot currently fix this, so instead, disable the EFI persistent memreserve entirely on ARM so we can fix it later. Tested-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20181114175544.12860-5-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 72a58a6 commit eff8962

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

arch/arm64/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ void __init setup_arch(char **cmdline_p)
313313
arm64_memblock_init();
314314

315315
paging_init();
316+
efi_apply_persistent_mem_reservations();
316317

317318
acpi_table_upgrade();
318319

drivers/firmware/efi/efi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,11 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
592592

593593
early_memunmap(tbl, sizeof(*tbl));
594594
}
595+
return 0;
596+
}
595597

598+
int __init efi_apply_persistent_mem_reservations(void)
599+
{
596600
if (efi.mem_reserve != EFI_INVALID_TABLE_ADDR) {
597601
unsigned long prsv = efi.mem_reserve;
598602

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg)
7575
efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID;
7676
efi_status_t status;
7777

78+
if (IS_ENABLED(CONFIG_ARM))
79+
return;
80+
7881
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
7982
(void **)&rsv);
8083
if (status != EFI_SUCCESS) {

include/linux/efi.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,8 @@ static inline bool efi_enabled(int feature)
11671167
extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
11681168

11691169
extern bool efi_is_table_address(unsigned long phys_addr);
1170+
1171+
extern int efi_apply_persistent_mem_reservations(void);
11701172
#else
11711173
static inline bool efi_enabled(int feature)
11721174
{
@@ -1185,6 +1187,11 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
11851187
{
11861188
return false;
11871189
}
1190+
1191+
static inline int efi_apply_persistent_mem_reservations(void)
1192+
{
1193+
return 0;
1194+
}
11881195
#endif
11891196

11901197
extern int efi_status_to_err(efi_status_t status);

0 commit comments

Comments
 (0)