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 33E7E74003B for ; Wed, 30 Aug 2023 23:19:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=YrJGTPmQVE2zugLZ7nDD/pgHIdHrvCu+VNKdVDnStOI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1693437550; v=1; b=kkXTEng6wMUmkxWU3sQw1h+BzO2Cm8aJT2d0J0xZOUTFl52biSBSi9w3qH1ggSxxEGeahwsE wJimnJSz60xZFntfLJxrX9Oo9X1udFsT2D+sAmsJ7K9dVfdMmmmo/kLK6q0wsBFrr+DDn7xgm4d 2C1b++AQ0jHMoFYRdHQeT8jA= X-Received: by 127.0.0.2 with SMTP id XEu9YY7687511xVPIEWJtX3y; Wed, 30 Aug 2023 16:19:10 -0700 X-Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mx.groups.io with SMTP id smtpd.web10.4862.1693437548558150291 for ; Wed, 30 Aug 2023 16:19:08 -0700 X-Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-68bed8de5b9so155896b3a.3 for ; Wed, 30 Aug 2023 16:19:08 -0700 (PDT) X-Gm-Message-State: NzBqyoNnSL6K1nCBZhwtr22jx7686176AA= X-Google-Smtp-Source: AGHT+IEM8UnR7LBN7nDUrdB5XXu2513T+ZYe6jX+drv06UdR3Uh8roaopjGhAtPyFP1cwsqcjmYkwQ== X-Received: by 2002:a05:6a00:2193:b0:68a:33fc:a085 with SMTP id h19-20020a056a00219300b0068a33fca085mr3944229pfi.7.1693437547878; Wed, 30 Aug 2023 16:19:07 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id x16-20020a62fb10000000b0064398fe3451sm102550pfm.217.2023.08.30.16.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:19:07 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v3 07/26] MdeModulePkg: Check Print Level Before Dumping GCD Memory Map Date: Wed, 30 Aug 2023 16:18:15 -0700 Message-ID: <20230830231851.779-8-taylor.d.beebe@gmail.com> In-Reply-To: <20230830231851.779-1-taylor.d.beebe@gmail.com> References: <20230830231851.779-1-taylor.d.beebe@gmail.com> MIME-Version: 1.0 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,taylor.d.beebe@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kkXTEng6; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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. 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(+) 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; + if ((PcdGet32 (PcdDebugPrintErrorLevel) & DEBUG_GCD) == 0) { + return; + } + Status = CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap); ASSERT (Status == EFI_SUCCESS && MemorySpaceMap != NULL); diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.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 # [Hob] # RESOURCE_DESCRIPTOR ## CONSUMES -- 2.42.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108161): https://edk2.groups.io/g/devel/message/108161 Mute This Topic: https://groups.io/mt/101064079/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-