From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from walk.intel-email.com (walk.intel-email.com [101.227.64.242]) by mx.groups.io with SMTP id smtpd.web08.2049.1657941876639256359 for ; Fri, 15 Jul 2022 20:24:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=iv/Lllnt; spf=pass (domain: byosoft.com.cn, ip: 101.227.64.242, mailfrom: gaoliming@byosoft.com.cn) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id B2796CD1F651 for ; Sat, 16 Jul 2022 11:24:33 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1657941873; bh=kE4tZB9QSABsdKYVdnxt0XWmzAGrwy6yGzIxmIGO128=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=iv/Lllnt/xWlVp06yBYk5Zyr9PEiLnLvzDBmn3xc6AZcnxadb8XJiJJhmBBgidi+s uw6tfrt+TWFuIRj5vQdrfEbmthrWmLUtxiWbl7rY7ymCu3biC5H5R5VkjKV3ez4LBQ rgamGhYVUEE2fcXT1Y4coayrCKKQFbLxvqB0Wsbs= Received: from localhost (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id AD3B7CD1F67A for ; Sat, 16 Jul 2022 11:24:33 +0800 (CST) X-Virus-Scanned: by SpamTitan at intel-email.com Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 6F2D0CD1F667 for ; Sat, 16 Jul 2022 11:24:33 +0800 (CST) Authentication-Results: walk.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by walk.intel-email.com (Postfix) with SMTP id EF194CD1F65C for ; Sat, 16 Jul 2022 11:24:29 +0800 (CST) Received: from DESKTOPS6D0PVI ([101.86.147.186]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Sat, 16 Jul 2022 11:24:29 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.86.147.186 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Kinney, Michael D'" , Cc: "'Bi, Dandan'" References: <20220107193612.1350-1-stacy.howell@intel.com> <01ca01d8068e$e98aa590$bc9ff0b0$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiDlm57lpI06IFtlZGsyLWRldmVsXSBbUEFUQ0hdIE1kZU1vZHVsZVBrZ1xDb3JlRHhlOiBBbGxvdyBEWEUgRHJpdmVycyB0byB1c2UgdW50ZXN0ZWQgbWVtb3J5?= Date: Sat, 16 Jul 2022 11:24:28 +0800 Message-ID: <050301d898c3$8f040680$ad0c1380$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIs+xFC0ABOah1IIY4Lnv5LhQdu7wIYo5yPAeLYa7EA0IFxJQHFLkKmAnsRb1usjy7dgA== Sender: "gaoliming" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn If no other objection, I will merge this patch next week.=20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Howell, Stacy > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B44=E6=9C=8825=E6=97=A5 = 22:11 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Kinney, Michael D ; > devel@edk2.groups.io; spbrogan@outlook.com; Gao, Liming > > =E6=8A=84=E9=80=81: Bi, Dandan ; Howell, Stacy > > =E4=B8=BB=E9=A2=98: Re: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModul= ePkg\CoreDxe: Allow DXE > Drivers to use untested memory >=20 > Hi all, > Are there any other comments or concerns regarding this patch? >=20 > Thanks, > Stacy >=20 > -----Original Message----- > From: Howell, Stacy > Sent: Friday, January 14, 2022 4:13 PM > To: Kinney, Michael D ; devel@edk2.groups.io; > spbrogan@outlook.com; Gao, Liming > Cc: Bi, Dandan ; Howell, Stacy > > Subject: RE: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModulePkg\CoreDx= e: Allow DXE > Drivers to use untested memory >=20 > Hi Sean, > Setting all memory as tested in PEI is a workaround for the issue that th= is > patch addresses. However, promoting all memory in PEI is not a workable > solution for BIOSes that incorporate full memory testing functionality, a= s this > relies on the tested flag to determine which memory regions to test. >=20 > This patch addresses a discrepancy in EDK2 core regarding how untested > memory is treated for allocation by DXE drivers. In the case where a DXE > driver does not request a specific memory region DXE Core will promote > untested memory if necessary to provide memory to the driver. In the cas= e > where a DXE driver requests a specific memory range of untested memory, > DXE Core will currently return an error instead of promoting untested mem= ory > to make the region available for the driver. >=20 > Thanks, > Stacy >=20 > -----Original Message----- > From: Kinney, Michael D > Sent: Tuesday, January 11, 2022 10:57 AM > To: devel@edk2.groups.io; spbrogan@outlook.com; Gao, Liming > ; Howell, Stacy ; > Kinney, Michael D > Cc: Bi, Dandan > Subject: RE: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModulePkg\CoreDx= e: Allow DXE > Drivers to use untested memory >=20 > Hi Sean, >=20 > The auto promotion of memory was only intended as a dev/debug feature to > maximize platform boot without having to tune what memory is tested in PE= I > phase. >=20 > In my opinion, a production platform should never trigger any auto > promotions of untested to tested memory, and part of production validatio= n > should make sure this event never occurs in any production boot scenarios= . >=20 > The specific bug being fix here is that auto promotion was not symmetric > across all memory allocation types. It simply aligns this dev/debug feat= ure. >=20 > Mike >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Sean > > Sent: Monday, January 10, 2022 6:47 PM > > To: devel@edk2.groups.io; Gao, Liming ; > > Howell, Stacy > > Cc: Bi, Dandan > > Subject: Re: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModulePkg\Core= Dxe: Allow > DXE > > Drivers to use untested memory > > > > if this is auto promotion is happening in the core then what is the > > value of memory testing and tracking that state. Is memory testing > > state a necessary feature of the Dxe Core? > > > > > > I think it makes more sense that if you platform wants to use a given > > range your platform should either test it and/or mark it as tested. > > > > OR > > > > The dxe core should do away with the memory testing tracking. > > > > > > On most platforms i have seen in the past few years all memory is > > marked as tested without doing any testing. The only value in the > > flag is keep the initial memory allocations in a given low range (below= 4gb). > > > > > > > > > > On 1/10/2022 5:59 PM, gaoliming wrote: > > > Stacy: > > > This fix covers the case with AllocateAddress allocation type. I > > > agree this fix. Reviewed-by: Liming Gao > > > > > > Thanks > > > Liming > > >> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > >> =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Stacy > Howell > > >> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B41=E6=9C=888=E6=97= =A5 3:36 > > >> =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > >> =E6=8A=84=E9=80=81: Stacy Howell ; Dandan Bi > > >> ; Liming Gao > > >> =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow= DXE Drivers > to > > >> use untested memory > > >> > > >> REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3D3795 > > >> CC: Dandan Bi > > >> CC: Liming Gao > > >> > > >> Updated CoreInternalAllocatePages() to call PromoteMemoryResource() > > >> and re-attempt the allocation if unable to convert the specified > > >> memory range > > >> > > >> Signed-off-by: Stacy Howell > > >> --- > > >> MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++++++++++++++ > > >> 1 file changed, 14 insertions(+) > > >> > > >> diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c > > >> b/MdeModulePkg/Core/Dxe/Mem/Page.c > > >> index 47d4c5d92e..cc0b90ac0d 100644 > > >> --- a/MdeModulePkg/Core/Dxe/Mem/Page.c > > >> +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c > > >> @@ -1417,6 +1417,20 @@ CoreInternalAllocatePages ( > > >> Status =3D CoreConvertPages (Start, NumberOfPages, > MemoryType); > > >> } > > >> > > >> + if (EFI_ERROR (Status)) { > > >> + // > > >> + // If requested memory region is unavailable it may be > > >> + untested > > >> memory > > >> + // Attempt to promote memory resources, then re-attempt the > > >> allocation > > >> + // > > >> + if (PromoteMemoryResource ()) { > > >> + if (NeedGuard) { > > >> + Status =3D CoreConvertPagesWithGuard (Start, > NumberOfPages, > > >> MemoryType); > > >> + } else { > > >> + Status =3D CoreConvertPages (Start, NumberOfPages, > MemoryType); > > >> + } > > >> + } > > >> + } > > >> + > > >> Done: > > >> CoreReleaseMemoryLock (); > > >> > > >> -- > > >> 2.32.0.windows.2 > > >> > > >> > > >> > > >> > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >=20 >=20 >=20 >=20 >=20