public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	edk2-devel-groups-io <devel@edk2.groups.io>,
	"Fu, Siyuan" <siyuan.fu@intel.com>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>,
	"Gao, Zhichao" <zhichao.gao@intel.com>
Subject: Re: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
Date: Thu, 9 Jan 2020 03:08:52 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C3E0CED@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200108234313.28510-2-lersek@redhat.com>

+ Siyuan who originally worked in the HTTP boot functionality.

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Thursday, January 9, 2020 7:43 AM
> To: edk2-devel-groups-io <devel@edk2.groups.io>
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [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=""
> 
> (Manually rewrapped here for keeping PatchCheck.py happy.)
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@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
> 


  reply	other threads:[~2020-01-09  3:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 23:43 [PATCH 0/2] UefiBootManagerLib, HttpDxe: tweaks for large HTTP(S) downloads Laszlo Ersek
2020-01-08 23:43 ` [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure Laszlo Ersek
2020-01-09  3:08   ` Ni, Ray [this message]
2020-01-09 17:24   ` [edk2-devel] " Philippe Mathieu-Daudé
2020-01-13  1:53   ` Siyuan, Fu
2020-01-13 21:05     ` Laszlo Ersek
2020-01-14  6:55   ` Wu, Hao A
2020-01-08 23:43 ` [PATCH 2/2] NetworkPkg/HttpDxe: fix 32-bit truncation in HTTPS download Laszlo Ersek
2020-01-09 13:29   ` [edk2-devel] " Philippe Mathieu-Daudé
2020-01-10  1:01   ` Siyuan, Fu
2020-01-10 10:49     ` Laszlo Ersek
2020-01-10 15:31   ` Maciej Rabeda
2020-01-14 10:59 ` [edk2-devel] [PATCH 0/2] UefiBootManagerLib, HttpDxe: tweaks for large HTTP(S) downloads Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C3E0CED@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox