Revert "efi_memory: do not add U-Boot memory to the memory map"
PATCH 1/1 Revert "efi_memory: do not add U-Boot memory to the memory map"
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
I will sent a series with a script showing how it is run.
This reverts commit a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.
---
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
lib/efi_loader/efi_memory.c +10 -0
@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/*
Signature · 1 line
2.34.1
Hi Simon,
Quoted 6 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Any idea if this is before or after ExitBootServices? The console prints some efi-stub calls before it jumps into the kernel. Unfortunately, those aren't preserved in a dmesg
Quoted 3 lines
I will sent a series with a script showing how it is run.
How can I reproduce this? Run the installer on QEMU on top of U-Boot? Is U-Boot compiled as an EFI app or not?
Quoted 1 line
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.
In theory, the memory map should already be added by LMB. So instead of reverting this, it would make more sense to compare the memory map with/without the patch and see if something is missing from LMB
Thanks
/Ilias
Quoted 31 lines
Signed-off-by Simon Glass <[email protected]>---
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
This seems to be an issue specific to the x86 architecture. The installation works on arm64 and riscv (confirmed by Heinrich) architectures. I checked the output of the EFI memory map with the above commit against the master branch, and the only difference is that with this revert, the EFI memory map has the u-boot memory region marked as EFI_BOOT_SERVICES_CODE, whereas without this commit, that region is marked as reserved. I need to look into this in more detail, but it would seem like the x86 kernel (or some efi stub code ?) is expecting some region of memory marked as EFI_BOOT_SERVICES_CODE, which is not the case for other architectures.
-sughosh
Quoted 28 lines
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Hi Sughosh
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 7 lines
This seems to be an issue specific to the x86 architecture. The installation works on arm64 and riscv (confirmed by Heinrich) architectures. I checked the output of the EFI memory map with the above commit against the master branch, and the only difference is that with this revert, the EFI memory map has the u-boot memory region marked as
EFI_BOOT_SERVICES_CODE, whereas without this commit, that region is marked as reserved.
Hmm why? LMB is adding this with EFI_BOOT_SERVICES_CODE in lmb_map_update_notify(). Who's switching it to reserved? This is a pretty big change since the memory switches from reusable to reserved for the OS.
Quoted 4 lines
I need to look into this in more detail,
but it would seem like the x86 kernel (or some efi stub code ?) is expecting some region of memory marked asEFI_BOOT_SERVICES_CODE, which is not the case for other architectures.
Not EFI_BOOT_SERVICES_CODE explicitly, probably just a reusable type of memory.
Cheers
/Ilias
Quoted 31 lines
-sughosh
Quoted 28 lines
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Quoted 11 lines · Ilias Apalodimas
Hi Sughosh
Quoted 8 lines · Sughosh Ganu
Quoted 6 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
I tried to replicate the problem with an Ubuntu 24.04.1 cloud image using a 6.8 kernel.
I see efi_exit_boot_services being reached but not efi_set_virtual_address_map. The kernel seems to be stuck in an endless loop in a virtual address range (0xffffffff????????).
The memory map looks wrong:
=> efidebug memmap
Type Start End Attributes
================ ================ ================ ==========
CONVENTIONAL 0000000000000000-00000000000a0000 WB
RESERVED 00000000000a0000-00000000000f0000 WB
ACPI RECLAIM MEM 00000000000f0000-00000000000f1000 WB
RESERVED 00000000000f1000-0000000000100000 WB CONVENTIONAL 0000000000100000-000000003dca4000 WB BOOT DATA 000000003dca4000-000000003dca6000 WB RUNTIME DATA 000000003dca6000-000000003dca7000 WB|RT BOOT DATA 000000003dca7000-000000003dca8000 WB RUNTIME DATA 000000003dca8000-000000003dcca000 WB|RT BOOT DATA 000000003dcca000-000000003ecda000 WB RESERVED 000000003ecda000-000000003ece0000 WB ACPI RECLAIM MEM 000000003ece0000-000000003ed02000 WB RUNTIME DATA 000000003ed02000-000000003ed03000 WB|RT RESERVED 000000003ed03000-000000003ef1a000 WB RUNTIME CODE 000000003ef1a000-000000003ef1c000 WB|RT RESERVED 000000003ef1c000-0000000040000000 WB RESERVED 00000000e0000000-00000000f0000000 WB
The relocated U-Boot code should not be marked as EfiReservedMemoryType but as EfiServicesCode according to the UEFI specification.
The ACPI table is marked as EfiACPIReclaimMemory but I don't think memory in the BIOS memory range should be reclaimable. In the journal on my laptop I see
BIOS-provided physical RAM map
BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
The e820 table is generated from the EFI memory map in setup_e820() of the Linux efi stub.
Best regards
Heinrich
Quoted 64 lines
Quoted 8 lines
Quoted 7 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 7 lines
This seems to be an issue specific to the x86 architecture. The installation works on arm64 and riscv (confirmed by Heinrich) architectures. I checked the output of the EFI memory map with the above commit against the master branch, and the only difference is that with this revert, the EFI memory map has the u-boot memory region marked as
EFI_BOOT_SERVICES_CODE, whereas without this commit, that region is marked as reserved.Hmm why? LMB is adding this with
EFI_BOOT_SERVICES_CODEinlmb_map_update_notify(). Who's switching it to reserved? This is a pretty big change since the memory switches from reusable to reserved for the OS.Quoted 4 lines
I need to look into this in more detail,
but it would seem like the x86 kernel (or some efi stub code ?) is expecting some region of memory marked asEFI_BOOT_SERVICES_CODE, which is not the case for other architectures.Not
EFI_BOOT_SERVICES_CODEexplicitly, probably just a reusable type of memory.Cheers
/IliasQuoted 31 lines
-sughosh
Quoted 28 lines
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Quoted 14 lines · Heinrich Schuchardt
Quoted 11 lines · Ilias Apalodimas
Hi Sughosh
Quoted 8 lines · Sughosh Ganu
Quoted 6 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I tried to replicate the problem with an Ubuntu 24.04.1 cloud image using a 6.8 kernel.
I see
efi_exit_boot_servicesbeing reached but notefi_set_virtual_address_map. The kernel seems to be stuck in an endless loop in a virtual address range (0xffffffff????????).
There are two issues to consider here. As Ilias had pointed out, I looked at why the U-Boot memory region was showing up as Reserved. And turns out that the e820 platform code defines efi_add_known_memory(), and this function seems to be overwriting memory regions' attribute with what gets set by the lmb code. So it turns out that the lmb code is setting the U-Boot memory region as EFI_BOOT_SERVICES_CODE indeed. But the install_e820_map() function in arch/x86/cpu/qemu/e820.c is setting the memory region occupied by U-Boot as reserved. This was getting masked earlier, as the add_u_boot_and_runtime() would set the U-Boot memory region with correct attributes. I think the correct fix would be to not mark the U-Boot memory regions as reserved by the e820 platform code.
In addition to the above, the x86 architecture specific efi stub code seems to require a region of memory with EfiBootServicesCode memory. But looking at the EFI spec, I do not see where this is mandated -- the spec only seems to mention that after the ExitBootServices() call, the EFI OS loader can treat EfiBootServices{Code,Data} as available free memory. Agreed that it would be better to mark the region of memory occupied by the firmware as EfiBootServicesCode, but then that would still not be strictly correct, as the U-Boot region contains code as well as data. So marking the region of memory occupied by U-Boot as EfiBootServicesData should not be an issue, at least based on what I understand. Moreover since this looks like a requirement only for the x86 architecture.
-sughosh
Quoted 106 lines
The memory map looks wrong:
=> efidebug memmap
Type Start End Attributes
================ ================ ================ ==========
CONVENTIONAL 0000000000000000-00000000000a0000 WB
RESERVED 00000000000a0000-00000000000f0000 WB
ACPI RECLAIM MEM 00000000000f0000-00000000000f1000 WBRESERVED 00000000000f1000-0000000000100000 WB CONVENTIONAL 0000000000100000-000000003dca4000 WB BOOT DATA 000000003dca4000-000000003dca6000 WB RUNTIME DATA 000000003dca6000-000000003dca7000 WB|RT BOOT DATA 000000003dca7000-000000003dca8000 WB RUNTIME DATA 000000003dca8000-000000003dcca000 WB|RT BOOT DATA 000000003dcca000-000000003ecda000 WB RESERVED 000000003ecda000-000000003ece0000 WB ACPI RECLAIM MEM 000000003ece0000-000000003ed02000 WB RUNTIME DATA 000000003ed02000-000000003ed03000 WB|RT RESERVED 000000003ed03000-000000003ef1a000 WB RUNTIME CODE 000000003ef1a000-000000003ef1c000 WB|RT RESERVED 000000003ef1c000-0000000040000000 WB RESERVED 00000000e0000000-00000000f0000000 WBThe relocated U-Boot code should not be marked as EfiReservedMemoryType but as EfiServicesCode according to the UEFI specification.
The ACPI table is marked as EfiACPIReclaimMemory but I don't think memory in the BIOS memory range should be reclaimable. In the journal on my laptop I see
BIOS-provided physical RAM map
BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reservedThe e820 table is generated from the EFI memory map in
setup_e820()of the Linux efi stub.Best regards
Heinrich
Quoted 64 lines
Quoted 8 lines
Quoted 7 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 7 lines
This seems to be an issue specific to the x86 architecture. The installation works on arm64 and riscv (confirmed by Heinrich) architectures. I checked the output of the EFI memory map with the above commit against the master branch, and the only difference is that with this revert, the EFI memory map has the u-boot memory region marked as
EFI_BOOT_SERVICES_CODE, whereas without this commit, that region is marked as reserved.Hmm why? LMB is adding this with
EFI_BOOT_SERVICES_CODEinlmb_map_update_notify(). Who's switching it to reserved? This is a pretty big change since the memory switches from reusable to reserved for the OS.Quoted 4 lines
I need to look into this in more detail,
but it would seem like the x86 kernel (or some efi stub code ?) is expecting some region of memory marked asEFI_BOOT_SERVICES_CODE, which is not the case for other architectures.Not
EFI_BOOT_SERVICES_CODEexplicitly, probably just a reusable type of memory.Cheers
/IliasQuoted 31 lines
-sughosh
Quoted 28 lines
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Quoted 11 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>
You forgot to prefix this with "RFC" or "DEBUG" as we're not going to revert these changes, but we'll figure out why x86 doesn't behave like arm and riscv do and then Fixes the resulting commit. Thanks.
Signature · 1 line
Tom
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling the SetVirtualAddressMap() runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling the ConvertPointer() and SetVirtualAddressMap() runtime functions.
-sughosh
Quoted 28 lines
lib/efi_loader/efi_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+)lib/efi_loader/efi_memory.c +10
-1@@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void) {unsigned long runtime_start, runtime_end, runtime_pages;unsigned long runtime_mask =EFI_PAGE_MASK ; +unsigned long uboot_start, uboot_pages; +unsigned long uboot_stack_size =CONFIG_STACK_SIZE ; + +/* Add U-Boot */ + uboot_start = ((uintptr_t )map_sysmem (gd->start_addr_sp,0 ) - + uboot_stack_size) & ~EFI_PAGE_MASK ; + uboot_pages = ((uintptr_t )map_sysmem (gd->ram_top -1 ,0 ) - + uboot_start +EFI_PAGE_MASK ) >>EFI_PAGE_SHIFT ; +efi_add_memory_map_pg (uboot_start, uboot_pages,EFI_BOOT_SERVICES_CODE , + false);#if defined(__aarch64__)/* -- 2.34.1
Hi Sughosh,
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 11 lines
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as
EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling theSetVirtualAddressMap()runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling theConvertPointer()andSetVirtualAddressMap()runtime functions.
OK, so what is the solution here? Did you send a patch?
Regards,
Simon
Quoted 32 lines · Simon Glass
Hi Sughosh,
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 11 lines
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as
EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling theSetVirtualAddressMap()runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling theConvertPointer()andSetVirtualAddressMap()runtime functions.
Quoted 1 line
OK, so what is the solution here? Did you send a patch?
I am trying to check if the installation can be done by disabling the ConvertPointer() and SetVirtualAddressMap() runtime service calls. If so, then I will send a patch which disables them temporarily till the actual issue is triaged and fixed. If the installation does not work without these runtime calls, I would say putting this change in with an explanation of what is happening (similar to the above explanation). Please give me some more days, and I will let you know. Thanks.
-sughosh
Quoted 3 lines
Regards,
Simon
Hi Sughosh,
Quoted 36 lines · Sughosh Ganu
Quoted 32 lines · Simon Glass
Hi Sughosh,
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 11 lines
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as
EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling theSetVirtualAddressMap()runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling theConvertPointer()andSetVirtualAddressMap()runtime functions.Quoted 1 line
OK, so what is the solution here? Did you send a patch?
Quoted 8 lines
I am trying to check if the installation can be done by disabling the
ConvertPointer()andSetVirtualAddressMap()runtime service calls. If so, then I will send a patch which disables them temporarily till the actual issue is triaged and fixed. If the installation does not work without these runtime calls, I would say putting this change in with an explanation of what is happening (similar to the above explanation). Please give me some more days, and I will let you know. Thanks.
I forgot what happened with this. Could you update this thread, please?
Thanks,
Simon
Quoted 48 lines · Simon Glass
Hi Sughosh,
Quoted 36 lines · Sughosh Ganu
Quoted 32 lines · Simon Glass
Hi Sughosh,
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 11 lines
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as
EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling theSetVirtualAddressMap()runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling theConvertPointer()andSetVirtualAddressMap()runtime functions.Quoted 1 line
OK, so what is the solution here? Did you send a patch?
Quoted 8 lines
I am trying to check if the installation can be done by disabling the
ConvertPointer()andSetVirtualAddressMap()runtime service calls. If so, then I will send a patch which disables them temporarily till the actual issue is triaged and fixed. If the installation does not work without these runtime calls, I would say putting this change in with an explanation of what is happening (similar to the above explanation). Please give me some more days, and I will let you know. Thanks.
Quoted 1 line
I forgot what happened with this. Could you update this thread, please?
After much further investigation to understand why the revert worked, the revert was applied with a different commit message.
Signature · 1 line
Tom
Hi Tom,
Quoted 50 lines · Tom Rini
Quoted 48 lines · Simon Glass
Hi Sughosh,
Quoted 44 lines · Sughosh Ganu
Quoted 32 lines · Simon Glass
Hi Sughosh,
Quoted 16 lines · Sughosh Ganu
Quoted 7 lines · Simon Glass
A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this patch. I am not sure how to investigate it.
The boot hangs at some point during booting of the install image, before the Ubuntu logo appears.
Quoted 6 lines
I will sent a series with a script showing how it is run.
This reverts commit
a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.Signed-off-by Simon Glass <[email protected]>---
Quoted 11 lines
I did some digging into this issue, and it turns out that the revert is only masking the real issue. What this revert does is mark the memory region occupied by U-Boot as
EFI_BOOT_SERVICES_CODE. The x86 kernel seems to mark memory regions other than EFI_{BOOT,RUNTIME}_SERVICES_CODE as not executable -- and this is precisely why this crash shows up only on x86. The actual cause of this issue is in the efi runtime functionality of U-Boot. The kernel is calling theSetVirtualAddressMap()runtime service function, and that seems to be calling some of the boot service code of U-Boot, which it shouldn't. We do not get the crash after disabling theConvertPointer()andSetVirtualAddressMap()runtime functions.Quoted 1 line
OK, so what is the solution here? Did you send a patch?
I am trying to check if the installation can be done by disabling the
ConvertPointer()andSetVirtualAddressMap()runtime service calls. If so, then I will send a patch which disables them temporarily till the actual issue is triaged and fixed. If the installation does not work without these runtime calls, I would say putting this change in with an explanation of what is happening (similar to the above explanation). Please give me some more days, and I will let you know. Thanks.
Quoted 4 lines
Quoted 1 line
I forgot what happened with this. Could you update this thread, please?
After much further investigation to understand why the revert worked, the revert was applied with a different commit message.
OK, thanks.
I have found another problem in that it breaks sandbox (bootflow_efi test) when it calls exit-boot-services. But you have not applied that series[1] so we can wait to see if you hit that problem in general usage. Hopefully not!
Regards,
Simon
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=439021