[edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
Wu, Hao A
hao.a.wu at intel.com
Tue Jan 14 06:55:46 UTC 2020
> -----Original Message-----
> From: devel at edk2.groups.io [mailto:devel at edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Thursday, January 09, 2020 7:43 AM
> To: edk2-devel-groups-io
> Cc: Wu, Hao A; Wang, Jian J; Ni, Ray; Gao, Zhichao
> Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log
> reserved mem allocation failure
>
> The LoadFile protocol can report such a large buffer size that we cannot
> allocate enough reserved pages for. This particularly affects HTTP(S)
> Boot, if the remote file is very large (for example, an ISO image).
>
> While the TianoCore wiki mentions this at
> <https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot#ram-
> disk-image-size>:
>
> > The maximum RAM disk image size depends on how much continuous
> reserved
> > memory block the platform could provide.
>
> it's hard to remember; so log a DEBUG_ERROR message when the allocation
> fails.
>
> This patch produces error messages such as:
>
> > UiApp:BmExpandLoadFile: failed to allocate reserved pages:
> > BufferSize=4501536768
> > LoadFile="PciRoot(0x0)/Pci(0x3,0x0)/MAC(5254001B103E,0x1)/
> > IPv4(0.0.0.0,TCP,DHCP,192.168.124.106,192.168.124.1,255.255.255.0)/
> > Dns(192.168.124.1)/
> > Uri(https://ipv4-server/RHEL-7.7-20190723.1-Server-x86_64-dvd1.iso)"
> > FilePath=""
Acked-by: Hao A Wu <hao.a.wu at intel.com>
Best Regards,
Hao Wu
>
> (Manually rewrapped here for keeping PatchCheck.py happy.)
>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Zhichao Gao <zhichao.gao at intel.com>
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> ---
> MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 31
> ++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 62c5b2dc94ab..540d169ec1a6 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> @@ -1387,6 +1387,37 @@ BmExpandLoadFile (
> //
> FileBuffer = AllocateReservedPages (EFI_SIZE_TO_PAGES (BufferSize));
> if (FileBuffer == NULL) {
> + DEBUG_CODE (
> + EFI_DEVICE_PATH *LoadFilePath;
> + CHAR16 *LoadFileText;
> + CHAR16 *FileText;
> +
> + LoadFilePath = DevicePathFromHandle (LoadFileHandle);
> + if (LoadFilePath == NULL) {
> + LoadFileText = NULL;
> + } else {
> + LoadFileText = ConvertDevicePathToText (LoadFilePath, FALSE, FALSE);
> + }
> + FileText = ConvertDevicePathToText (FilePath, FALSE, FALSE);
> +
> + DEBUG ((
> + DEBUG_ERROR,
> + "%a:%a: failed to allocate reserved pages: "
> + "BufferSize=%Lu LoadFile=\"%s\" FilePath=\"%s\"\n",
> + gEfiCallerBaseName,
> + __FUNCTION__,
> + (UINT64)BufferSize,
> + LoadFileText,
> + FileText
> + ));
> +
> + if (FileText != NULL) {
> + FreePool (FileText);
> + }
> + if (LoadFileText != NULL) {
> + FreePool (LoadFileText);
> + }
> + );
> return NULL;
> }
>
> --
> 2.19.1.3.g30247aa5d201
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#53209): https://edk2.groups.io/g/devel/message/53209
Mute This Topic: https://groups.io/mt/69550077/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list