From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4391220968904 for ; Tue, 3 Jul 2018 19:34:42 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2018 19:34:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,306,1526367600"; d="scan'208";a="54261852" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2018 19:34:35 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Jul 2018 19:34:35 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Jul 2018 19:34:34 -0700 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.173]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.100]) with mapi id 14.03.0319.002; Wed, 4 Jul 2018 10:34:33 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength Thread-Index: AQHUEcXEqXA5fR/pskyeyklulWA0m6R+W3nQ Date: Wed, 4 Jul 2018 02:34:32 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2AACED@SHSMSX152.ccr.corp.intel.com> References: <20180702052952.201536-1-dandan.bi@intel.com> In-Reply-To: <20180702052952.201536-1-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] MdeModulePkg/SmmCorePerformanceLib: Update mPerformanceLength X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 02:34:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----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 ; Gao, Liming >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 =3D FPDT table header length >+ existing FPDT records length. > >Cc: Liming Gao >Cc: Star Zeng >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Dandan Bi >--- > .../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 =3D 0; > >-UINT32 mPerformanceLength =3D 0; >+UINT32 mPerformanceLength =3D sizeof >(SMM_BOOT_PERFORMANCE_TABLE); > UINT32 mMaxPerformanceLength =3D 0; > UINT32 mLoadImageCount =3D 0; > BOOLEAN mFpdtDataIsReported =3D FALSE; > BOOLEAN mLackSpaceIsReport =3D FALSE; > CHAR8 *mPlatformLanguage =3D NULL; >@@ -98,19 +98,19 @@ GetFpdtRecordPtr ( > // Check if pre-allocated buffer is full > // > if (mPerformanceLength + RecordSize > mMaxPerformanceLength) { > mSmmBootPerformanceTable =3D ReallocatePool ( > mPerformanceLength, >- mPerformanceLength + sizeof >(SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + >FIRMWARE_RECORD_BUFFER, >+ mPerformanceLength + RecordSize + >FIRMWARE_RECORD_BUFFER, > mSmmBootPerformanceTable > ); > > if (mSmmBootPerformanceTable =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } >- mSmmBootPerformanceTable->Header.Length =3D sizeof >(SMM_BOOT_PERFORMANCE_TABLE) + mPerformanceLength; >- mMaxPerformanceLength =3D mPerformanceLength + sizeof >(SMM_BOOT_PERFORMANCE_TABLE) + RecordSize + >FIRMWARE_RECORD_BUFFER; >+ mSmmBootPerformanceTable->Header.Length =3D mPerformanceLength; >+ mMaxPerformanceLength =3D mPerformanceLength + RecordSize + >FIRMWARE_RECORD_BUFFER; > } > // > // Covert buffer to FPDT Ptr Union type. > // > FpdtRecordPtr->RecordHeader =3D >(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