public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, siyuan.fu@intel.com, "Wu,
	Hao A" <hao.a.wu@intel.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>
Cc: "Ni, Ray" <ray.ni@intel.com>, "Gao, Zhichao" <zhichao.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure
Date: Mon, 13 Jan 2020 22:05:41 +0100	[thread overview]
Message-ID: <eb27256d-b2c4-174c-ff2e-045505d47b28@redhat.com> (raw)
In-Reply-To: <B1FF2E9001CE9041BD10B825821D5BC58B94A243@SHSMSX103.ccr.corp.intel.com>

On 01/13/20 02:53, Siyuan, Fu wrote:
> The change looks good to me.
> 
> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>

Thank you, Siyuan!

Hao, Jian, can one of you please give a formal Acked-by, based on
Siyuan's and Phil's "Reviewed-by"s? (I'm asking because I'm not sure if
you would be comfortable with me pushing this without MdeModulePkg "M"
approval.)

Thanks!
Laszlo

>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo
>> Ersek
>> Sent: 2020年1月9日 7:43
>> 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: [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=""
>>
>> (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-13 21:05 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   ` [edk2-devel] " Philippe Mathieu-Daudé
2020-01-13  1:53   ` Siyuan, Fu
2020-01-13 21:05     ` Laszlo Ersek [this message]
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=eb27256d-b2c4-174c-ff2e-045505d47b28@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