From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.7320.1578984950305299946 for ; Mon, 13 Jan 2020 22:55:50 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jan 2020 22:55:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,431,1571727600"; d="scan'208";a="219522953" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 13 Jan 2020 22:55:48 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jan 2020 22:55:49 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jan 2020 22:55:49 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.132]) with mapi id 14.03.0439.000; Tue, 14 Jan 2020 14:55:46 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "lersek@redhat.com" CC: "Wang, Jian J" , "Ni, Ray" , "Gao, Zhichao" Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure Thread-Topic: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure Thread-Index: AQHVxn1unbAjatA9bEWvUo7kqyvT2Kfpwgsw Date: Tue, 14 Jan 2020 06:55:46 +0000 Message-ID: References: <20200108234313.28510-1-lersek@redhat.com> <20200108234313.28510-2-lersek@redhat.com> In-Reply-To: <20200108234313.28510-2-lersek@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@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 >=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.is= o)" > > FilePath=3D"" Acked-by: Hao A Wu Best Regards, Hao Wu >=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, = FALSE); > + } > + 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 >=20 >=20 >=20