From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2CBF8D80F9A for ; Mon, 9 Oct 2023 07:10:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=6qodvLCw7q0nxgBnmpOe1G4CRQAhNSeQ2oJKcG6G7hs=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1696835457; v=1; b=qGOKSmF8kjb+P4HjxaNHPNKqr5j22hE0O3onyq6ZsBY0y2IamC6Y8fINYmP5UnhvaPYUPgRW dRKpRdNwlffu7At5LNbFE61WnPFvgFCqyoYOsVQ4KTpRUsxzC4JyUX3W5/j9nlIyy0vK9c49i13 ZqlDSYukKOh2KkJkkyWLlXh8= X-Received: by 127.0.0.2 with SMTP id CBmxYY7687511x3CkfZoGbrz; Mon, 09 Oct 2023 00:10:57 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.55948.1696835457224242472 for ; Mon, 09 Oct 2023 00:10:57 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-682-AcDbUwsfMey9V2zJGbvrfg-1; Mon, 09 Oct 2023 03:10:50 -0400 X-MC-Unique: AcDbUwsfMey9V2zJGbvrfg-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 649FC858286; Mon, 9 Oct 2023 07:10:50 +0000 (UTC) X-Received: from [10.39.192.114] (unknown [10.39.192.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 458E9140EBB7; Mon, 9 Oct 2023 07:10:49 +0000 (UTC) Message-ID: Date: Mon, 9 Oct 2023 09:10:48 +0200 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v5 07/28] MdeModulePkg: Check Print Level Before Dumping GCD Memory Map To: devel@edk2.groups.io, taylor.d.beebe@gmail.com Cc: Jian J Wang , Liming Gao , Dandan Bi References: <20231009000742.1792-1-taylor.d.beebe@gmail.com> <20231009000742.1792-8-taylor.d.beebe@gmail.com> From: "Laszlo Ersek" In-Reply-To: <20231009000742.1792-8-taylor.d.beebe@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: aLC1Qgqjh8MYDKRPVMyUYUszx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=qGOKSmF8; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 10/9/23 02:07, Taylor Beebe wrote: > When page/pool protections are active, the GCD sync process takes > quite a bit longer than normal. This behavior is primarily due to > a function which dumps the GCD memory map to the console. This > dump function runs only on DEBUG builds but will iterate through > the GCD memory map dozens of times even when the print level doesn't > include DEBUG_GCD. This patch adds a check for the DEBUG_GCD print > level before dumping the GCD memory map which saves several seconds > during boot when page/pool protections are active. >=20 > Signed-off-by: Taylor Beebe > Cc: Jian J Wang > Cc: Liming Gao > Cc: Dandan Bi > --- > MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++++ > MdeModulePkg/Core/Dxe/DxeMain.inf | 1 + > 2 files changed, 5 insertions(+) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/= Gcd.c > index 72bd036eab1e..392586d5b17c 100644 > --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c > @@ -150,6 +150,10 @@ CoreDumpGcdMemorySpaceMap ( > EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap; > UINTN Index; > =20 > + if ((PcdGet32 (PcdDebugPrintErrorLevel) & DEBUG_GCD) =3D=3D 0) { > + return; > + } > + > Status =3D CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMa= p); > ASSERT (Status =3D=3D EFI_SUCCESS && MemorySpaceMap !=3D NULL); > =20 > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/Dx= eMain.inf > index 35d5bf0dee6f..6c896a0e7f0f 100644 > --- a/MdeModulePkg/Core/Dxe/DxeMain.inf > +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf > @@ -187,6 +187,7 @@ [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask = ## CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard = ## CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdFwVolDxeMaxEncapsulationDepth = ## CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel = ## CONSUMES > =20 > # [Hob] > # RESOURCE_DESCRIPTOR ## CONSUMES IMO we could avoid the direct PCD consumption here, and write if (!DebugPrintLevelEnabled (DEBUG_GCD) || ((GetDebugPrintErrorLevel () & DEBUG_GCD) =3D=3D 0)) { return; } In practice, most of the time, the first call will check PcdFixedDebugPrintErrorLevel, and the second call will check PcdDebugPrintErrorLevel. Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109437): https://edk2.groups.io/g/devel/message/109437 Mute This Topic: https://groups.io/mt/101843348/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-