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 7151F74003D for ; Mon, 9 Oct 2023 00:08:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=R8xk3m7anbeOVp8PNNNUC7nZwrub6UFPUjXviHalpEs=; 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=1696810082; v=1; b=MRXm+UDUSj+NBDOTRixh81xmNAcWoJDhFfs3WOi54Nu7TncIhudU9IRUCTds9yKpaqDyCuuv 4klOfzbql6HqlP7m/mZVsJ8l8ccHTW98YnMaHPDtDtcoh8jrhzrwkCRWlu+LZT9Y6BwmDgQlmvR I3mgCYZfCDurUU+Ufc6njCps= X-Received: by 127.0.0.2 with SMTP id OO0KYY7687511xnjY9gEeDBK; Sun, 08 Oct 2023 17:08:02 -0700 X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mx.groups.io with SMTP id smtpd.web10.50216.1696810079636189756 for ; Sun, 08 Oct 2023 17:07:59 -0700 X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso3585645b3a.2 for ; Sun, 08 Oct 2023 17:07:59 -0700 (PDT) X-Gm-Message-State: B3T2BhLXXlUuCP33JrYkhZvrx7686176AA= X-Google-Smtp-Source: AGHT+IE3sARciRlEyuHzRtlIxJgbgqKhpqHSKpC0ENw2KEcWzj8qbVtowue0LAh16TP/HvDZfmSOpA== X-Received: by 2002:a05:6a00:13a9:b0:68c:3f2:5ff7 with SMTP id t41-20020a056a0013a900b0068c03f25ff7mr17527324pfg.1.1696810078822; Sun, 08 Oct 2023 17:07:58 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id t20-20020a62ea14000000b0068fcc7f6b00sm5048320pfh.74.2023.10.08.17.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 17:07:58 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v5 07/28] MdeModulePkg: Check Print Level Before Dumping GCD Memory Map Date: Sun, 8 Oct 2023 17:07:19 -0700 Message-ID: <20231009000742.1792-8-taylor.d.beebe@gmail.com> In-Reply-To: <20231009000742.1792-1-taylor.d.beebe@gmail.com> References: <20231009000742.1792-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=MRXm+UDU; 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.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109412): https://edk2.groups.io/g/devel/message/109412 Mute This Topic: https://groups.io/mt/101843348/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-