MdeModulePkg: Extend memory profile definitions for memory leak detection

Current memory profile feature:
1. Shows which line of code calls gBS->AllocateXXX(). But most entries
are from MemoryAllocationLib.
2. Records at the start.
3. Records all modules.

Enhanced memory profile feature:
1. User can know which line of code calls AllocateXXX() API instead of
gBS->Allocate().
2. User can know which line of code calls a specific API that will call
AllocateXXX().
3. User can know total memory allocated by a specific line of code.
4. User can configure to record single module.
5. User can configure when to enable recording.
6. User can know RVA<->Symbol (Function, Source, Line).

For the enhanced memory profile feature,
1. Extend MEMORY_PROFILE_DRIVER_INFO to include PdbString.
2. Extend MEMORY_PROFILE_ALLOC_INFO to include ActionString.
3. Extend MEMORY_PROFILE_ACTION to indicate action in memory allocation
lib and user defined action.
4. Extend memory profile protocol to include GetRecordingState/
SetRecordingState/Record.
5. Define SMM memory profile protocol.
6. Extend PcdMemoryProfilePropertyMask to support disable recording at
the start.
7. Introduce new PCD PcdMemoryProfileDriverPath to control which drivers
need memory profile data.

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>
This commit is contained in:
Star Zeng
2016-05-31 13:40:24 +08:00
parent 10e4e4f627
commit 94092aa603
3 changed files with 213 additions and 11 deletions

View File

@@ -266,7 +266,8 @@
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfilePropertyMask_HELP #language en-US "The mask is used to control memory profile behavior.<BR><BR>\n"
"BIT0 - Enable UEFI memory profile.<BR>\n"
"BIT1 - Enable SMRAM profile.<BR>"
"BIT1 - Enable SMRAM profile.<BR>\n"
"BIT7 - Disable recording at the start.<BR>"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileMemoryType_PROMPT #language en-US "Memory profile memory type"
@@ -292,6 +293,20 @@
" OS Reserved 0x80000000<BR>\n"
"e.g. Reserved+ACPINvs+ACPIReclaim+RuntimeCode+RuntimeData are needed, 0x661 should be used.<BR>\n"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileDriverPath_PROMPT #language en-US "Memory profile driver path"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMemoryProfileDriverPath_HELP #language en-US "This PCD is to control which drivers need memory profile data.<BR><BR>\n"
"For example:<BR>\n"
"One image only (Shell):<BR>\n"
" Header GUID<BR>\n"
" {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>\n"
" 0x7F, 0xFF, 0x04, 0x00}<BR>\n"
"Two or more images (Shell + WinNtSimpleFileSystem):<BR>\n"
" {0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1,<BR>\n"
" 0x7F, 0x01, 0x04, 0x00,<BR>\n"
" 0x04, 0x06, 0x14, 0x00, 0x8B, 0xE1, 0x25, 0x9C, 0xBA, 0x76, 0xDA, 0x43, 0xA1, 0x32, 0xDB, 0xB0, 0x99, 0x7C, 0xEF, 0xEF,<BR>\n"
" 0x7F, 0xFF, 0x04, 0x00}<BR>\n"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSerialClockRate_PROMPT #language en-US "Serial Port Clock Rate"
#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSerialClockRate_HELP #language en-US "UART clock frequency is for the baud rate configuration."