From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.1916.1604542087575604543 for ; Wed, 04 Nov 2020 18:08:09 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 05 Nov 2020 10:07:57 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: =?UTF-8?Q?'Philippe_Mathieu-Daud=C3=A9'?= , "'Laszlo Ersek'" , "'edk2-devel-groups-io'" Cc: "'Ard Biesheuvel'" , "'Dandan Bi'" , "'Hao A Wu'" , "'Jeff Brasen'" , "'Jian J Wang'" , "'Leif Lindholm'" References: <20201103161557.30621-1-lersek@redhat.com> <2ab23452-64d2-be67-10e3-7b94c390683f@redhat.com> In-Reply-To: <2ab23452-64d2-be67-10e3-7b94c390683f@redhat.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0hdIE1kZU1vZHVsZVBrZy9Db3JlL0R4ZTogbG9nIG1lbW9yeSBiYXNlIGFuZCBsZW5ndGgsIGFmdGVyIGxpYiBjdG9ycyBhZ2Fpbg==?= Date: Thu, 5 Nov 2020 10:07:58 +0800 Message-ID: <002601d6b318$7ba3aec0$72eb0c40$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKzWJhKeKsZ+UKdzuwxARx2gzql9QEEPtG+p/dX1GA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Laszlo: With this change, MemoryBaseAddress and MemoryLength can print to = serial port after serial port constructor is called.=20 =20 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: Philippe Mathieu-Daud=C3=A9 = > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: = 2020=E5=B9=B411=E6=9C=884=E6=97=A5 2:13 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Laszlo Ersek ; = edk2-devel-groups-io > > =E6=8A=84=E9=80=81: Ard Biesheuvel ; Dandan Bi > ; Hao A Wu ; Jeff Brasen > ; Jian J Wang ; Leif = Lindholm > ; Liming Gao > =E4=B8=BB=E9=A2=98: Re: [PATCH] MdeModulePkg/Core/Dxe: log memory base = and length, > after lib ctors again >=20 > On 11/3/20 5:15 PM, Laszlo Ersek wrote: > > CoreInitializeMemoryServices() logs "BaseAddress" and "Length" with > > DEBUG() before DxeMain() calls ProcessLibraryConstructorList() > > explicitly. (Library construction is not an automatic part of the = DXE > > Core entry point.) > > > > So those DEBUG()s in CoreInitializeMemoryServices() are issued = against > > an un-constructed DebugLib, and also against a -- possibly = underlying -- > > un-constructed SerialPortLib. >=20 > Uh... >=20 > > > > Some DebugLib instances can deal with this (see for example commit > > 91a5b1365075, "OvmfPkg/PlatformDebugLibIoPort: fix port detection = for > > use in the DXE Core", 2018-08-06), while some others can't (see for > > example the DebugLib instance > > "MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf" > > coupled with the SerialPortLib instance > > = "ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf"). >=20 > Yes. >=20 > > > > Addressing this issue in a SerialPortLib instance that underlies > > BaseDebugLibSerialPort seems wrong; either the DebugLib instance = should > > cope directly with being called un-constructed (see again commit > > 91a5b1365075), or the DXE Core should log relevant information *at > > least* after library instances have been constructed. This patch > > implements the latter (only for the "BaseAddress" and "Length" = values > > calculated by CoreInitializeMemoryServices()). >=20 > Sounds good. >=20 > Reviewed-by: Philippe Mathieu-Daude >=20 > > > > Cc: Ard Biesheuvel > > Cc: Dandan Bi > > Cc: Hao A Wu > > Cc: Jeff Brasen > > Cc: Jian J Wang > > Cc: Leif Lindholm > > Cc: Liming Gao > > Cc: Philippe Mathieu-Daud=C3=A9 > > Signed-off-by: Laszlo Ersek > > --- > > > > Notes: > > Repo: https://pagure.io/lersek/edk2.git > > Branch: dxecore_report_mem > > > > MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > > index 5ee4cd10b436..db21311f9352 100644 > > --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > > +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c > > @@ -297,8 +297,16 @@ DxeMain ( > > ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST); > > PERF_CROSSMODULE_END ("PEI"); > > PERF_CROSSMODULE_BEGIN ("DXE"); > > > > + // > > + // Log MemoryBaseAddress and MemoryLength again (from > > + // CoreInitializeMemoryServices()), now that library constructors = have > > + // executed. > > + // > > + DEBUG ((DEBUG_INFO, "%a: MemoryBaseAddress=3D0x%Lx > MemoryLength=3D0x%Lx\n", > > + __FUNCTION__, MemoryBaseAddress, MemoryLength)); > > + > > // > > // Report DXE Core image information to the PE/COFF Extra Action > Library > > // > > ZeroMem (&ImageContext, sizeof (ImageContext)); > >