From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=EFvfWYhv; spf=pass (domain: intel.com, ip: 192.55.52.115, 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=1686636817; x=1718172817; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dy/p9OOXmJPRYL/e3X9tlwYL2LCVnoRKb/+W1e6Dhp0=; b=EFvfWYhvFYQzKAh0rzQp22LrOVB1IwJRDC+gjA1aCRnWX1HHvsQkFRHa BpG6N+i/TFxobHvvA5u+sFtezRcXtBBTuryj1bwOa7U+GilI3Trt/RWG3 dH4ghQgIqWxwpsSGN6UtwI5xmpToqK35KoSm9GMp0FJMCUfOZpW+SoiIz YvLPgpwaHD0pNEnJrN59JzKzc44LYNg0KVgtbdT0kOcIobFCpvypk1Dx/ 0JxgyolEhH7lA59RcwyRfKnCudh6jkRB8mS7wB/Fg1qW2TEF4g1SFBaL/ 9GKXHGuEXjqTu0WYbruY5ZT6P0c6C3RyHeXwCjlmJLEr4iuwP/XUKzt3d w==; 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" 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" 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: [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> X-Mailer: git-send-email 2.39.1.windows.1 In-Reply-To: <20230613061325.1664-1-ray.ni@intel.com> References: <20230613061325.1664-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 Reviewed-by: Jiaxin Wu Reviewed-by: Eric Dong --- 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=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 @@ -305,6 +305,8 @@ SmmReadyToBootHandler ( EFI_STATUS Status;=0D EFI_HANDLE SmmHandle;=0D =0D + PERF_CALLBACK_BEGIN (&gEfiEventReadyToBootGuid);=0D +=0D //=0D // Install SMM Ready To Boot protocol.=0D //=0D @@ -318,6 +320,7 @@ SmmReadyToBootHandler ( =0D SmiHandlerUnRegister (DispatchHandle);=0D =0D + PERF_CALLBACK_END (&gEfiEventReadyToBootGuid);=0D return Status;=0D }=0D =0D @@ -352,6 +355,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 +413,7 @@ SmmReadyToLockHandler ( =0D SmramProfileReadyToLock ();=0D =0D + PERF_CALLBACK_END (&gEfiDxeSmmReadyToLockProtocolGuid);=0D return Status;=0D }=0D =0D @@ -442,6 +448,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 +487,7 @@ SmmEndOfDxeHandler ( }=0D }=0D =0D + PERF_CALLBACK_END (&gEfiEndOfDxeEventGroupGuid);=0D return EFI_SUCCESS;=0D }=0D =0D @@ -669,6 +678,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 +780,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