From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.9554.1685111719214787346 for ; Fri, 26 May 2023 07:35:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OmjRh0v6; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685111719; x=1716647719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J3GxH1rEqiThZO3k105+Hu0in5SvGFRV7bRFz0ec9oM=; b=OmjRh0v6nkDre00r4RVQKccXFLYI7kHPugG2D/CEck5ZcXCiiDpoeciF mdBSrAFDoEfYPixIbBiU/mxaSap6roEwpZKgKpSDa4qnm9cPkJAaLVBqF 0geNHjkiO6lFoLA5Z3682qhsle0Pj7XSboaKGaC19l9hBgatHl+z7taPo vRwc3Ya7hhE0IewRvhSZNHRRJ7kd1DzpSHaI3rEM0tTJG8mvFDyjYqWn6 pcb8PYtYm+ZiCWNA1BNR6rPJ51kYEydMe2EQ7BVzFTadrUCJ0RIP+XwAl +7JHa05w94zobCkCd95af9eyclEwzykhwpjdcFNoZv7sccIzAoRAdvIW6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10722"; a="333838642" X-IronPort-AV: E=Sophos;i="6.00,194,1681196400"; d="scan'208";a="333838642" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2023 07:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10722"; a="770361081" X-IronPort-AV: E=Sophos;i="6.00,194,1681196400"; d="scan'208";a="770361081" Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by fmsmga008.fm.intel.com with ESMTP; 26 May 2023 07:34:38 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Jiaxin Wu Subject: [PATCH 3/3] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures Date: Fri, 26 May 2023 22:34:31 +0800 Message-Id: <20230526143431.2100-4-ray.ni@intel.com> X-Mailer: git-send-email 2.39.1.windows.1 In-Reply-To: <20230526143431.2100-1-ray.ni@intel.com> References: <20230526143431.2100-1-ray.ni@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 14 +++++++++++++- MdeModulePkg/Core/PiSmmCore/Smi.c | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index 875c7c0258..a15afa8dd6 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -1,7 +1,7 @@ /** @file=0D SMM Core Main Entry Point=0D =0D - Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -304,6 +304,7 @@ SmmReadyToBootHandler ( {=0D EFI_STATUS Status;=0D EFI_HANDLE SmmHandle;=0D + PERF_CALLBACK_BEGIN (&gEfiEventReadyToBootGuid);=0D =0D //=0D // Install SMM Ready To Boot protocol.=0D @@ -318,6 +319,7 @@ SmmReadyToBootHandler ( =0D SmiHandlerUnRegister (DispatchHandle);=0D =0D + PERF_CALLBACK_END (&gEfiEventReadyToBootGuid);=0D return Status;=0D }=0D =0D @@ -352,6 +354,8 @@ SmmReadyToLockHandler ( EFI_HANDLE SmmHandle;=0D VOID *Interface;=0D =0D + PERF_CALLBACK_BEGIN (&gEfiDxeSmmReadyToLockProtocolGuid);=0D +=0D //=0D // Unregister SMI Handlers that are no required after the SMM driver dis= patch is stopped=0D //=0D @@ -408,6 +412,7 @@ SmmReadyToLockHandler ( =0D SmramProfileReadyToLock ();=0D =0D + PERF_CALLBACK_END (&gEfiDxeSmmReadyToLockProtocolGuid);=0D return Status;=0D }=0D =0D @@ -442,6 +447,8 @@ SmmEndOfDxeHandler ( =0D DEBUG ((DEBUG_INFO, "SmmEndOfDxeHandler\n"));=0D =0D + PERF_CALLBACK_BEGIN (&gEfiEndOfDxeEventGroupGuid);=0D +=0D //=0D // Install SMM EndOfDxe protocol=0D //=0D @@ -479,6 +486,7 @@ SmmEndOfDxeHandler ( }=0D }=0D =0D + PERF_CALLBACK_END (&gEfiEndOfDxeEventGroupGuid);=0D return EFI_SUCCESS;=0D }=0D =0D @@ -669,6 +677,8 @@ SmmEntryPoint ( VOID *CommunicationBuffer;=0D UINTN BufferSize;=0D =0D + PERF_FUNCTION_BEGIN ();=0D +=0D //=0D // Update SMST with contents of the SmmEntryContext structure=0D //=0D @@ -769,6 +779,8 @@ SmmEntryPoint ( //=0D gSmmCorePrivate->InSmm =3D FALSE;=0D }=0D +=0D + PERF_FUNCTION_END ();=0D }=0D =0D /**=0D 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;=0D EFI_STATUS Status;=0D =0D + PERF_FUNCTION_BEGIN ();=0D +=0D Status =3D EFI_NOT_FOUND;=0D SuccessReturn =3D FALSE;=0D if (HandlerType =3D=3D NULL) {=0D @@ -125,6 +127,7 @@ SmiManage ( //=0D // There is no handler registered for this interrupt source=0D //=0D + PERF_FUNCTION_END ();=0D return Status;=0D }=0D }=0D @@ -148,6 +151,7 @@ SmiManage ( // no additional handlers will be processed and EFI_INTERRUPT_PEND= ING will be returned.=0D //=0D if (HandlerType !=3D NULL) {=0D + PERF_FUNCTION_END ();=0D return EFI_INTERRUPT_PENDING;=0D }=0D =0D @@ -160,6 +164,7 @@ SmiManage ( // additional handlers will be processed.=0D //=0D if (HandlerType !=3D NULL) {=0D + PERF_FUNCTION_END ();=0D return EFI_SUCCESS;=0D }=0D =0D @@ -194,6 +199,7 @@ SmiManage ( Status =3D EFI_SUCCESS;=0D }=0D =0D + PERF_FUNCTION_END ();=0D return Status;=0D }=0D =0D --=20 2.39.1.windows.1