From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.3446.1604697648389209567 for ; Fri, 06 Nov 2020 13:20:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jHgKy0BK; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604697647; 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=r3/5MgWI9c5CPOmSM3WG8ORDe9w5RU91q+jCezoq7bM=; b=jHgKy0BKvTvFDr3ThyRMJzroND+YRyzP+VdiwJvDOsEITzhZxsDonw3OqMDb6w04EjayTV WP/t0Ipxb11RVttJnDSrTXEwIrRXvNidDr3bgzF8Pvvbgvm9YXkrY3EoL/2Iwe3kHRDwyD WPWdoa1wCSlV3D3Gd3Ms22voN2+gpnw= 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-396-V4D8Xj0qNgak04PGIP7CMg-1; Fri, 06 Nov 2020 16:20:44 -0500 X-MC-Unique: V4D8Xj0qNgak04PGIP7CMg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B4A61007467; Fri, 6 Nov 2020 21:20:42 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-95.ams2.redhat.com [10.36.115.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AF597664D; Fri, 6 Nov 2020 21:20:39 +0000 (UTC) Subject: =?UTF-8?B?UmU6IFtlZGsyLWRldmVsXSDlm57lpI06IFtQQVRDSF0gTWRlTW9kdWxlUGtnL0NvcmUvRHhlOiBsb2cgbWVtb3J5IGJhc2UgYW5kIGxlbmd0aCwgYWZ0ZXIgbGliIGN0b3JzIGFnYWlu?= To: devel@edk2.groups.io, gaoliming@byosoft.com.cn, =?UTF-8?Q?'Philippe_Mathieu-Daud=c3=a9'?= 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> <002601d6b318$7ba3aec0$72eb0c40$@byosoft.com.cn> From: "Laszlo Ersek" Message-ID: <81686a19-d98a-26f4-cd31-29e3f3c4b9fa@redhat.com> Date: Fri, 6 Nov 2020 22:20:37 +0100 MIME-Version: 1.0 In-Reply-To: <002601d6b318$7ba3aec0$72eb0c40$@byosoft.com.cn> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 11/05/20 03:07, gaoliming wrote: > Laszlo: > With this change, MemoryBaseAddress and MemoryLength can print to serial port after serial port constructor is called. > > Reviewed-by: Liming Gao Thank you both for the reviews; merged as commit 1366cd58cd44, via . Laszlo > > Thanks > Liming >> -----邮件原件----- >> 发件人: Philippe Mathieu-Daudé >> 发送时间: 2020年11月4日 2:13 >> 收件人: Laszlo Ersek ; edk2-devel-groups-io >> >> 抄送: Ard Biesheuvel ; Dandan Bi >> ; Hao A Wu ; Jeff Brasen >> ; Jian J Wang ; Leif Lindholm >> ; Liming Gao >> 主题: Re: [PATCH] MdeModulePkg/Core/Dxe: log memory base and length, >> after lib ctors again >> >> 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. >> >> Uh... >> >>> >>> 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"). >> >> Yes. >> >>> >>> 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()). >> >> Sounds good. >> >> Reviewed-by: Philippe Mathieu-Daude >> >>> >>> 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é >>> 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=0x%Lx >> MemoryLength=0x%Lx\n", >>> + __FUNCTION__, MemoryBaseAddress, MemoryLength)); >>> + >>> // >>> // Report DXE Core image information to the PE/COFF Extra Action >> Library >>> // >>> ZeroMem (&ImageContext, sizeof (ImageContext)); >>> > > > > > > > >