public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: Hao A Wu <hao.a.wu@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>, Ray Ni <ray.ni@intel.com>,
	Zhichao Gao <zhichao.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
Date: Thu, 9 Jan 2020 18:24:38 +0100	[thread overview]
Message-ID: <ea3fe20d-eea3-af2d-08c4-a30e7976de78@redhat.com> (raw)
In-Reply-To: <20200108234313.28510-2-lersek@redhat.com>

On 1/9/20 12:43 AM, Laszlo Ersek wrote:
> 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);

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> +      }
> +      if (LoadFileText != NULL) {
> +        FreePool (LoadFileText);
> +      }
> +      );
>       return NULL;
>     }
>   
> 


  parent reply	other threads:[~2020-01-09 17:24 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
2020-01-09 17:24   ` Philippe Mathieu-Daudé [this message]
2020-01-13  1:53   ` [edk2-devel] " 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=ea3fe20d-eea3-af2d-08c4-a30e7976de78@redhat.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