From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.12083.1578590684769055727 for ; Thu, 09 Jan 2020 09:24:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZTjBU8hS; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578590683; 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=nXkDF0+FBJ3HafSpFal6gcSDSTN+KQy4y3iwswZWpuQ=; b=ZTjBU8hSjrZjt5hvRcu9Q8A0ayei7E6eqjtihM1MBSaCNrgSb0f0aUiikn81b1X29jrXZp U4EgoR3WP+vGXnMIYDsh0xvb1wcpXq16Oifr+MWma+cUuDKZnN08kZ771TOupDtU6mLoPT 75wR6DYK9RwP7FlAXjx/wL4Tw/RsMqI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-KSITQlPUM6qitER5bqymPQ-1; Thu, 09 Jan 2020 12:24:41 -0500 Received: by mail-wm1-f69.google.com with SMTP id t16so1188584wmt.4 for ; Thu, 09 Jan 2020 09:24:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nXkDF0+FBJ3HafSpFal6gcSDSTN+KQy4y3iwswZWpuQ=; b=E0fExT48z4I8r0OMApcw6I0sdcVlEwdRZdWDh6aLl9bvWdUHlGbfkWjy1VBjgy5zHE Yfht1qFZG13I1tE1HRTDUB/9fg5r4Ih1E53cEJq4JICkyJenLTbShuVlpws5iiY+qAOm /lpyS/mxGKO5so/18x1sHsI1VRw5b6MnR9GBodFfBdRL/84+hU0DFsITg4UoLhSAjX1z nWfdXtMnowN6kDGZQ4Eg0fX6ww6b4/m2+4EJNClGFJvaEpYvrGI1m1j5rYraiCvxvF9d y07yN1/P6fV2m5rg9LERkuRClpBhRIJUHanFhAniIu3w1L0o4fcjMzLOxT1rgpoXR0Lk Ev3A== X-Gm-Message-State: APjAAAV0H/DAgGAmwohY9ReMG4H3zxtJjos8QAz1QFI4dEy7IGhRUvqa dYPRjIz6zdMQkb0CfUnh6nSmryp44FJ5u7IkI/v3COeq9gmfIgjmqc5SFx6JNkXTCh7Nfonmha1 YFnU80mDUX5/klA== X-Received: by 2002:a1c:f719:: with SMTP id v25mr6111124wmh.116.1578590680245; Thu, 09 Jan 2020 09:24:40 -0800 (PST) X-Google-Smtp-Source: APXvYqz7fnMwb+52NcrD1ga9zXyHkZ2WGIx/tjqfFdwSEpCF4dHeTWL62/bCIW+z0vF2iydA6lKL/A== X-Received: by 2002:a1c:f719:: with SMTP id v25mr6111102wmh.116.1578590680036; Thu, 09 Jan 2020 09:24:40 -0800 (PST) Return-Path: Received: from [192.168.1.51] (64.red-79-146-240.dynamicip.rima-tde.net. [79.146.240.64]) by smtp.gmail.com with ESMTPSA id f16sm8767879wrm.65.2020.01.09.09.24.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jan 2020 09:24:39 -0800 (PST) Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UefiBootManagerLib: log reserved mem allocation failure To: devel@edk2.groups.io, lersek@redhat.com Cc: Hao A Wu , Jian J Wang , Ray Ni , Zhichao Gao References: <20200108234313.28510-1-lersek@redhat.com> <20200108234313.28510-2-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Thu, 9 Jan 2020 18:24:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200108234313.28510-2-lersek@redhat.com> X-MC-Unique: KSITQlPUM6qitER5bqymPQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 > : > >> 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 > 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 = 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 > + } > + if (LoadFileText != NULL) { > + FreePool (LoadFileText); > + } > + ); > return NULL; > } > >