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 A194ED806C6 for ; Wed, 20 Sep 2023 00:58:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=EQfSiObaWmatg/N6FssQmSe5v6F8+oNXd0RyIY+Wt+E=; 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=1695171492; v=1; b=EX1lVXGIy1O1/h9KVYcU/AhJ8hU4Q65M010h6E01nLpJqPuIf+QXKYysiyERILQxRFORjzia w/tWZk9vQ81+6VyeFrx8c7t+Am7BGmvqEA2Y/W3ml9J6fpqSACJAeJHpRLoo2zDebOE7pu+KV5y MtNRKy2zZ7qmQPOm7vle1Byw= X-Received: by 127.0.0.2 with SMTP id GruyYY7687511xc5Do14f8SB; Tue, 19 Sep 2023 17:58:12 -0700 X-Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mx.groups.io with SMTP id smtpd.web11.26917.1695171489832550180 for ; Tue, 19 Sep 2023 17:58:09 -0700 X-Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-68fcb4dc8a9so5799749b3a.2 for ; Tue, 19 Sep 2023 17:58:09 -0700 (PDT) X-Gm-Message-State: WJBph0wjFaVQxLt6Alo77GLnx7686176AA= X-Google-Smtp-Source: AGHT+IHkyLVMNkKcx0rBfGxXIsFWwVT8ZBDQ7GRILNdAJBCpKt9/DpgG/ebqavGvqxTyzMNEZWHakg== X-Received: by 2002:a05:6a21:4881:b0:14c:9a61:a310 with SMTP id av1-20020a056a21488100b0014c9a61a310mr991089pzc.24.1695171489216; Tue, 19 Sep 2023 17:58:09 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c24d00b001bb988ac243sm10563576plg.297.2023.09.19.17.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 17:58:08 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v4 07/28] MdeModulePkg: Check Print Level Before Dumping GCD Memory Map Date: Tue, 19 Sep 2023 17:57:30 -0700 Message-ID: <20230920005752.2041-8-taylor.d.beebe@gmail.com> In-Reply-To: <20230920005752.2041-1-taylor.d.beebe@gmail.com> References: <20230920005752.2041-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=EX1lVXGI; 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=gmail.com (policy=none) 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.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108869): https://edk2.groups.io/g/devel/message/108869 Mute This Topic: https://groups.io/mt/101469944/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-