]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
UBUNTU: SAUCE: efi: efi_get_memory_map -- increase map headroom
authorAndy Whitcroft <apw@canonical.com>
Fri, 8 Nov 2019 10:25:46 +0000 (10:25 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Thu, 9 Mar 2023 14:57:19 +0000 (15:57 +0100)
We are seeing some EFI based machines failing to boot hard in the EFI
stub:

    exit_boot() failed!
    efi_main() failed!

This seems to occur when the bootloader (grub2 in this case) has had
to manipulate some additional files due to a change in the way MAAS
boots the machines.  We tracked this down to the memory map dance
efi_get_memory_map().  Basically we attempt to close boot services and
it informs us it cannot do so because it failed to record the updated
memory map.  This occurs when there is insufficient space in the passed
memory map buffer to record changes during the operation.  At the point
when this occurs we are unable to call the allocation functions to
reallocate the buffer so we panic.

To avoid this we allocate some additional entries in the buffer to cover
any additional entries.  This headroom is currently insufficient for
these machines under this use case.  Increase EFI_MMAP_NR_SLACK_SLOTS to
provide space for more memory map modifications.

BugLink: https://bugs.launchpad.net/bugs/1851810
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/firmware/efi/libstub/efistub.h

index 5b8f2c411ed82be5ee89ffcce09937683ecac956..2dbed114238890381d30a23d68523fe80acfa828 100644 (file)
@@ -170,7 +170,7 @@ void efi_set_u64_split(u64 data, u32 *lo, u32 *hi)
  * the EFI memory map. Other related structures, e.g. x86 e820ext, need
  * to factor in this headroom requirement as well.
  */
-#define EFI_MMAP_NR_SLACK_SLOTS        8
+#define EFI_MMAP_NR_SLACK_SLOTS        16
 
 typedef struct efi_generic_dev_path efi_device_path_protocol_t;