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 F37F1740037 for ; Fri, 18 Aug 2023 22:57:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=C05rzM2gEUopRlBvIhgZs8P09/fDmGoAylV1N06YzGk=; 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=1692399474; v=1; b=dMmoj4h8Siw2O9640Y0FqtZ4XZyIIzcsFiP5LRvRDwuxXC2isp3kgjdfKb+yZru4MirnjRn4 gEvgO274i2ErnJkADkZT1sazkpQbPvXh0H+O/5f5Iwl0DBDPXxLtZ+kRB+5peD1wBPhm1R/SEqR +3f0uCv8+RgPAdrR3oaYREFI= X-Received: by 127.0.0.2 with SMTP id 78KMYY7687511xtTe0SVYyKK; Fri, 18 Aug 2023 15:57:54 -0700 X-Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mx.groups.io with SMTP id smtpd.web11.3233.1692397949027930010 for ; Fri, 18 Aug 2023 15:32:29 -0700 X-Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-688779ffcfdso1231706b3a.1 for ; Fri, 18 Aug 2023 15:32:28 -0700 (PDT) X-Gm-Message-State: wwGLOo16MJjh62bQs27Yrl1Bx7686176AA= X-Google-Smtp-Source: AGHT+IGz6u7MKvfDhnsJQMagtgwqJhuHAY1KGNLU3qRib+9xTpIDkjbAXRvRvhsSFSYHqkUWabrOYQ== X-Received: by 2002:a05:6a20:3b89:b0:137:8ddf:464b with SMTP id b9-20020a056a203b8900b001378ddf464bmr526201pzh.36.1692397948124; Fri, 18 Aug 2023 15:32:28 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id 7-20020aa79207000000b0068779015507sm1989330pfo.194.2023.08.18.15.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 15:32:27 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v2 06/25] MdeModulePkg: Check Print Level Before Dumping GCD Memory Map Date: Fri, 18 Aug 2023 15:31:38 -0700 Message-ID: <20230818223159.1073-7-taylor.d.beebe@gmail.com> In-Reply-To: <20230818223159.1073-1-taylor.d.beebe@gmail.com> References: <20230818223159.1073-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=dMmoj4h8; 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.41.0.windows.3 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107861): https://edk2.groups.io/g/devel/message/107861 Mute This Topic: https://groups.io/mt/100830904/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-