From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.1376.1604427185486622392 for ; Tue, 03 Nov 2020 10:13:05 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P6OLShpa; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604427183; 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=NZpa0R2qhHLLXjR3wv4B6eMxvBuN4TWFSP9PHvLr3Ic=; b=P6OLShpaqlnT8QjdVNqDtW9U5Ar6Fc3fllL661tKke42ocSWQPeL4wMT7EMY0qPzEx/Clh NW+qktjsBU2ycOauuhQCf0yotBPkR/50Au2q3t1iTrOqaklHS/fYEgpO0obE4BOz/lNnKt g7XoeOlaZGpmrJCQ+wF5JnCV4ftv5mc= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-fMeLUL3ZO2uvW3SHjE6QlQ-1; Tue, 03 Nov 2020 13:13:00 -0500 X-MC-Unique: fMeLUL3ZO2uvW3SHjE6QlQ-1 Received: by mail-wr1-f71.google.com with SMTP id v5so8159912wrr.0 for ; Tue, 03 Nov 2020 10:13:00 -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=NZpa0R2qhHLLXjR3wv4B6eMxvBuN4TWFSP9PHvLr3Ic=; b=Um7XbyweA0Vz5IkKXlI4Gs+fagkEiShGo6t+5e33Hwipkiuiy7urUodVLI3cNh1m4k qTl/Nhcd2fbfj1hcm5WujSjNZTihC/QvuM2eUmRjhGeIcUXjeEyobWZNar+opjw8TXWE qB+K+s6njgthKW19nxKIBWDUk1X9yD26XjX/PSBIjcMs0AZD2xeEFz9uwFCqOuUNuU7G Dq2RYuFZApeMFWWSBKJ2y6uzTQmFQToeWjBy2hNjxRFnwDWaRlYZBKTcX/+TUxaYuNR/ N1/10CAW/3ycHX6LROo5XT6LFdEH+wKviwa0C32wOPWSeFIZhjUK0CrPC+bkrskApZ6n qCYQ== X-Gm-Message-State: AOAM531wS9O/NY51HP3K2HT1NUX4Bzb47CV2cIM37JDT00dyNMTr7BHh nWs87BuRwITkrwCKMM5o/e4PCjGTK7E5A6LkWypldBS9Kf9mstacAh2/BKtwpV0bVEkRjg4Pkrj uDqOcglOMp17hKg== X-Received: by 2002:a1c:1946:: with SMTP id 67mr403357wmz.15.1604427179178; Tue, 03 Nov 2020 10:12:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDbd8mk99lUSL0bkdyaNss8Kw9WVIDsdT9w/ezFaGXsTU0i8JioLN8vrpVhITtu2qGcR7hxQ== X-Received: by 2002:a1c:1946:: with SMTP id 67mr403338wmz.15.1604427178980; Tue, 03 Nov 2020 10:12:58 -0800 (PST) Return-Path: Received: from [192.168.1.36] (234.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.234]) by smtp.gmail.com with ESMTPSA id c17sm3601997wml.14.2020.11.03.10.12.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 10:12:58 -0800 (PST) Subject: Re: [PATCH] MdeModulePkg/Core/Dxe: log memory base and length, after lib ctors again To: Laszlo Ersek , edk2-devel-groups-io Cc: Ard Biesheuvel , Dandan Bi , Hao A Wu , Jeff Brasen , Jian J Wang , Leif Lindholm , Liming Gao References: <20201103161557.30621-1-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <2ab23452-64d2-be67-10e3-7b94c390683f@redhat.com> Date: Tue, 3 Nov 2020 19:12:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201103161557.30621-1-lersek@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@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/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)); >