summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-06-29 12:51:55 +0800
committerStar Zeng <star.zeng@intel.com>2016-07-01 09:39:55 +0800
commitc16b7fe71aa99d9bf27ca5d88e15274c39a7a559 (patch)
treec5956ac9e9cf85ffeb5d2529c732b3cee7680bda /MdeModulePkg
parent1d60fe96422206d37e1d74198bb11b2cf6195157 (diff)
downloadedk2-c16b7fe71aa99d9bf27ca5d88e15274c39a7a559.tar.gz
edk2-c16b7fe71aa99d9bf27ca5d88e15274c39a7a559.tar.bz2
edk2-c16b7fe71aa99d9bf27ca5d88e15274c39a7a559.zip
MdeModulePkg DxeCore: Add lock to pretect memory profile AllocInfo list
Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
index 1ba8488a0e..14c4959f9f 100644
--- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
+++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
@@ -63,6 +63,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mMemoryProfileContext
};
GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mMemoryProfileContextPtr = NULL;
+EFI_LOCK mMemoryProfileLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
BOOLEAN mMemoryProfileGettingStatus = FALSE;
BOOLEAN mMemoryProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE;
EFI_DEVICE_PATH_PROTOCOL *mMemoryProfileDriverPath;
@@ -218,6 +219,28 @@ EDKII_MEMORY_PROFILE_PROTOCOL mProfileProtocol = {
};
/**
+ Acquire lock on mMemoryProfileLock.
+**/
+VOID
+CoreAcquireMemoryProfileLock (
+ VOID
+ )
+{
+ CoreAcquireLock (&mMemoryProfileLock);
+}
+
+/**
+ Release lock on mMemoryProfileLock.
+**/
+VOID
+CoreReleaseMemoryProfileLock (
+ VOID
+ )
+{
+ CoreReleaseLock (&mMemoryProfileLock);
+}
+
+/**
Return memory profile context.
@return Memory profile context.
@@ -1383,6 +1406,7 @@ CoreUpdateProfile (
return EFI_UNSUPPORTED;
}
+ CoreAcquireMemoryProfileLock ();
switch (BasicAction) {
case MemoryProfileActionAllocatePages:
Status = CoreUpdateProfileAllocate (CallerAddress, Action, MemoryType, Size, Buffer, ActionString);
@@ -1401,6 +1425,8 @@ CoreUpdateProfile (
Status = EFI_UNSUPPORTED;
break;
}
+ CoreReleaseMemoryProfileLock ();
+
return Status;
}