* [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength
@ 2018-07-02 5:29 Dandan Bi
2018-07-04 2:34 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Dandan Bi @ 2018-07-02 5:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Star Zeng
In mSmmBootPerformanceTable there are two parts,
one is the FPDT table header and the other is FPDT records.
Currently:
mPerformanceLength: The length of existing FPDT records.
mMaxPerformanceLength: The maximum length allocated for
mSmmBootPerformanceTable(including FPDT table header length
and existing FPDT records length)
But when compare mPerformanceLength with mMaxPerformanceLength
to check whether need to allocate new buffer for new FPDT
record, we miss to add mPerformanceLength with header length,
which will cause pool allocation behavior is not correct.
Now update the mPerformanceLength to fix this issue:
updated mPerformanceLength = FPDT table header length
+ existing FPDT records length.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index f18c3fb60d..e03d41ed37 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -43,11 +43,11 @@ typedef struct {
} HANDLE_GUID_MAP;
HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
UINTN mCachePairCount = 0;
-UINT32 mPerformanceLength = 0;
+UINT32 mPerformanceLength = sizeof (SMM_BOOT_PERFORMANCE_TABLE);
UINT32 mMaxPerformanceLength = 0;
UINT32 mLoadImageCount = 0;
BOOLEAN mFpdtDataIsReported = FALSE;
BOOLEAN mLackSpaceIsReport = FALSE;
CHAR8 *mPlatformLanguage = NULL;
@@ -98,19 +98,19 @@ GetFpdtRecordPtr (
// Check if pre-allocated buffer is full
//
if (mPerformanceLength + RecordSize > mMaxPerformanceLength) {
mSmmBootPerformanceTable = ReallocatePool (
mPerformanceLength,
- mPerformanceLength + sizeof (SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + FIRMWARE_RECORD_BUFFER,
+ mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER,
mSmmBootPerformanceTable
);
if (mSmmBootPerformanceTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- mSmmBootPerformanceTable->Header.Length = sizeof (SMM_BOOT_PERFORMANCE_TABLE) + mPerformanceLength;
- mMaxPerformanceLength = mPerformanceLength + sizeof (SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + FIRMWARE_RECORD_BUFFER;
+ mSmmBootPerformanceTable->Header.Length = mPerformanceLength;
+ mMaxPerformanceLength = mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER;
}
//
// Covert buffer to FPDT Ptr Union type.
//
FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mSmmBootPerformanceTable->Header.Length);
--
2.14.3.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength
2018-07-02 5:29 [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength Dandan Bi
@ 2018-07-04 2:34 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-07-04 2:34 UTC (permalink / raw)
To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Zeng, Star
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Dandan Bi
>Sent: Monday, July 02, 2018 1:30 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [patch] MdeModulePkg/SmmCorePerformanceLib: Update
>mPerformanceLength
>
>In mSmmBootPerformanceTable there are two parts,
>one is the FPDT table header and the other is FPDT records.
>Currently:
>mPerformanceLength: The length of existing FPDT records.
>mMaxPerformanceLength: The maximum length allocated for
>mSmmBootPerformanceTable(including FPDT table header length
>and existing FPDT records length)
>But when compare mPerformanceLength with mMaxPerformanceLength
>to check whether need to allocate new buffer for new FPDT
>record, we miss to add mPerformanceLength with header length,
>which will cause pool allocation behavior is not correct.
>
>Now update the mPerformanceLength to fix this issue:
>updated mPerformanceLength = FPDT table header length
>+ existing FPDT records length.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Star Zeng <star.zeng@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Dandan Bi <dandan.bi@intel.com>
>---
> .../Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 8
>++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>index f18c3fb60d..e03d41ed37 100644
>---
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>+++
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>@@ -43,11 +43,11 @@ typedef struct {
> } HANDLE_GUID_MAP;
>
> HANDLE_GUID_MAP
>mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
> UINTN mCachePairCount = 0;
>
>-UINT32 mPerformanceLength = 0;
>+UINT32 mPerformanceLength = sizeof
>(SMM_BOOT_PERFORMANCE_TABLE);
> UINT32 mMaxPerformanceLength = 0;
> UINT32 mLoadImageCount = 0;
> BOOLEAN mFpdtDataIsReported = FALSE;
> BOOLEAN mLackSpaceIsReport = FALSE;
> CHAR8 *mPlatformLanguage = NULL;
>@@ -98,19 +98,19 @@ GetFpdtRecordPtr (
> // Check if pre-allocated buffer is full
> //
> if (mPerformanceLength + RecordSize > mMaxPerformanceLength) {
> mSmmBootPerformanceTable = ReallocatePool (
> mPerformanceLength,
>- mPerformanceLength + sizeof
>(SMM_BOOT_PERFORMANCE_TABLE) + RecordSize +
>FIRMWARE_RECORD_BUFFER,
>+ mPerformanceLength + RecordSize +
>FIRMWARE_RECORD_BUFFER,
> mSmmBootPerformanceTable
> );
>
> if (mSmmBootPerformanceTable == NULL) {
> return EFI_OUT_OF_RESOURCES;
> }
>- mSmmBootPerformanceTable->Header.Length = sizeof
>(SMM_BOOT_PERFORMANCE_TABLE) + mPerformanceLength;
>- mMaxPerformanceLength = mPerformanceLength + sizeof
>(SMM_BOOT_PERFORMANCE_TABLE) + RecordSize +
>FIRMWARE_RECORD_BUFFER;
>+ mSmmBootPerformanceTable->Header.Length = mPerformanceLength;
>+ mMaxPerformanceLength = mPerformanceLength + RecordSize +
>FIRMWARE_RECORD_BUFFER;
> }
> //
> // Covert buffer to FPDT Ptr Union type.
> //
> FpdtRecordPtr->RecordHeader =
>(EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER
>*)((UINT8*)mSmmBootPerformanceTable + mSmmBootPerformanceTable-
>>Header.Length);
>--
>2.14.3.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-04 2:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 5:29 [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength Dandan Bi
2018-07-04 2:34 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox