From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106043+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106043+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636814; cv=none; d=zohomail.com; s=zohoarc; b=B0+U8DuF24Z1YlzjuD+awjmlZZ1wynRpVnmUHIcrADMILxZZ4maqyYEnkk5OlaCtEtJ2T42/G+IEqtFskPghzkwELW4YYAleYvwZHTKF26BOAosaPlu8Mk+7slP0Uy1VkiQ8cF0hmBAaaYg2xkWUOE8aLOT/794dLZ+8yrn1hjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636814; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hQipE2ROG4brfUAMGAC5QYsb+RIJ1rfTJy6AIslsWNk=; b=MjVfW5D5vvHdyUm2pFAsXjcbFb/dzM0ml3KHYnzCs52FuPpKL4c0pkChZ5OFPDXh/lBzMcU5TFivBfj5csdCL5YsurEsdJ0pt8m+iMtOMXp2bqcFdZ5VMvNfTMm8rOYbJo94FMMNnUsXwyAjDis83ggToHbbMHnyqW0nImyTbqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106043+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636814296358.6319993039149; Mon, 12 Jun 2023 23:13:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Rm3SYY1788612xrTnMptmkHM; Mon, 12 Jun 2023 23:13:34 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:33 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238163" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238163" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306362" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306362" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:31 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Rahul Kumar , Gerd Hoffmann , Jiaxin Wu , Eric Dong Subject: [edk2-devel] [PATCH V3 1/8] UefiCpuPkg/CpuSmm: Add perf-logging for time-consuming BSP procedures Date: Tue, 13 Jun 2023 14:13:18 +0800 Message-Id: <20230613061325.1664-2-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: 60SiIZAP5kfMlfu4dVAFWCjTx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636814; bh=FAywiZQEt7+p59VP6tINhgrBKC8djuketAi5m+up0y4=; h=Cc:Date:From:Reply-To:Subject:To; b=AJunTFr0ennSQor1eEOiOL2YmYqIqvD1TC/WQWgKJcJNQk44RJTCbvYFbg7YWVUdqWY eWwDny8rlgBwnFJ1C0U9YyyO2Go51CoTiUiVPjgnTE0WwImX6KJwf4ZGrn1HFToC3e0/N HbIXuRjBtbM6IKr/uwPXIhjrDmAarKqJ3zU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636816074100007 Content-Type: text/plain; charset="utf-8" The patch adds perf-logging for the following potential time-consuming BSP procedures: * PiCpuSmmEntry - SmmRelocateBases - ExecuteFirstSmiInit * BSPHandler - SmmWaitForApArrival - PerformRemainingTasks * InitPaging * SetMemMapAttributes * SetUefiMemMapAttributes * SetPageTableAttributes * ConfigSmmCodeAccessCheck * SmmCpuFeaturesCompleteSmmReadyToLock Cc: Rahul Kumar Cc: Gerd Hoffmann Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 8 +++++- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 27 +++++++++++++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + .../PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 13 ++++++--- UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 4 ++- 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index baf827cf9d..fa666bd118 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -351,6 +351,8 @@ SmmWaitForApArrival ( UINT32 DelayedCount; UINT32 BlockedCount; =20 + PERF_FUNCTION_BEGIN (); + DelayedCount =3D 0; BlockedCount =3D 0; =20 @@ -439,7 +441,7 @@ SmmWaitForApArrival ( DEBUG ((DEBUG_INFO, "SmmWaitForApArrival: Delayed AP Count =3D %d, Blo= cked AP Count =3D %d\n", DelayedCount, BlockedCount)); } =20 - return; + PERF_FUNCTION_END (); } =20 /** @@ -577,6 +579,8 @@ BSPHandler ( ASSERT (CpuIndex =3D=3D mSmmMpSyncData->BspIndex); ApCount =3D 0; =20 + PERF_FUNCTION_BEGIN (); + // // Flag BSP's presence // @@ -792,6 +796,8 @@ BSPHandler ( *mSmmMpSyncData->Counter =3D 0; *mSmmMpSyncData->AllCpusInSync =3D FALSE; mSmmMpSyncData->AllApArrivedWithException =3D FALSE; + + PERF_FUNCTION_END (); } =20 /** diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 2144d6ade8..32ca417f73 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -410,12 +410,15 @@ ExecuteFirstSmiInit ( { UINTN Index; =20 + PERF_FUNCTION_BEGIN (); + if (mSmmInitialized =3D=3D NULL) { mSmmInitialized =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * mMaxNu= mberOfCpus); } =20 ASSERT (mSmmInitialized !=3D NULL); if (mSmmInitialized =3D=3D NULL) { + PERF_FUNCTION_END (); return; } =20 @@ -442,6 +445,8 @@ ExecuteFirstSmiInit ( while (!(BOOLEAN)mSmmInitialized[Index]) { } } + + PERF_FUNCTION_END (); } =20 /** @@ -463,6 +468,8 @@ SmmRelocateBases ( UINTN Index; UINTN BspIndex; =20 + PERF_FUNCTION_BEGIN (); + // // Make sure the reserved size is large enough for procedure SmmInitTemp= late. // @@ -540,6 +547,7 @@ SmmRelocateBases ( // CopyMem (CpuStatePtr, &BakBuf2, sizeof (BakBuf2)); CopyMem (U8Ptr, BakBuf, sizeof (BakBuf)); + PERF_FUNCTION_END (); } =20 /** @@ -617,6 +625,8 @@ PiCpuSmmEntry ( GuidHob =3D NULL; SmmBaseHobData =3D NULL; =20 + PERF_FUNCTION_BEGIN (); + // // Initialize address fixup // @@ -1194,6 +1204,7 @@ PiCpuSmmEntry ( =20 DEBUG ((DEBUG_INFO, "SMM CPU Module exit from SMRAM with EFI_SUCCESS\n")= ); =20 + PERF_FUNCTION_END (); return EFI_SUCCESS; } =20 @@ -1348,12 +1359,15 @@ ConfigSmmCodeAccessCheck ( UINTN Index; EFI_STATUS Status; =20 + PERF_FUNCTION_BEGIN (); + // // Check to see if the Feature Control MSR is supported on this CPU // Index =3D gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu; if (!SmmCpuFeaturesIsSmmRegisterSupported (Index, SmmRegFeatureControl))= { mSmmCodeAccessCheckEnable =3D FALSE; + PERF_FUNCTION_END (); return; } =20 @@ -1363,6 +1377,7 @@ ConfigSmmCodeAccessCheck ( // if ((AsmReadMsr64 (EFI_MSR_SMM_MCA_CAP) & SMM_CODE_ACCESS_CHK_BIT) =3D= =3D 0) { mSmmCodeAccessCheckEnable =3D FALSE; + PERF_FUNCTION_END (); return; } =20 @@ -1419,6 +1434,8 @@ ConfigSmmCodeAccessCheck ( ReleaseSpinLock (mConfigSmmCodeAccessCheckLock); } } + + PERF_FUNCTION_END (); } =20 /** @@ -1540,6 +1557,8 @@ PerformRemainingTasks ( ) { if (mSmmReadyToLock) { + PERF_FUNCTION_BEGIN (); + // // Check if all Aps enter SMM. In Relaxed-AP Sync Mode, BSP will not w= ait for // all Aps arrive. However,PerformRemainingTasks() needs to wait all A= ps arrive before calling @@ -1587,12 +1606,20 @@ PerformRemainingTasks ( // ConfigSmmCodeAccessCheck (); =20 + // + // Measure performance of SmmCpuFeaturesCompleteSmmReadyToLock() from = caller side + // as the implementation is provided by platform. + // + PERF_START (NULL, "SmmCompleteReadyToLock", NULL, 0); SmmCpuFeaturesCompleteSmmReadyToLock (); + PERF_END (NULL, "SmmCompleteReadyToLock", NULL, 0); =20 // // Clean SMM ready to lock flag // mSmmReadyToLock =3D FALSE; + + PERF_FUNCTION_END (); } } =20 diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h index a5c2bdd971..b03f2ef882 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -50,6 +50,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include #include diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index 158e05e264..af66a1941c 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -97,6 +97,7 @@ ReportStatusCodeLib SmmCpuFeaturesLib PeCoffGetEntryPointLib + PerformanceLib =20 [Protocols] gEfiSmmAccess2ProtocolGuid ## CONSUMES diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPk= g/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index 834a756061..8b21e16f1c 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1,6 +1,6 @@ /** @file =20 -Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1100,6 +1100,8 @@ SetMemMapAttributes ( return; } =20 + PERF_FUNCTION_BEGIN (); + DEBUG ((DEBUG_INFO, "MemoryAttributesTable:\n")); DEBUG ((DEBUG_INFO, " Version - 0x%08x\n", MemoryAttr= ibutesTable->Version)); DEBUG ((DEBUG_INFO, " NumberOfEntries - 0x%08x\n", MemoryAttr= ibutesTable->NumberOfEntries)); @@ -1152,7 +1154,7 @@ SetMemMapAttributes ( PatchSmmSaveStateMap (); PatchGdtIdtMap (); =20 - return; + PERF_FUNCTION_END (); } =20 /** @@ -1454,6 +1456,8 @@ SetUefiMemMapAttributes ( UINTN Index; EFI_MEMORY_DESCRIPTOR *Entry; =20 + PERF_FUNCTION_BEGIN (); + DEBUG ((DEBUG_INFO, "SetUefiMemMapAttributes\n")); =20 if (mUefiMemoryMap !=3D NULL) { @@ -1537,6 +1541,8 @@ SetUefiMemMapAttributes ( // // Do not free mUefiMemoryAttributesTable, it will be checked in IsSmmCo= mmBufferForbiddenAddress(). // + + PERF_FUNCTION_END (); } =20 /** @@ -1862,6 +1868,7 @@ SetPageTableAttributes ( return; } =20 + PERF_FUNCTION_BEGIN (); DEBUG ((DEBUG_INFO, "SetPageTableAttributes\n")); =20 // @@ -1900,5 +1907,5 @@ SetPageTableAttributes ( EnableCet (); } =20 - return; + PERF_FUNCTION_END (); } diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDx= eSmm/SmmProfile.c index 1b0b6673e1..ed6e58065f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -575,6 +575,8 @@ InitPaging ( IA32_CR4 Cr4; BOOLEAN Enable5LevelPaging; =20 + PERF_FUNCTION_BEGIN (); + Cr4.UintN =3D AsmReadCr4 (); Enable5LevelPaging =3D (BOOLEAN)(Cr4.Bits.LA57 =3D=3D 1); =20 @@ -810,7 +812,7 @@ InitPaging ( // mXdEnabled =3D TRUE; =20 - return; + PERF_FUNCTION_END (); } =20 /** --=20 2.39.1.windows.1 -=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 (#106043): https://edk2.groups.io/g/devel/message/106043 Mute This Topic: https://groups.io/mt/99500177/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106044+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106044+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636817; cv=none; d=zohomail.com; s=zohoarc; b=E3g3RXOi1HrjEQ8JO4XQokizletNdsntoA/brirHz3MkzI5pD3MOaKbT93JKodWlUDUJFrMTeScwO2YPGiRcGeSrNYJ0/qDI+noapY50jwpwa8K/QtlNmXDkUuBsP9F5OPg1OZKVMugfZRz/dtwHu9xoVadc5zZVDMiUTIuBpn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636817; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=2BtxQp/BsA2yKTMAKQOeY9ljOTbIEL0Z2fBc4rnxE/4=; b=Pt8989BLjqSPngWoHr/MQTkyxV+xNrF+mgK1PzLd0ac6zYhJas+bK1AgAIECLJsMyQHa6aQvyx6ZlnZq3xAPTlc+ogv2sCg1dh4ELPfJ+SaEBpMI+wu8xT6AunfQb4jbvjEBDxhwwhbxnnmq0Aj2FIoQ0iWumW9rZP4jmJSMUUQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106044+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636816923462.51862200953906; Mon, 12 Jun 2023 23:13:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id O2hxYY1788612xrqMxyQk6tb; Mon, 12 Jun 2023 23:13:36 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:36 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238197" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238197" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306369" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306369" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:33 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar , Gerd Hoffmann , Jiaxin Wu Subject: [edk2-devel] [PATCH V3 2/8] UefiCpuPkg/CpuSmm: Add perf-logging for MP procedures Date: Tue, 13 Jun 2023 14:13:19 +0800 Message-Id: <20230613061325.1664-3-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: UK9orhK2MuS37uT53PgNjT09x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636816; bh=TMuO6nUXkWvpV45ctuIxtu9FcjubUrLw1ha2CONIBqs=; h=Cc:Date:From:Reply-To:Subject:To; b=rfwYG+Felt6wiamhJi2KHqrZnlJk3nam5KEr27iCoSJPYWhRG/Z3QAFnS2HfHv65KJG adIAvLviRGyTjWLaWk2Z9VjEC33LZWOO11EZSO3gNVvfa6WJPJ0r7T1WH3jM8FrzkZW2y 3KC/+pkZs0llCSPm5uxzq0KGgOKHL7tPet0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636818064100009 Content-Type: text/plain; charset="utf-8" MP procedures are those procedures that run in every CPU thread. The EDKII perf infra is not MP safe so it doesn't support to be called from those MP procedures. The patch adds SMM MP perf-logging support in SmmMpPerf.c. The following procedures are perf-logged: * SmmInitHandler * SmmCpuFeaturesRendezvousEntry * PlatformValidSmi * SmmCpuFeaturesRendezvousExit Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 34 ++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 11 +++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 2 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c | 91 ++++++++++++++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 81 +++++++++++++++++ 6 files changed, 220 insertions(+) create mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c create mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index fa666bd118..bcd90f0671 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -778,6 +778,15 @@ BSPHandler ( // WaitForAllAPs (ApCount); =20 + // + // At this point, all APs should have exited from APHandler(). + // Migrate the SMM MP performance logging to standard SMM performance lo= gging. + // Any SMM MP performance logging after this point will be migrated in n= ext SMI. + // + PERF_CODE ( + MigrateMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus); + ); + // // Reset the tokens buffer. // @@ -1769,12 +1778,24 @@ SmiRendezvous ( // // Perform CPU specific entry hooks // + PERF_CODE ( + MpPerfBegin (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (SmmRendezvousEntry)); + ); SmmCpuFeaturesRendezvousEntry (CpuIndex); + PERF_CODE ( + MpPerfEnd (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (SmmRendezvousEntry)); + ); =20 // // Determine if this is a valid SMI // + PERF_CODE ( + MpPerfBegin (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (PlatformValidSmi)); + ); ValidSmi =3D PlatformValidSmi (); + PERF_CODE ( + MpPerfEnd (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (PlatformValidSmi)); + ); =20 // // Determine if BSP has been already in progress. Note this must be chec= ked after @@ -1904,7 +1925,20 @@ SmiRendezvous ( } =20 Exit: + // + // Note: SmmRendezvousExit perf-logging entry is the only one that will = be + // migrated to standard perf-logging database in next SMI by BSPHa= ndler(). + // Hence, the number of SmmRendezvousEntry entries will be larger = than + // the number of SmmRendezvousExit entries. Delta equals to the nu= mber + // of CPU threads. + // + PERF_CODE ( + MpPerfBegin (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (SmmRendezvousExit)); + ); SmmCpuFeaturesRendezvousExit (CpuIndex); + PERF_CODE ( + MpPerfEnd (CpuIndex, SMM_MP_PERF_PROCEDURE_ID (SmmRendezvousExit)); + ); =20 // // Restore Cr2 diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 32ca417f73..7a3ed3022d 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -362,6 +362,9 @@ SmmInitHandler ( =20 for (Index =3D 0; Index < mNumberOfCpus; Index++) { if (ApicId =3D=3D (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].Process= orId) { + PERF_CODE ( + MpPerfBegin (Index, SMM_MP_PERF_PROCEDURE_ID (SmmInitHandler)); + ); // // Initialize SMM specific features on the currently executing CPU // @@ -392,6 +395,10 @@ SmmInitHandler ( SemaphoreHook (Index, &mRebased[Index]); } =20 + PERF_CODE ( + MpPerfEnd (Index, SMM_MP_PERF_PROCEDURE_ID (SmmInitHandler)); + ); + return; } } @@ -699,6 +706,10 @@ PiCpuSmmEntry ( =20 gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus =3D mMaxNumberOfCpus; =20 + PERF_CODE ( + InitializeMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus); + ); + // // The CPU save state and code for the SMI entry point are tiled within = an SMRAM // allocated buffer. The minimum size of this buffer for a uniprocessor= system diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h index b03f2ef882..1876a27cae 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -60,6 +60,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include "CpuService.h" #include "SmmProfile.h" +#include "SmmMpPerf.h" =20 // // CET definition diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index af66a1941c..4864532c35 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -42,6 +42,8 @@ SmmCpuMemoryManagement.c SmmMp.h SmmMp.c + SmmMpPerf.h + SmmMpPerf.c =20 [Sources.Ia32] Ia32/Semaphore.c diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.c new file mode 100644 index 0000000000..c13556af46 --- /dev/null +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c @@ -0,0 +1,91 @@ +/** @file +SMM MP perf-logging implementation + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PiSmmCpuDxeSmm.h" + + +#define SMM_MP_PERF_PROCEDURE_NAME(procedure) # procedure +GLOBAL_REMOVE_IF_UNREFERENCED +CHAR8 *gSmmMpPerfProcedureName[] =3D { + SMM_MP_PERF_PROCEDURE_LIST (SMM_MP_PERF_PROCEDURE_NAME) +}; +// +// Each element holds the performance data for one processor. +// +GLOBAL_REMOVE_IF_UNREFERENCED +SMM_PERF_AP_PROCEDURE_PERFORMANCE *mSmmMpProcedurePerformance =3D NULL; + +/** + Initialize the perf-logging feature for APs. + + @param NumberofCpus Number of processors in the platform. +**/ +VOID +InitializeMpPerf ( + UINTN NumberofCpus + ) +{ + mSmmMpProcedurePerformance =3D AllocateZeroPool (NumberofCpus * sizeof (= *mSmmMpProcedurePerformance)); + ASSERT (mSmmMpProcedurePerformance !=3D NULL); +} + +/** + Migrate MP performance data to standardized performance database. + + @param NumberofCpus Number of processors in the platform. +**/ +VOID +MigrateMpPerf ( + UINTN NumberofCpus + ) +{ + UINTN CpuIndex; + UINTN MpProcecureId; + + for (CpuIndex =3D 0; CpuIndex < NumberofCpus; CpuIndex++) { + for (MpProcecureId =3D 0; MpProcecureId < SMM_MP_PERF_PROCEDURE_ID (Sm= mMpProcedureMax); MpProcecureId++) { + if (mSmmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId] !=3D 0= ) { + PERF_START (NULL, gSmmMpPerfProcedureName[MpProcecureId], NULL, mS= mmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId]); + PERF_END (NULL, gSmmMpPerfProcedureName[MpProcecureId], NULL, mSmm= MpProcedurePerformance[CpuIndex].End[MpProcecureId]); + } + } + } + + ZeroMem (mSmmMpProcedurePerformance, NumberofCpus * sizeof (*mSmmMpProce= durePerformance)); +} + +/** + Save the performance counter value before running the MP procedure. + + @param CpuIndex The index of the CPU. + @param MpProcedureId The ID of the MP procedure. +**/ +VOID +MpPerfBegin ( + IN UINTN CpuIndex, + IN UINTN MpProcedureId + ) +{ + mSmmMpProcedurePerformance[CpuIndex].Begin[MpProcedureId] =3D GetPerform= anceCounter (); +} + +/** + Save the performance counter value after running the MP procedure. + + @param CpuIndex The index of the CPU. + @param MpProcedureId The ID of the MP procedure. +**/ +VOID +MpPerfEnd ( + IN UINTN CpuIndex, + IN UINTN MpProcedureId + ) +{ + mSmmMpProcedurePerformance[CpuIndex].End[MpProcedureId] =3D GetPerforman= ceCounter (); +} diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.h new file mode 100644 index 0000000000..eeafb242f9 --- /dev/null +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h @@ -0,0 +1,81 @@ +/** @file +SMM MP perf-logging implementation + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MP_PERF_H_ +#define _MP_PERF_H_ + +// +// The list of all MP procedures that need to be perf-logged. +// +#define SMM_MP_PERF_PROCEDURE_LIST(_) \ + _(SmmInitHandler), \ + _(SmmRendezvousEntry), \ + _(PlatformValidSmi), \ + _(SmmRendezvousExit), \ + _(SmmMpProcedureMax) // Add new entries above this line + +// +// To perf-log MP procedures, call MpPerfBegin()/MpPerfEnd() with CpuIndex +// and SMM_MP_PERF_PROCEDURE_ID with entry name defined in the SMM_MP_PERF= _PROCEDURE_LIST. +// +#define SMM_MP_PERF_PROCEDURE_ID(procedure) SmmMpProcedureId ## procedure +enum { + SMM_MP_PERF_PROCEDURE_LIST (SMM_MP_PERF_PROCEDURE_ID) +}; + +typedef struct { + UINT64 Begin[SMM_MP_PERF_PROCEDURE_ID (SmmMpProcedureMax)]; + UINT64 End[SMM_MP_PERF_PROCEDURE_ID (SmmMpProcedureMax)]; +} SMM_PERF_AP_PROCEDURE_PERFORMANCE; + +/** + Initialize the perf-logging feature for APs. + + @param NumberofCpus Number of processors in the platform. +**/ +VOID +InitializeMpPerf ( + UINTN NumberofCpus + ); + +/** + Migrate MP performance data to standardized performance database. + + @param NumberofCpus Number of processors in the platform. +**/ +VOID +MigrateMpPerf ( + UINTN NumberofCpus + ); + +/** + Save the performance counter value before running the MP procedure. + + @param CpuIndex The index of the CPU. + @param MpProcedureId The ID of the MP procedure. +**/ +VOID +MpPerfBegin ( + IN UINTN CpuIndex, + IN UINTN MpProcedureId + ); + +/** + Save the performance counter value after running the MP procedure. + + @param CpuIndex The index of the CPU. + @param MpProcedureId The ID of the MP procedure. +**/ +VOID +MpPerfEnd ( + IN UINTN CpuIndex, + IN UINTN MpProcedureId + ); + +#endif --=20 2.39.1.windows.1 -=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 (#106044): https://edk2.groups.io/g/devel/message/106044 Mute This Topic: https://groups.io/mt/99500180/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106045+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106045+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636818; cv=none; d=zohomail.com; s=zohoarc; b=JDaorc7XTNwicO2cL4AFq4efCRWlHWEbaUiUkNZ0SZZWqnNI6sgq3I3Co8Tri3zJzuyBzBYrKubZPKtPL/9pFWTFReDlPYjhtYPjOzp8ngRWWtdRKJAlUCmYpeGZA7jb4J3MPN8rKNBrOb+iIumaALUYsGcKnx9ZLKKjrZeBrOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636818; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=WsVD328jdFyJZb70IpcIyZnsSZomv0p0meQW7o8zW6I=; b=g2dUC8SMRu8k2uhHk6i2RjaXxw9KBNlx3pcbC8VgTqZryJe+aij/hTkk4NlH6YkcoogjxRUHbvC+vh6u6jlJmKMjY8X+0gyBuPPP73fGGoONyjIA/EapUP+ckw3xARG6AqF888/ahMQ67jgYZ1MhTOkHOGF9kt3jn/fiN6r2c2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106045+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636818708654.2469788721169; Mon, 12 Jun 2023 23:13:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id igtaYY1788612xVAtRHfLBBV; Mon, 12 Jun 2023 23:13:38 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:37 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238214" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238214" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306372" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306372" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:35 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Jiaxin Wu , Eric Dong Subject: [edk2-devel] [PATCH V3 3/8] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures Date: Tue, 13 Jun 2023 14:13:20 +0800 Message-Id: <20230613061325.1664-4-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: SInscbjldZlIMHXA6EySpiiXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636818; bh=fzZqXtOsFjl0QdzqFSt0h1DG609YTETVbPL68zcsgO4=; h=Cc:Date:From:Reply-To:Subject:To; b=Mv9Op7ycOGLqcgR367kzm5djqVdvOLGtYlknL3m/Q+24sG/AJbtdkduKyC011dWl4Ed PfUoNElghlYzxRL1K18rEI1CmcZ4X97AnTWFgK8tQTfodIhP9tsMoVwFra6yMhrfHMwzR SC06tVxaJrt5pJNLSQANTKJUkyVf/kHwXLE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636820097100013 Content-Type: text/plain; charset="utf-8" Following procedures are perf-logged: * SmmReadyToBootHandler * SmmReadyToLockHandler * SmmEndOfDxeHandler * SmmEntryPoint (It's the main routine run in BSP when SMI happens.) * SmiManage Cc: Jian J Wang Cc: Liming Gao Cc: Jiaxin Wu Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong Reviewed-by: Jian J Wang --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 15 ++++++++++++++- MdeModulePkg/Core/PiSmmCore/Smi.c | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index 875c7c0258..68af9ab81b 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -1,7 +1,7 @@ /** @file SMM Core Main Entry Point =20 - Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -305,6 +305,8 @@ SmmReadyToBootHandler ( EFI_STATUS Status; EFI_HANDLE SmmHandle; =20 + PERF_CALLBACK_BEGIN (&gEfiEventReadyToBootGuid); + // // Install SMM Ready To Boot protocol. // @@ -318,6 +320,7 @@ SmmReadyToBootHandler ( =20 SmiHandlerUnRegister (DispatchHandle); =20 + PERF_CALLBACK_END (&gEfiEventReadyToBootGuid); return Status; } =20 @@ -352,6 +355,8 @@ SmmReadyToLockHandler ( EFI_HANDLE SmmHandle; VOID *Interface; =20 + PERF_CALLBACK_BEGIN (&gEfiDxeSmmReadyToLockProtocolGuid); + // // Unregister SMI Handlers that are no required after the SMM driver dis= patch is stopped // @@ -408,6 +413,7 @@ SmmReadyToLockHandler ( =20 SmramProfileReadyToLock (); =20 + PERF_CALLBACK_END (&gEfiDxeSmmReadyToLockProtocolGuid); return Status; } =20 @@ -442,6 +448,8 @@ SmmEndOfDxeHandler ( =20 DEBUG ((DEBUG_INFO, "SmmEndOfDxeHandler\n")); =20 + PERF_CALLBACK_BEGIN (&gEfiEndOfDxeEventGroupGuid); + // // Install SMM EndOfDxe protocol // @@ -479,6 +487,7 @@ SmmEndOfDxeHandler ( } } =20 + PERF_CALLBACK_END (&gEfiEndOfDxeEventGroupGuid); return EFI_SUCCESS; } =20 @@ -669,6 +678,8 @@ SmmEntryPoint ( VOID *CommunicationBuffer; UINTN BufferSize; =20 + PERF_FUNCTION_BEGIN (); + // // Update SMST with contents of the SmmEntryContext structure // @@ -769,6 +780,8 @@ SmmEntryPoint ( // gSmmCorePrivate->InSmm =3D FALSE; } + + PERF_FUNCTION_END (); } =20 /** diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCor= e/Smi.c index 6d13969979..2985f989c3 100644 --- a/MdeModulePkg/Core/PiSmmCore/Smi.c +++ b/MdeModulePkg/Core/PiSmmCore/Smi.c @@ -109,6 +109,8 @@ SmiManage ( BOOLEAN SuccessReturn; EFI_STATUS Status; =20 + PERF_FUNCTION_BEGIN (); + Status =3D EFI_NOT_FOUND; SuccessReturn =3D FALSE; if (HandlerType =3D=3D NULL) { @@ -125,6 +127,7 @@ SmiManage ( // // There is no handler registered for this interrupt source // + PERF_FUNCTION_END (); return Status; } } @@ -148,6 +151,7 @@ SmiManage ( // no additional handlers will be processed and EFI_INTERRUPT_PEND= ING will be returned. // if (HandlerType !=3D NULL) { + PERF_FUNCTION_END (); return EFI_INTERRUPT_PENDING; } =20 @@ -160,6 +164,7 @@ SmiManage ( // additional handlers will be processed. // if (HandlerType !=3D NULL) { + PERF_FUNCTION_END (); return EFI_SUCCESS; } =20 @@ -194,6 +199,7 @@ SmiManage ( Status =3D EFI_SUCCESS; } =20 + PERF_FUNCTION_END (); return Status; } =20 --=20 2.39.1.windows.1 -=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 (#106045): https://edk2.groups.io/g/devel/message/106045 Mute This Topic: https://groups.io/mt/99500181/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106046+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106046+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636821; cv=none; d=zohomail.com; s=zohoarc; b=ngtpyhIweDKn3VM3z5AMSFhIbb+rgTMa+6ECnudoaDIBQt7CMEIBT+MeJ3RIgC3Dd8NUUVWesPbNxDUwKtvOvssCtrCc4V14mhSay6R/0oC3Jp/uGxen9zi8KuRCos/yduZQkfY5NNN6z4KY+CNgyjn53pmubkxn4TWYm/bCG18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636821; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9NGtWBbpi7Z1AQ0dBDP9vLH+7+32hI2wpyg/khjWSKY=; b=WFzQs7Eu9QgizCZFg7twWdckIenL8UXppZAAf4pwWORLUcHQhJSOmXQjQmUaimaehLKicmTKNxyh7hf88Gt2ICl6VZLYD4S1MZVYLju+n5l9LsL2Wdkj4wpBJNftlDYiglOX33hG7JHJQq4hG2KQQLy7kX83XjjJchc40rtRaD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106046+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636821087633.8957424342882; Mon, 12 Jun 2023 23:13:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id K1AmYY1788612xsZTwXMQVrV; Mon, 12 Jun 2023 23:13:40 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:40 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238237" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238237" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306377" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306377" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:38 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Jiaxin Wu , Eric Dong Subject: [edk2-devel] [PATCH V3 4/8] MdeModulePkg/SmmCore: Add perf-logging for SmmDriverDispatchHandler Date: Tue, 13 Jun 2023 14:13:21 +0800 Message-Id: <20230613061325.1664-5-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: xiBNcd57FbdwHknxYx4RzLqyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636820; bh=3ECl1vFyiBeInuyzafH2DtLLnxHBOyQEfRaauO9fH5Y=; h=Cc:Date:From:Reply-To:Subject:To; b=UPQEnZWO3Phhv7CAQnDgLBlEDl0KI05wGOCnMzNGiVlgLJdJY1vY3lgSbiiiJNPhke9 NWt0/3gy/Fvl+tqq8GexXCvs56Zh0LaCcOAZF44s8ajXykNH0oMMU4MIQ476AgrOOQIQN jelaUay0wHkd3H8Yv5BmiNkEFI2mlqLY8SU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636821381100017 Content-Type: text/plain; charset="utf-8" SmmDriverDispatchHandler is the routine that dispatches SMM drivers from FV. It's a time-consuming routine. Add perf-logging for this routine. Signed-off-by: Ray Ni Cc: Jian J Wang Cc: Liming Gao Cc: Jiaxin Wu Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong Reviewed-by: Jian J Wang --- MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/P= iSmmCore/Dispatcher.c index f635565dd1..bb789e5890 100644 --- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c +++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c @@ -28,7 +28,7 @@ Depex - Dependency Expression. =20 Copyright (c) 2014, Hewlett-Packard Development Company, L.P. - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1322,6 +1322,8 @@ SmmDriverDispatchHandler ( return EFI_NOT_FOUND; } =20 + PERF_CALLBACK_BEGIN (&gEfiEventDxeDispatchGuid); + for (HandleIndex =3D 0; HandleIndex < HandleCount; HandleIndex++) { FvHandle =3D HandleBuffer[HandleIndex]; =20 @@ -1511,6 +1513,7 @@ SmmDriverDispatchHandler ( } } =20 + PERF_CALLBACK_END (&gEfiEventDxeDispatchGuid); return EFI_SUCCESS; } =20 --=20 2.39.1.windows.1 -=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 (#106046): https://edk2.groups.io/g/devel/message/106046 Mute This Topic: https://groups.io/mt/99500185/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106047+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106047+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636823; cv=none; d=zohomail.com; s=zohoarc; b=juHedK5mRgNNDPsRIMo7YKdvOAjXOrjmgYHNXDupTVVDCImGkmQr89oV8U67xTu9lE2eyKZaUMuoKP6gNmRcKHbgHYP6wVo1oV9791WaTuUQdS9uACiKezW97wQggePdi4bZOGudoX2DGsKIty4bcB9up5Bfk0TrbUUxkLSfsQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636823; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=g1aEeUgIncNMDwQ3x0HHJMcpo6HUlswYlOOhOcPV+1s=; b=NWol3Lq46wUEHqv6sWGdNcn3OWQ73q8eOsJr96q+1IVminUyMNDPCcaA/CX6f4cTg4cyPLlBE7pqG+QxBH/Ui+I/4jkxMG2gh920GJNwGbKPoPGwinGCgTFc6Xu6DamiVB1K2eW0oADil7wTZJle7LzYuQTNzT6zumTHUXL1YHs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106047+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636823834202.17726326192326; Mon, 12 Jun 2023 23:13:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yepcYY1788612xrnTBSYL2Hg; Mon, 12 Jun 2023 23:13:43 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:42 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238268" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238268" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306383" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306383" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:40 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jiaxin Wu , Dandan Bi , Liming Gao , Jian J Wang , Eric Dong Subject: [edk2-devel] [PATCH V3 5/8] MdeModulePkg/SmmPerformanceLib: Disable perf-logging after ExitBS Date: Tue, 13 Jun 2023 14:13:22 +0800 Message-Id: <20230613061325.1664-6-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: DPxK6TxgAiSQ3octbhkQeLPPx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636823; bh=uihcro1kia6zWahjSfpkqqPcnea9IZsqwmIY7bWqjAo=; h=Cc:Date:From:Reply-To:Subject:To; b=Qg3ctQaOYRuaKFYONpr70zzQPql9QvUyIUcbgfwHU6ftCkOm5zfQ2Nbc9F9AFMFDhl7 b8q7S7amNeUGTYX4Ny56alFW8zWHoiT6gMIiCnBbf6+qB3YO+v9Y/qPX4oheknqoNmC/2 7SMm5hNa5Jg2gcVLcSylpQ7NGJ25xMgqqis= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636824096100022 Content-Type: text/plain; charset="utf-8" Because SMM perf-logging is migrated to non-SMRAM at ReadyToBoot by DxeCorePerformanceLib, the perf-logging after ExitBS is useless and impact the SMI latency at runtime. Hence the SmmPerformanceLib is updated to disable perf-logging after ExitBS. Cc: Jiaxin Wu Cc: Dandan Bi Cc: Liming Gao Cc: Jian J Wang Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong Reviewed-by: Jian J Wang --- .../SmmPerformanceLib/SmmPerformanceLib.c | 63 ++++++++++++++++++- .../SmmPerformanceLib/SmmPerformanceLib.inf | 4 ++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c b/M= deModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c index 623f8a978c..b9c33c0f64 100644 --- a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c +++ b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c @@ -23,6 +23,36 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // The cached SMM Performance Protocol and SMM PerformanceEx Protocol inte= rface. EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *mPerformanceMeasurement =3D NULL; BOOLEAN mPerformanceMeasurementEnabled; +VOID *mPerformanceLibExitBootServicesRe= gistration; + +/** + This is the Event call back function is triggered in SMM to notify the L= ibrary + the system is entering runtime phase. + + @param[in] Protocol Points to the protocol's unique identifier + @param[in] Interface Points to the interface instance + @param[in] Handle The handle on which the interface was installed + + @retval EFI_SUCCESS SmmAtRuntimeCallBack runs successfully + **/ +EFI_STATUS +EFIAPI +SmmPerformanceLibExitBootServicesCallback ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + // + // Disable performance measurement after ExitBootServices because + // 1. Performance measurement might impact SMI latency at runtime; + // 2. Performance log is copied to non SMRAM at ReadyToBoot so runtime p= erformance + // log is not useful. + // + mPerformanceMeasurementEnabled =3D FALSE; + + return EFI_SUCCESS; +} =20 /** The constructor function initializes the Performance Measurement Enable = flag @@ -40,9 +70,40 @@ SmmPerformanceLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status; + mPerformanceMeasurementEnabled =3D (BOOLEAN)((PcdGet8 (PcdPerformanceLi= braryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) !=3D= 0); =20 - return EFI_SUCCESS; + Status =3D gSmst->SmmRegisterProtocolNotify ( + &gEdkiiSmmExitBootServicesProtocolGuid, + SmmPerformanceLibExitBootServicesCallback, + &mPerformanceLibExitBootServicesRegistration + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +EFI_STATUS +EFIAPI +SmmPerformanceLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Unregister SmmExitBootServices notification. + // + Status =3D gSmst->SmmRegisterProtocolNotify ( + &gEdkiiSmmExitBootServicesProtocolGuid, + NULL, + &mPerformanceLibExitBootServicesRegistration + ); + ASSERT_EFI_ERROR (Status); + + return Status; } =20 /** diff --git a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf b= /MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf index d79cd5c8da..002462f5ca 100644 --- a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf +++ b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf @@ -21,6 +21,7 @@ LIBRARY_CLASS =3D PerformanceLib|DXE_SMM_DRIVER =20 CONSTRUCTOR =3D SmmPerformanceLibConstructor + DESTRUCTOR =3D SmmPerformanceLibDestructor =20 # # The following information is for reference only and not required by the = build tools. @@ -46,5 +47,8 @@ [Guids] gEdkiiSmmPerformanceMeasurementProtocolGuid ## SOMETIMES_CONSUM= ES ## UNDEFINED # Locate protocol =20 +[Protocols] + gEdkiiSmmExitBootServicesProtocolGuid ## CONSUMES + [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES --=20 2.39.1.windows.1 -=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 (#106047): https://edk2.groups.io/g/devel/message/106047 Mute This Topic: https://groups.io/mt/99500186/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106048+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106048+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636826; cv=none; d=zohomail.com; s=zohoarc; b=fqzrgzOCV6hxIYJsZwboDgrePQdtqz9AzBsoMjAC+HoAZZLy8Mpza+vuKVuOLI8U9P93ioWVHZ2VjxpcsD7Cqcj1K2xqAJ/fxbSW+/QYNxae3YckktcbB5k2rYRWYRL740kMOa8xFTncOVJETRYKaeJFRSFmfjUq9A8Q8Xyf8Yw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636826; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=t6rXJ8BKNepA2h4ZFjRB5i0OJbTAYLKU5E5x+VzFLt4=; b=eeU5BKp+GulOAG3hMYQtMd1IfhL8NjQprITwznzFEgi3bofZOx4qIfkIRdXbt3j+0BAN2LWfICVd+ZNJ7P+zvVYpj9siHkzfcgPjUceOhNSROktbmd+28g0T3v8FKugnUc1yB+AOKc8JsM8cMTKyWRZ6sJcTdRjXtT+MKKdMJog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106048+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 168663682629912.620774677392319; Mon, 12 Jun 2023 23:13:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Pjv3YY1788612x5Ku8JopKuQ; Mon, 12 Jun 2023 23:13:45 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:45 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238285" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238285" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306390" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306390" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:42 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jiaxin Wu , Dandan Bi , Liming Gao , Jian J Wang , Eric Dong Subject: [edk2-devel] [PATCH V3 6/8] MdeModulePkg/SmmCorePerformanceLib: Disable perf-logging at runtime Date: Tue, 13 Jun 2023 14:13:23 +0800 Message-Id: <20230613061325.1664-7-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: SUECIp3azE1CZ65Dg9P3Wukpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636825; bh=Tjg4juyS2VKL10i81f+EmUF89ISoKmKdUQdiawITdcM=; h=Cc:Date:From:Reply-To:Subject:To; b=CWxwqfrWFR3Fs20kC+9qtRTupb8rGslMTe9bTaot0zHahInRvEKcaG/YGgKl2ik56Vm IwbMLl2lIfRii05sck+MAFqB91CGEtssekedbPzXm2IQy0ZP+KrCsKccK+BAk6sJPTgtb vbuxLP0f+nNeVtIxVXig8TKbxTjHaAp7Ggg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636828096100003 Content-Type: text/plain; charset="utf-8" Because SMM perf-logging is migrated to non-SMRAM at ReadyToBoot by DxeCorePerformanceLib, the perf-logging after ExitBS is useless and impact the SMI latency at runtime. Hence the SmmCorePerformanceLib is updated to disable perf-logging after ExitBS. Cc: Jiaxin Wu Cc: Dandan Bi Cc: Liming Gao Cc: Jian J Wang Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong Reviewed-by: Jian J Wang --- .../SmmCorePerformanceLib.c | 48 ++++++++++++++++++- .../SmmCorePerformanceLib.inf | 3 +- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c index 3efe56e056..c566a298dd 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -16,7 +16,7 @@ =20 SmmPerformanceHandlerEx(), SmmPerformanceHandler() will receive untrusted= input and do basic validation. =20 -Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -48,6 +48,7 @@ SPIN_LOCK mSmmFpdtLock; PERFORMANCE_PROPERTY mPerformanceProperty; UINT32 mCachedLength =3D 0; UINT32 mBootRecordSize =3D 0; +BOOLEAN mPerformanceMeasurementEnabled; =20 // // Interfaces for SMM PerformanceMeasurement Protocol. @@ -929,6 +930,36 @@ FpdtSmiHandler ( return EFI_SUCCESS; } =20 +/** + This is the Event call back function is triggered in SMM to notify the L= ibrary + the system is entering runtime phase. + + @param[in] Protocol Points to the protocol's unique identifier + @param[in] Interface Points to the interface instance + @param[in] Handle The handle on which the interface was installed + + @retval EFI_SUCCESS SmmAtRuntimeCallBack runs successfully + **/ +EFI_STATUS +EFIAPI +SmmCorePerformanceLibExitBootServicesCallback ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + // + // Disable performance measurement after ExitBootServices because + // 1. Performance measurement might impact SMI latency at runtime; + // 2. Performance log is copied to non SMRAM at ReadyToBoot so runtime p= erformance + // log is not useful. + // + mPerformanceMeasurementEnabled =3D FALSE; + + return EFI_SUCCESS; +} + + /** SmmBase2 protocol notify callback function, when SMST and SMM memory ser= vice get initialized this function is callbacked to initialize the Smm Performance Lib @@ -948,6 +979,7 @@ InitializeSmmCorePerformanceLib ( EFI_HANDLE SmiHandle; EFI_STATUS Status; PERFORMANCE_PROPERTY *PerformanceProperty; + VOID *Registration; =20 // // Initialize spin lock @@ -987,6 +1019,16 @@ InitializeSmmCorePerformanceLib ( Status =3D gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, = &mPerformanceProperty); ASSERT_EFI_ERROR (Status); } + + // + // Register callback function for ExitBootServices event. + // + Status =3D gSmst->SmmRegisterProtocolNotify ( + &gEdkiiSmmExitBootServicesProtocolGuid, + SmmCorePerformanceLibExitBootServicesCallback, + &Registration + ); + ASSERT_EFI_ERROR (Status); } =20 /** @@ -1011,6 +1053,8 @@ SmmCorePerformanceLibConstructor ( EFI_EVENT Event; VOID *Registration; =20 + mPerformanceMeasurementEnabled =3D (BOOLEAN)((PcdGet8 (PcdPerformanceLi= braryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) !=3D= 0); + if (!PerformanceMeasurementEnabled ()) { // // Do not initialize performance infrastructure if not required. @@ -1383,7 +1427,7 @@ PerformanceMeasurementEnabled ( VOID ) { - return (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMA= NCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) !=3D 0); + return mPerformanceMeasurementEnabled; } =20 /** diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.inf b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i= nf index 9eecc4b58c..9a7e14e80c 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf @@ -8,7 +8,7 @@ # This library is mainly used by SMM Core to start performance logging to= ensure that # SMM Performance and PerformanceEx Protocol are installed at the very be= ginning of SMM phase. # -# Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -58,6 +58,7 @@ =20 [Protocols] gEfiSmmBase2ProtocolGuid ## CONSUMES + gEdkiiSmmExitBootServicesProtocolGuid ## CONSUMES =20 [Guids] ## PRODUCES ## SystemTable --=20 2.39.1.windows.1 -=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 (#106048): https://edk2.groups.io/g/devel/message/106048 Mute This Topic: https://groups.io/mt/99500188/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106049+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106049+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636828; cv=none; d=zohomail.com; s=zohoarc; b=MvXrmlFnlUGoX8Y2c2mIfBEAfBHo4DXc2pQUqcMy52WZrPQzuldu1KfWu8A65CCBPDz/I57VXUQ5jxDkQ01HY4oAv7qFG1pOW2N2mBhuKvD89jH/2bNu6+GygxiadNmPa4+mvFktvIfMurFvrjPDUY8dUrQIpba4HhdbFveOkCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636828; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=8PLzdKZ33ZqJCB47i6u5BY4iJT0InUH/QI0JRfqlHio=; b=nluM3TpwzIo0m8ybZj3NLs9oewAsugLlOWuWmAlkj3EJiWms9Trdfc/hub/A44fhaywih4oarJ9lAxqGb5LfmzHDqeViZ/SMc7UWgp/MOCmhro0VMF8GEssF9pQzgyj2D8BBARrXUO0zyeUohdazML/vUUwuZMmoPWMRF4lXA+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106049+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636828468327.9474292598825; Mon, 12 Jun 2023 23:13:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lYLHYY1788612xaSufBvYcMJ; Mon, 12 Jun 2023 23:13:48 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:47 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238310" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238310" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306394" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306394" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:45 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar , Gerd Hoffmann , Jiaxin Wu Subject: [edk2-devel] [PATCH V3 7/8] UefiCpuPkg/SmmCpu: Add PcdSmmApPerfLogEnable control AP perf-logging Date: Tue, 13 Jun 2023 14:13:24 +0800 Message-Id: <20230613061325.1664-8-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: YuYVwD9keejp2Awa6IkzL6pgx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636828; bh=i8oYkp/e6jxlt669eHwuTFYWgqRL2EJUfmd6NwNsZiU=; h=Cc:Date:From:Reply-To:Subject:To; b=Oyxak6b6REFkQmQ1GwReyXEERuDxfVFroNj3F+Bxv4CagvGFrn2KJtcxoPDc/d5y7EC H4Dr/j+y6yW9NEaa/KhKO2TXt2PsnvVLgYT988WZ1pZTFaL4sj8xk7IqmvBpAmv+JNhUS 3l+/COgcFq6WO3oNeoA2cLau2GmIntOTkAk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636829438100005 Content-Type: text/plain; charset="utf-8" When a platform has lots of CPU cores/threads, perf-logging on every AP produces lots of records. When this multiplies with number of SMIs during post, the records are even more. So, this patch adds a new PCD PcdSmmApPerfLogEnable (default TRUE) to allow platform to turn off perf-logging on APs. Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c | 11 ++++++++++- UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 4 +++- UefiCpuPkg/UefiCpuPkg.dec | 6 ++++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index bcd90f0671..8364b73242 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -784,7 +784,7 @@ BSPHandler ( // Any SMM MP performance logging after this point will be migrated in n= ext SMI. // PERF_CODE ( - MigrateMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus); + MigrateMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus, CpuIn= dex); ); =20 // diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index 4864532c35..d864ae9101 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -128,6 +128,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileRingBuffer ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmFeatureControlMsrLock ## CONS= UMES gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONS= UMES + gUefiCpuPkgTokenSpaceGuid.PcdSmmApPerfLogEnable ## CONS= UMES =20 [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOME= TIMES_CONSUMES diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.c index c13556af46..92c67f31bf 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c @@ -39,16 +39,25 @@ InitializeMpPerf ( Migrate MP performance data to standardized performance database. =20 @param NumberofCpus Number of processors in the platform. + @param BspIndex The index of the BSP. **/ VOID MigrateMpPerf ( - UINTN NumberofCpus + UINTN NumberofCpus, + UINTN BspIndex ) { UINTN CpuIndex; UINTN MpProcecureId; =20 for (CpuIndex =3D 0; CpuIndex < NumberofCpus; CpuIndex++) { + if ((CpuIndex !=3D BspIndex) && !FeaturePcdGet (PcdSmmApPerfLogEnable)= ) { + // + // Skip migrating AP performance data if AP perf-logging is disabled. + // + continue; + } + for (MpProcecureId =3D 0; MpProcecureId < SMM_MP_PERF_PROCEDURE_ID (Sm= mMpProcedureMax); MpProcecureId++) { if (mSmmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId] !=3D 0= ) { PERF_START (NULL, gSmmMpPerfProcedureName[MpProcecureId], NULL, mS= mmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId]); diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.h index eeafb242f9..3bd594c36f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h @@ -48,10 +48,12 @@ InitializeMpPerf ( Migrate MP performance data to standardized performance database. =20 @param NumberofCpus Number of processors in the platform. + @param BspIndex The index of the BSP. **/ VOID MigrateMpPerf ( - UINTN NumberofCpus + UINTN NumberofCpus, + UINTN BspIndex ); =20 /** diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index d31c3b127c..5b0ac64e33 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -175,6 +175,12 @@ # @Prompt Support SmmFeatureControl. gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|TRUE|BOOLEAN|0x3213= 2110 =20 + ## Indicates if SMM perf logging in APs will be enabled.

