From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.3836.1578539335154423352 for ; Wed, 08 Jan 2020 19:08:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 19:08:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,412,1571727600"; d="scan'208";a="423116154" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 08 Jan 2020 19:08:54 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 8 Jan 2020 19:08:54 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 8 Jan 2020 19:08:54 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by shsmsx102.ccr.corp.intel.com ([169.254.2.202]) with mapi id 14.03.0439.000; Thu, 9 Jan 2020 11:08:52 +0800 From: "Ni, Ray" To: Laszlo Ersek , edk2-devel-groups-io , "Fu, Siyuan" CC: "Wu, Hao A" , "Wang, Jian J" , "Gao, Zhichao" Subject: Re: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure Thread-Topic: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure Thread-Index: AQHVxn1u0c4L9NegZ0OJ0XoQiWcEjqfhprUA Date: Thu, 9 Jan 2020 03:08:52 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C3E0CED@SHSMSX104.ccr.corp.intel.com> References: <20200108234313.28510-1-lersek@redhat.com> <20200108234313.28510-2-lersek@redhat.com> In-Reply-To: <20200108234313.28510-2-lersek@redhat.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable + Siyuan who originally worked in the HTTP boot functionality. > -----Original Message----- > From: Laszlo Ersek > Sent: Thursday, January 9, 2020 7:43 AM > To: edk2-devel-groups-io > Cc: Wu, Hao A ; Wang, Jian J ; > Ni, Ray ; Gao, Zhichao > Subject: [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved > mem allocation failure >=20 > 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). >=20 > While the TianoCore wiki mentions this at > disk-image-size>: >=20 > > The maximum RAM disk image size depends on how much continuous > reserved > > memory block the platform could provide. >=20 > it's hard to remember; so log a DEBUG_ERROR message when the allocation > fails. >=20 > This patch produces error messages such as: >=20 > > UiApp:BmExpandLoadFile: failed to allocate reserved pages: > > BufferSize=3D4501536768 > > LoadFile=3D"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=3D"" >=20 > (Manually rewrapped here for keeping PatchCheck.py happy.) >=20 > Cc: Hao A Wu > Cc: Jian J Wang > Cc: Ray Ni > Cc: Zhichao Gao > Signed-off-by: Laszlo Ersek > --- > MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 31 > ++++++++++++++++++++ > 1 file changed, 31 insertions(+) >=20 > 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 =3D AllocateReservedPages (EFI_SIZE_TO_PAGES (BufferSize)); > if (FileBuffer =3D=3D NULL) { > + DEBUG_CODE ( > + EFI_DEVICE_PATH *LoadFilePath; > + CHAR16 *LoadFileText; > + CHAR16 *FileText; > + > + LoadFilePath =3D DevicePathFromHandle (LoadFileHandle); > + if (LoadFilePath =3D=3D NULL) { > + LoadFileText =3D NULL; > + } else { > + LoadFileText =3D ConvertDevicePathToText (LoadFilePath, FALSE, F= ALSE); > + } > + FileText =3D ConvertDevicePathToText (FilePath, FALSE, FALSE); > + > + DEBUG (( > + DEBUG_ERROR, > + "%a:%a: failed to allocate reserved pages: " > + "BufferSize=3D%Lu LoadFile=3D\"%s\" FilePath=3D\"%s\"\n", > + gEfiCallerBaseName, > + __FUNCTION__, > + (UINT64)BufferSize, > + LoadFileText, > + FileText > + )); > + > + if (FileText !=3D NULL) { > + FreePool (FileText); > + } > + if (LoadFileText !=3D NULL) { > + FreePool (LoadFileText); > + } > + ); > return NULL; > } >=20 > -- > 2.19.1.3.g30247aa5d201 >=20