[edk2-devel] [PATCH V2 3/6] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures
Ni, Ray
ray.ni at intel.com
Wed May 31 11:34:35 UTC 2023
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 <jian.j.wang at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Jiaxin Wu <jiaxin.wu at intel.com>
---
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/PiSmmCore/PiSmmCore.c
index 875c7c0258..a15afa8dd6 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -1,7 +1,7 @@
/** @file
SMM Core Main Entry Point
- Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -304,6 +304,7 @@ SmmReadyToBootHandler (
{
EFI_STATUS Status;
EFI_HANDLE SmmHandle;
+ PERF_CALLBACK_BEGIN (&gEfiEventReadyToBootGuid);
//
// Install SMM Ready To Boot protocol.
@@ -318,6 +319,7 @@ SmmReadyToBootHandler (
SmiHandlerUnRegister (DispatchHandle);
+ PERF_CALLBACK_END (&gEfiEventReadyToBootGuid);
return Status;
}
@@ -352,6 +354,8 @@ SmmReadyToLockHandler (
EFI_HANDLE SmmHandle;
VOID *Interface;
+ PERF_CALLBACK_BEGIN (&gEfiDxeSmmReadyToLockProtocolGuid);
+
//
// Unregister SMI Handlers that are no required after the SMM driver dispatch is stopped
//
@@ -408,6 +412,7 @@ SmmReadyToLockHandler (
SmramProfileReadyToLock ();
+ PERF_CALLBACK_END (&gEfiDxeSmmReadyToLockProtocolGuid);
return Status;
}
@@ -442,6 +447,8 @@ SmmEndOfDxeHandler (
DEBUG ((DEBUG_INFO, "SmmEndOfDxeHandler\n"));
+ PERF_CALLBACK_BEGIN (&gEfiEndOfDxeEventGroupGuid);
+
//
// Install SMM EndOfDxe protocol
//
@@ -479,6 +486,7 @@ SmmEndOfDxeHandler (
}
}
+ PERF_CALLBACK_END (&gEfiEndOfDxeEventGroupGuid);
return EFI_SUCCESS;
}
@@ -669,6 +677,8 @@ SmmEntryPoint (
VOID *CommunicationBuffer;
UINTN BufferSize;
+ PERF_FUNCTION_BEGIN ();
+
//
// Update SMST with contents of the SmmEntryContext structure
//
@@ -769,6 +779,8 @@ SmmEntryPoint (
//
gSmmCorePrivate->InSmm = FALSE;
}
+
+ PERF_FUNCTION_END ();
}
/**
diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCore/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;
+ PERF_FUNCTION_BEGIN ();
+
Status = EFI_NOT_FOUND;
SuccessReturn = FALSE;
if (HandlerType == 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_PENDING will be returned.
//
if (HandlerType != NULL) {
+ PERF_FUNCTION_END ();
return EFI_INTERRUPT_PENDING;
}
@@ -160,6 +164,7 @@ SmiManage (
// additional handlers will be processed.
//
if (HandlerType != NULL) {
+ PERF_FUNCTION_END ();
return EFI_SUCCESS;
}
@@ -194,6 +199,7 @@ SmiManage (
Status = EFI_SUCCESS;
}
+ PERF_FUNCTION_END ();
return Status;
}
--
2.39.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105495): https://edk2.groups.io/g/devel/message/105495
Mute This Topic: https://groups.io/mt/99240110/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list