+ # TRUE - SMM perf logging in APs will be enabled.
+ # FALSE - SMM perf logging in APs will not be enabled.
+ # @Prompt Enable SMM perf logging in APs. + gUefiCpuPkgTokenSpaceGuid.PcdSmmApPerfLogEnable|TRUE|BOOLEAN|0x32132114 + [PcdsFixedAtBuild] ## List of exception vectors which need switching stack. # This PCD will only take into effect if PcdCpuStackGuard is enabled. --=20 2.39.1.windows.1 -=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 (#106049): https://edk2.groups.io/g/devel/message/106049 Mute This Topic: https://groups.io/mt/99500190/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 14:48:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106050+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106050+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686636831; cv=none; d=zohomail.com; s=zohoarc; b=c+53YABuRuLYH5ILlEr16iFUVNi8ojn3t7Oe8gNJLCiUW0bvnPL8paQFZ/z59r20OSp4KTBbrEfj10WljMklOEPr9AbwuRBWKcF5HVLZ5n/Ep1dlZt2hhaGBbtuVurAF42AXsTtnmqogblJx2dQERlydrIpdBKwqHAqiHFpqTHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686636831; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wfQBrbg8rlodGXgvrLwCg45aJ+yqoUFi453iESMAoP0=; b=Ol7RdykFdG53gOPrTIgoy7e8wL0cqRO9pIhCGqSPcsj2dKtBx5xZLNtTldHV5tHr/m8i7Fcsq4+fM/BQ7t26rFy9I1iUmj1JgsWryWx6PYXtD+EcWw8KNX80pKB22upqyRBH+atCvPE0uhKe7qGYz7KQGAu/WZ09yXwBb3MAMDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106050+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686636831042152.31079934255695; Mon, 12 Jun 2023 23:13:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9FddYY1788612xKQVXUiZJRj; Mon, 12 Jun 2023 23:13:50 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7304.1686636811551339614 for ; Mon, 12 Jun 2023 23:13:49 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="358238328" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="358238328" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 23:13:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="741306398" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="741306398" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by orsmga008.jf.intel.com with ESMTP; 12 Jun 2023 23:13:47 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Jiaxin Wu Subject: [edk2-devel] [PATCH V3 8/8] MdeModulePkg/SmmCore: Perf-log PlatformHookBefore/AfterSmmDispatch Date: Tue, 13 Jun 2023 14:13:25 +0800 Message-Id: <20230613061325.1664-9-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: J1SNoyLJNVM6iAWoVdPzbH4Wx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686636830; bh=oHSnw8FDCQIi8qfpben4kDxEs0B3fo8hAqyWFBJw7qI=; h=Cc:Date:From:Reply-To:Subject:To; b=YZblRocoskNXnaG4NAxCaocr7UGnQZGLGytaZjikqdlBVcGI3n+pN8MiBFAnK8sYg+H UpkQwh36rhgBJRpK7K2fitHvc1afU5dlRoMPIc3WmT1yYlYgRMGi9Hz/IxAFEK72Lqde9 36r+FuNgeunYRDg4OARCNmkhRsjON9WeTd4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686636832091100011 Content-Type: text/plain; charset="utf-8" Signed-off-by: Ray Ni Cc: Jian J Wang Cc: Liming Gao Cc: Jiaxin Wu Reviewed-by: Jian J Wang Reviewed-by: Jiaxin Wu --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index 68af9ab81b..a8537829e3 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -692,7 +692,9 @@ SmmEntryPoint ( // // Call platform hook before Smm Dispatch // + PERF_START (NULL, "PlatformHookBeforeSmmDispatch", NULL, 0, 0); PlatformHookBeforeSmmDispatch (); + PERF_END (NULL, "PlatformHookBeforeSmmDispatch", NULL, 0); =20 // // Call memory management hook function @@ -769,7 +771,9 @@ SmmEntryPoint ( // // Call platform hook after Smm Dispatch // + PERF_START (NULL, "PlatformHookAfterSmmDispatch", NULL, 0, 0); PlatformHookAfterSmmDispatch (); + PERF_END (NULL, "PlatformHookAfterSmmDispatch", NULL, 0) =20 // // If a legacy boot has occurred, then make sure gSmmCorePrivate is not = accessed --=20 2.39.1.windows.1 -=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 (#106050): https://edk2.groups.io/g/devel/message/106050 Mute This Topic: https://groups.io/mt/99500191/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-