[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARM EFI: should bootinfo memory banks be reset before retrying ExitBootServices ?


  • To: Pierre Gondois <pierre.gondois@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Julian Vetter <julian@xxxxxxxxxxxxxxxx>
  • Date: Tue, 24 Nov 2026 15:02:51 +0100
  • Arc-authentication-results: i=1; strato.com; arc=none; dkim=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1795528971; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=rK5kfjNFTMBhewZ2Z6PYZ/HR7jF5Lg7srSe2C6WvWcE=; b=rLIsgIMvkCA6k5/tGVezAvKSvYthM0dngPI79VfeBUlQ/nmr9JlhyX5JNPgGh0kHm/ GrLuRIFV3X4VCN/IFT/14BpUWOiMNmw61BpnlNToVZdnFf+EK+bmaCDCGSwDeJDLvo5P X80IHusxSkKlqOkFOT40X3AbfTcsgz7Ezrw5cJZofYflvGfOtpZh7tmMB7cSOxKQ20XO myZhLV5F2oG75MN8J26oOcRGPxXkTIsN8GGfPZgzuYXG99TTUi0/8w09CJbmhEtivROP zS2L48yUOmBNUqZEZLzQ5LPvA5b2u5WQqz+TmmxHlUwl0ZU/tBdOv6wpJMWYPoYkrt4d 2iLQ==
  • Arc-seal: i=1; a=rsa-sha256; t=1795528971; cv=none; d=strato.com; s=strato-dkim-0002; b=Oz3N7EWJm3kQNwAjNRfs1OGIzImvpM1H9oz8IGPTcJDp0GMlbZzJj9a5gk6EzIt5zc p7TLNLlWvvJqBkvUIK8W4/6xWYgVNyQBHj16VPoHwPYbfQiSi2vimDipJYPDi2LLUZJz AKGnu1thEpigitCJJQd1kPv5QwHFvECR4YTYiBMxf2rhN+hb9p5P3pmQ9Xr0KvNFklAk FiJ88Fv6kiZT+a0QNq+F4Qu+QPLUj7HOdom/gyHHz/4zzd7MGG7zmtKw7rvN5uYSMLW+ CMpJi5SkiJGrmMeW3Z8/Ely6xNIV88QrPvzVcoNly4v4BjhC87Phexf1ZsMVm4ZDIM0J /84A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=strato-dkim-0002 header.d=outer-limits.org header.i="@outer-limits.org" header.h="In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID"; dkim=permerror header.s=strato-dkim-0003 header.d=outer-limits.org header.i="@outer-limits.org"
  • Autocrypt: addr=julian@xxxxxxxxxxxxxxxx; keydata= xjMEaLvwgxYJKwYBBAHaRw8BAQdA6u9Gv9DAWoEq0Jh+krJQqvgA9crvjYIJ1zL38JLsdOLN J0p1bGlhbiBWZXR0ZXIgPGp1bGlhbkBvdXRlci1saW1pdHMub3JnPsKTBBMWCgA7FiEEKsxf M6APqlFEwlRheMhx4x8L9BsFAmi78IMCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AA CgkQeMhx4x8L9Bv4PAEAirijszkHGYvhggZvlSx20Pumm2rCol4OzlxO5BcFRMQBAP+PvG0d H4/6nomybCtCDS2rHLv8mA1O4Zn/f073zGUJzjgEaLvwgxIKKwYBBAGXVQEFAQEHQNJXxAh6 JmVPz+Tw8W+SQ9nMlNV6KD8l0uLlSV/s1f0BAwEIB8J4BBgWCgAgFiEEKsxfM6APqlFEwlRh eMhx4x8L9BsFAmi78IMCGwwACgkQeMhx4x8L9BvCRQEA6rFFo2ZiAMR6vT5iJvdWQpkqh1NH XmyCC2h0RIqIEJQA/iAKZBD9h6RVoLScco+nlA+mppdkrg5lb2pvJpENMfQJ
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Delivery-date: Tue, 24 Nov 2026 14:03:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11/16/26 17:11, Pierre Gondois wrote:
Hello,

Hello Pierre,
I can reproduce this on QEMU, and the change you suggest fixes it.

My Setup:
- QEMU 11.1.3: -M virt,virtualization=on,acpi=off -cpu cortex-a57 -smp 4 -m 4G
- Firmware: qemu-efi-aarch64 2026.08+ds-3
- Xen: staging 3b65ff9f372fb85 (debug, early printk on PL011), xen.efi started directly from the UEFI shell

Without the change, the first ExitBootServices() call fails, efi_exit_boot() retries, and every RAM bank is added a second time, and Xen hits the BUG in bootmem_region_add():

(XEN) RAM: 0000000040000000 - 000000004668ffff
(XEN) RAM: 0000000040000000 - 000000004668ffff
(XEN) RAM: 0000000046800000 - 000000004688ffff
(XEN) RAM: 0000000046800000 - 000000004688ffff
...
(XEN) Xen BUG at common/page_alloc.c:308
...
(XEN) Xen call trace:
(XEN)    [<00000a00002cb498>] page_alloc.c#bootmem_region_add+0xd8/0xec (PC)
(XEN)    [<00000a00002cb694>] init_boot_pages+0x44/0x1b0 (LR)
(XEN)    [<00000a00002cb694>] init_boot_pages+0x44/0x1b0
(XEN)    [<00000a00002c54f0>] bootinfo.c#dt_unreserved_regions+0x70/0xac
(XEN)    [<00000a00002c5c50>] populate_boot_allocator+0x124/0x1c8
(XEN)    [<00000a00002e2c84>] setup_mm+0x60/0x84
(XEN)    [<00000a00002e337c>] start_xen+0x118/0x988
(XEN) [<00000a00002001a4>] arch/arm/arm64/head.S#primary_switched+0x4/0x24
...

With your change applied, each bank is listed once and Xen boots through to dom0:

...
(XEN) Checking for initrd in /chosen
(XEN) RAM: 0000000040000000 - 000000004668ffff
(XEN) RAM: 0000000046800000 - 000000004688ffff
(XEN) RAM: 0000000046930000 - 0000000047a4ffff
(XEN) RAM: 0000000047ff4000 - 000000013fffffff
(XEN)
(XEN) MODULE[0]: 0000000045b58000 - 0000000045ccafff Xen
(XEN) MODULE[1]: 0000000045cf1000 - 0000000045df3fff Device Tree
(XEN) MODULE[2]: 000000013dd4d000 - 000000013fffdf13 Ramdisk
(XEN) MODULE[3]: 0000000041bf4000 - 0000000043ffffbf Kernel
...

I see in the x86 that the e820_raw.nr_map in efi_arch_process_memory_map() is reset for each loop iteration. On Arm the bank is appended to the previous iteration. So, I guess resetting the banks is the right call?

Pierre, are you planning to send this fix as a patch to the mailinglist? If so, please add my:

Tested-by: Julian Vetter <julian.vetter@xxxxxxxxxx>

Otherwise I'm happy to post the patch with your Suggested-by.

Thank you,
Julian


Regards,

Pierre

[1] https://github.com/tianocore/edk2/pull/12704
[2] https://github.com/tianocore/edk2/pull/13261#issuecomment-6774136145








 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.