From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web09.364.1578949552619542559 for ; Mon, 13 Jan 2020 13:05:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gs50YLWu; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578949551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8arHUn+DfDqzGDV8EOEYNp308V7AjGzbkuNDaeCBorE=; b=gs50YLWuFwAqRj+wsOVV4e3NnvNmBfHFR8jm2ppZ5AxC6+BvHTyC9S9H/qWMIE+0dAG0iu 25Nv71xR4g/PZamznGdYkvlHYleNhkI2OK3u7nyNdhg16Jcl1vkpCywJtvwIR4oQqNP9A0 AT7qkzMCaaYB6KNk/H37yMFcRmbZrZg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-104-n9jn73usNC-r8SeZ_32Ngw-1; Mon, 13 Jan 2020 16:05:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9951D19586C1; Mon, 13 Jan 2020 21:05:43 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-224.ams2.redhat.com [10.36.116.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF86C5C1B0; Mon, 13 Jan 2020 21:05:41 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure To: devel@edk2.groups.io, siyuan.fu@intel.com, "Wu, Hao A" , "Wang, Jian J" Cc: "Ni, Ray" , "Gao, Zhichao" References: <20200108234313.28510-1-lersek@redhat.com> <20200108234313.28510-2-lersek@redhat.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 13 Jan 2020 22:05:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: n9jn73usNC-r8SeZ_32Ngw-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/13/20 02:53, Siyuan, Fu wrote: > The change looks good to me. >=20 > Reviewed-by: Siyuan Fu 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 On Behalf Of Laszlo >> Ersek >> Sent: 2020=E5=B9=B41=E6=9C=889=E6=97=A5 7:43 >> 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 >> >> The LoadFile protocol can report such a large buffer size that we canno= t >> 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 >> > 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=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"" >> >> (Manually rewrapped here for keeping PatchCheck.py happy.) >> >> 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(+) >> >> 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; >> } >> >> -- >> 2.19.1.3.g30247aa5d201 >> >> >> >> >=20 >=20 >=20 >=20