Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kyxMt-0000W4-Ka for mharc-grub-devel@gnu.org; Mon, 11 Jan 2021 08:36:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyxMl-0000TN-UD for grub-devel@gnu.org; Mon, 11 Jan 2021 08:36:17 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:43670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyxMi-000757-Uw for grub-devel@gnu.org; Mon, 11 Jan 2021 08:36:15 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10BDT99P074248; Mon, 11 Jan 2021 13:36:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : in-reply-to : references : mime-version : content-type : content-transfer-encoding : subject : to : cc : from : message-id; s=corp-2020-01-29; bh=cMsFzplYFl9gzPwSAfGkrmxsXmjEnuvfhx+8WeJMilg=; b=ftWqiQuYB/7z/H+/0aimu2AvRoCdsV5At3aZiu5HyCl53/rYNIBv1iZ+jp79moD9YERY sUMjChyNVZ5TMssbDFJtMfulAzjAgAeKuKbVpQUgOZu1OLEt7CD7CrTiwA7p8X6OVp9W DBJfYCvCYhMrcgifzHuhGb5OcjQ4HmxHk0L+l4QcflocNuXE6Y5YafJJmpIvDysb+nfl CCmhXBqWCeo446h0SmUFDnGi+c9g7YI8zGftWC7+gTKhR0sLdeE9d2dhXMr5YAtRz9BD qFKnMZSA5CYRV8vNzg8DBEjbm4fT5ulTaP3z1LO4Fc1F24ykZZrSlW8KpIleEPXBMOAE Ww== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 360kvjs1q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Jan 2021 13:36:06 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10BDVLZp134718; Mon, 11 Jan 2021 13:34:05 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 360ke50c6r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Jan 2021 13:34:05 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 10BDY4Ec001379; Mon, 11 Jan 2021 13:34:04 GMT Received: from [10.108.187.72] (/107.107.61.154) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 11 Jan 2021 05:34:04 -0800 Date: Mon, 11 Jan 2021 08:34:00 -0500 User-Agent: K-9 Mail for Android In-Reply-To: <2264BE1F-B038-44A4-AB9E-91CD26C3B14B@amazon.com> References: <2264BE1F-B038-44A4-AB9E-91CD26C3B14B@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] Remove unnecessary constraints on required_pages for EFI boot To: The development of GNU GRUB , "Char, Hanson via Grub-devel" , "grub-devel@gnu.org" CC: "Char, Hanson" From: Konrad Rzeszutek Wilk Message-ID: X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9860 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101110081 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9860 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 clxscore=1011 impostorscore=0 spamscore=0 mlxscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101110081 Received-SPF: pass client-ip=156.151.31.86; envelope-from=konrad.wilk@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 13:36:17 -0000 On January 10, 2021 2:41:09 PM EST, "Char, Hanson via Grub-devel" wrote: >As reported earlier, when booted in UEFI mode, Grub would fail to load >a ramdisk of size larger than "(total_pages >> 2)" with > >=C2=A0 =C2=A0 "error: out of memory" > >(https://git=2Esavannah=2Egnu=2Eorg/cgit/grub=2Egit/tree/grub-core/kern/e= fi/mm=2Ec#n616) > >Further investigation into the EFI memory map indicates the current >limit of MAX_HEAP_MEMORY and the use of a quarter of the total_pages >returned from EFI available memory (type 7) as the default seems >arbitrary and unnecessary=2E > >Therefore this proposed patch removes the aribrary limit, and lets Grub >make full use of the EFI available memory reported by the BIOS=2E > >The patch has been successfully tested to load large ramdisk with size >that would otherwise fail=2E > Something is off with your patch=2E That text above should have been in t= he patch as a comment=2E And also your SoB in it=2E Could you kindly repost= ? >Regards, >Hanson > From ceb27404eb281a74aa82799885cd74b530e9237e Mon Sep 17 00:00:00 2001 >From: Hanson Char >Date: Sun, 10 Jan 2021 10:57:06 -0800 >Subject: [PATCH] Remove unnecessary constraints on required_pages for >EFI boot > >--- >=C2=A0grub-core/kern/efi/mm=2Ec | 12 +++--------- >=C2=A01 file changed, 3 insertions(+), 9 deletions(-) > >diff --git a/grub-core/kern/efi/mm=2Ec b/grub-core/kern/efi/mm=2Ec >index 457772d57=2E=2E9cf6a4d34 100644 >--- a/grub-core/kern/efi/mm=2Ec >+++ b/grub-core/kern/efi/mm=2Ec >@@ -38,9 +38,8 @@ >=C2=A0 =C2=A0 a multiplier of 4KB=2E =C2=A0*/ >=C2=A0#define MEMORY_MAP_SIZE =C2=A0 =C2=A00x3000 > >-/* The minimum and maximum heap size for GRUB itself=2E =C2=A0*/ >+/* The minimum heap size for GRUB itself=2E =C2=A0*/ >=C2=A0#define MIN_HEAP_SIZE =C2=A00x100000 >-#define MAX_HEAP_SIZE =C2=A0(1600 * 0x100000) > >=C2=A0static void *finish_mmap_buf =3D 0; >=C2=A0static grub_efi_uintn_t finish_mmap_size =3D 0; >@@ -569,7 +568,6 @@ grub_efi_mm_init (void) >=C2=A0 =C2=A0grub_efi_memory_descriptor_t *filtered_memory_map_end; >=C2=A0 =C2=A0grub_efi_uintn_t map_size; >=C2=A0 =C2=A0grub_efi_uintn_t desc_size; >- =C2=A0grub_efi_uint64_t total_pages; >=C2=A0 =C2=A0grub_efi_uint64_t required_pages; >=C2=A0 =C2=A0int mm_status; > >@@ -610,14 +608,10 @@ grub_efi_mm_init (void) >=C2=A0 =C2=A0filtered_memory_map_end =3D filter_memory_map (memory_map, >filtered_memory_map, >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0desc_size, memory_map_end); > >- =C2=A0/* By default, request a quarter of the available memory=2E =C2= =A0*/ >- =C2=A0total_pages =3D get_total_pages (filtered_memory_map, desc_size, >- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filtered_memory_= map_end); >- =C2=A0required_pages =3D (total_pages >> 2); >+ =C2=A0required_pages =3D get_total_pages (filtered_memory_map, desc_siz= e, >+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filtered_memory_map_= end); >=C2=A0 =C2=A0if (required_pages < BYTES_TO_PAGES (MIN_HEAP_SIZE)) >=C2=A0 =C2=A0 =C2=A0required_pages =3D BYTES_TO_PAGES (MIN_HEAP_SIZE); >- =C2=A0else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE)) >- =C2=A0 =C2=A0required_pages =3D BYTES_TO_PAGES (MAX_HEAP_SIZE); > >=C2=A0 =C2=A0/* Sort the filtered descriptors, so that GRUB can allocate = pages >=C2=A0 =C2=A0 =C2=A0 from smaller regions=2E =C2=A0*/ >-- >2=2E29=2E2 > >_______________________________________________ >Grub-devel mailing list >Grub-devel@gnu=2Eorg >https://lists=2Egnu=2Eorg/mailman/listinfo/grub-devel