From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fb.mail.gandi.net (spool8.mail.gandi.net [217.70.178.217]) by nmboxes206.sd4.0x35.net (Postfix) with ESMTPS id 40C6560BE2 for ; Fri, 1 Sep 2023 09:33:42 +0000 (UTC) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by fb.mail.gandi.net (Postfix) with ESMTPS id 98CC060366 for ; Fri, 1 Sep 2023 09:33:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MunPdkh64zi1F0YzY/miUq1Impdp/L7o7VEcucPF+oM=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1693560820; v=1; b=NL9I8v+sOme8reUxKxZzHqKKaxzwgrhYY6orkKWuNvkjJx6E4yvbdA3YLVJApgDKxKyOAoRV lEHO5MQPRPj59/TbaqDDf28Thud9MrM4dA4IxfpmsOKE7YccYZ1Zxtv/4pf5ViwbjMMpqfC3oDb BfEh/xcUOM5U90XwPM2f/FoQ= X-Received: by 127.0.0.2 with SMTP id 3FKbYY7687511xuj2cxoJnab; Fri, 01 Sep 2023 02:33:40 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.13267.1693541218842457321 for ; Thu, 31 Aug 2023 21:06:59 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10819"; a="379915420" X-IronPort-AV: E=Sophos;i="6.02,218,1688454000"; d="scan'208";a="379915420" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2023 21:06:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10819"; a="829979448" X-IronPort-AV: E=Sophos;i="6.02,218,1688454000"; d="scan'208";a="829979448" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 31 Aug 2023 21:06:56 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 31 Aug 2023 21:06:56 -0700 X-Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 31 Aug 2023 21:06:56 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Thu, 31 Aug 2023 21:06:56 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Thu, 31 Aug 2023 21:06:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PF4p2VaUhaRJo4FfNBF/chItXqe6NV8S27e6sufa3lbqonLRuTMOt0rgwgoNhkeaqY2Hxk81E69Qvw0EuEnfwAl0RbynzP8JVEGJ5KxVdkK5ApTkN/Q0bItHKoh/wDSNXI2rDfh5hMJbAp3uj0AZ/ZC+NLCS3CTh/1hXxWTNsp6+NzeNIiU46KzqfMaWBAPbHmgJaRLtLjr3LJyO3cHKBxD0UnvoZnBvoBreoHO85LIeZHW5IHWwujGzj40HQwMDgX0j5LafgCAzxiCfxccn0kB22mmq8KrcoKEVc01AxH5lbGLrs+GHmhL9oSJGwtRdUGakv14u+gOFfxKBHmwW7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RyJPtiCU5te+3rqNMprczuXcWNS6/GfU2+l31YeWuvg=; b=H27IAUbYRtI7YI776uVve/7yygYGRuJwrnxXGOcWmXnab4wjpnDAwuW1j76BU0mBkceLjaHix/vhdIyX0p4k24+TKJ99/o+MR9UzBmyN14jPsshzivHJGdz/tN6FQsigKwjnKbCSBgUMsSRe0KLPnmz5LNa7kcXVhHPDPBC4VxEB/kMQeptrL3ADkbzFsV7oNkcTpi54zCDurE0XwqAcYvRS4TE6RCiXQDXpVxWlx7A/gYKJeeiiOV4+ujMK/4AKnBQcKAIYCMLJkiOPyoSZZMPvkWWZaVE5g9oarA4lAANT7pwyEtzI0AQAtRcxBU0iMJ58qhJ1QZm72qZOCeUzsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by CH3PR11MB7372.namprd11.prod.outlook.com (2603:10b6:610:145::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.20; Fri, 1 Sep 2023 04:06:47 +0000 X-Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::380d:dcf6:c4b:d48b]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::380d:dcf6:c4b:d48b%4]) with mapi id 15.20.6745.022; Fri, 1 Sep 2023 04:06:47 +0000 From: "duntan" To: "devel@edk2.groups.io" , "Tan, Dun" CC: "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" Subject: Re: [edk2-devel] [Patch V2] MdeModulePkg/DxeCorePerformanceLib:fix smm perf issue Thread-Topic: [edk2-devel] [Patch V2] MdeModulePkg/DxeCorePerformanceLib:fix smm perf issue Thread-Index: AQHZ2x0JqIB/UdSij0e5rrocgmWef7AEAqIg Date: Fri, 1 Sep 2023 04:06:46 +0000 Message-ID: References: <1780190419D49EE1.31776@groups.io> In-Reply-To: <1780190419D49EE1.31776@groups.io> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|CH3PR11MB7372:EE_ x-ms-office365-filtering-correlation-id: 9354df07-65c2-438a-8546-08dbaaa0dc34 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: Yhz6HSUJ0XjsDgNIw6G1ICbU8CCpYMicOtBr47hNnksfioSnGEX6e6EXfzpLTADnefpsbcuCZ8M+2VSN73/pDOmINFY4OK5vhTZT4O6JSTuwpnjN1T5jLLjPGIUMWyoCbJtJdjklTe9JxDlD5/rvIalEhUVJg5WmS6pCQDh+CAVIOKhALyNpXbLxueATBW22GawtcQDRm+ir+7AdqwFv3AKhLcC5EmL47QY9j7Wes1z+t3p08CDGnzTlXbZbwIR7ALWR7bd1FNf/KphBe3VMoaTcWesNl4mbWkjFJMUE5pwW2e9Cg7w2XtNxdNzxzrKaFHi4h/xYhJF1fC7jzWu6wNnNRMfuYh5t70lG9RGmBz+0zTo1OnEsVULaWLwfu4Ngww51+a+J65zaOI6WGqEj+5X+nAs5k6bgSTtYQU6/W8tRMA1lZSq5HWMS+u30zsAEYvsVK9JyRwtqPz9yrQ/lbgFDTC6MY1mwv1ueQiSTDZEABHRvCxipJSK5dApAvHJ+WMQ2Ii0Q/CgZ8ZQawdOdg8sttGgYQhfHEEeWFth4mqjbKwomvBVnjsNXsg3Vw+QrGHKYP5BHrZtdTh4kZYiCBlg/UQPcfXvOsUyICC7St2bt0ptU+OORMeJJMv3NP4wuvPxRAVj9X/juWbf5KCG4aA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5tU2dBy/jkfaGqtpAFS6y2tgM++n+3Jzik3xqynymht6DLOL79XaZKQS0Nue?= =?us-ascii?Q?Vx0q/iOTbU0VOaw5VVKjF/g7iRmZmQ8BJu8JxyIuAYWVRd1h6KZI+rjqsKxw?= =?us-ascii?Q?Wzb823g1R0Vz3nf3GhpkzE/BPKKghUNV96lnjcaJJrZuidV5Eowi4Pahth1m?= =?us-ascii?Q?MFmu0HfjGBfXWBolnHZzII/kup9hHefzTIBO4YM25zSYWQtBm3n/AiyBFUNP?= =?us-ascii?Q?SL8eWi3+5fli5TRooaOskWJbThTVwBYGS2tYLGElPlNMPamOrMaHJ4WkxhOz?= =?us-ascii?Q?JUposrb0/iM+asB1Y9r61fIogQ3FWLlxEWlOkRPgeWVTFJaaicakPQBROX81?= =?us-ascii?Q?R79TphU+dqBwdQOLSnYsx3swFlXTUh+aFF31jFHNRWObANDt0CTCY1C4qQ+y?= =?us-ascii?Q?eqTBhIZa/BvqhwIjxWmHVt5z3FpFcln9DSlrBlU0N6nx04n//FzC2YwiC0zE?= =?us-ascii?Q?zUnX1+gDy2LYx7ZrID5eclWAur+LZTvVr48JgZFN0HPVjIg+/DK7CxYm+WDc?= =?us-ascii?Q?RVlUr6vH4L+08Nw4JW/RzIAVZrxkDKCtaARuxFTw6iEFH51xcpwLr3xOOYKD?= =?us-ascii?Q?ZR01Sp42SUyCCoep5GRQl8TC0CTobklrH1DxWpdhcWC2St/Z7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A1ivPK6Jj3S6J5qyqeaIeqmk7WrUemLv7wVq+I?= =?us-ascii?Q?VJgU1c/fAY5/zgx39zM=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9354df07-65c2-438a-8546-08dbaaa0dc34 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Sep 2023 04:06:46.8614 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Skh8EtMCEemLV9boSgBupiFCLFJFefAWxJfrSP42mNgXG7m/DbA+RNB3JcC2kvXC619XoXQBK8JcTwew/hWpgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7372 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: PQek4QHlLc842j2woAWnn6LCx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: fb.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=NL9I8v+s; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (fb.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hi Jian and Liming, Could you please help to review this patch? Thanks, Dun -----Original Message----- From: devel@edk2.groups.io On Behalf Of duntan Sent: Wednesday, August 30, 2023 3:36 PM To: devel@edk2.groups.io Cc: Wang, Jian J ; Gao, Liming ; Ni, Ray Subject: [edk2-devel] [Patch V2] MdeModulePkg/DxeCorePerformanceLib:fix smm= perf issue Fix smm perf issue in DxeCorePerformanceLib. In current code logic, total S= MM perf record is copied multiple times to FPDT table if multiple ReadyToBo= ot events are signaled. This patch changes the function InternalGetSmmPerfData() to only get newly generated Smm perf data. Then pr= evious generated Smm perf data won't be copied to FPDT again. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4470 Signed-off-by: Dun Tan Cc: Jian J Wang Cc: Liming Gao Cc: Ray Ni --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 32 ++= +++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index ef14bc0738..0a994be6a5 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -10,7 +10,7 @@ This library is mainly used by DxeCore to start performance logging to e= nsure that Performance Protocol is installed at the very beginning of DXE phase. =20 -Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -73,6 +73,7 @@ UINT8 *mPerformancePointer =3D NULL; UINT8 *mBootRecordBuffer =3D NULL; BOOLEAN mLockInsertRecord =3D FALSE; CHAR8 *mDevicePathString =3D NULL; +UINTN mSmmBootRecordOffset =3D 0; =20 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathToText =3D NULL; =20 @@ -236,6 +237,7 @@ InternalGetSmmPerfData ( VOID *SmmBootRecordData; UINTN SmmBootRecordDataSize; UINTN ReservedMemSize; + UINTN SmmBootRecordDataRetrieved; =20 // // Collect boot records from SMM drivers. @@ -297,28 +299,32 @@ InternalGetSmmPerfData ( } =20 // - // Get all boot records + // Get boot records starting from mSmmBootRecordOffset // - SmmCommData->Function =3D SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA= _BY_OFFSET; - SmmBootRecordDataSize =3D SmmCommData->BootRecordSize; - SmmBootRecordData =3D AllocateZeroPool (SmmBootRecordDataSiz= e); + SmmCommData->Function =3D SMM_FPDT_FUNCTION_GET_BOOT_REC= ORD_DATA_BY_OFFSET; + SmmCommData->BootRecordOffset =3D mSmmBootRecordOffset; + SmmBootRecordDataSize =3D SmmCommData->BootRecordSize - = mSmmBootRecordOffset; + SmmBootRecordData =3D AllocateZeroPool (SmmBootRecor= dDataSize); + SmmBootRecordDataRetrieved =3D 0; ASSERT (SmmBootRecordData !=3D NULL); - SmmCommData->BootRecordOffset =3D 0; - SmmCommData->BootRecordData =3D (VOID *)((UINTN)SmmCommMemRegi= on->PhysicalStart + SMM_BOOT_RECORD_COMM_SIZE); - SmmCommData->BootRecordSize =3D ReservedMemSize - SMM_BOOT_REC= ORD_COMM_SIZE; - while (SmmCommData->BootRecordOffset < SmmBootRecordDataSize) { + SmmCommData->BootRecordData =3D (VOID *)((UINTN)SmmCommMemRegion= ->PhysicalStart + SMM_BOOT_RECORD_COMM_SIZE); + SmmCommData->BootRecordSize =3D ReservedMemSize - SMM_BOOT_RECOR= D_COMM_SIZE; + while (SmmBootRecordDataRetrieved < SmmBootRecordDataSize) { Status =3D Communication->Communicate (Communication, SmmBootR= ecordCommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (SmmCommData->ReturnStatus); - if (SmmCommData->BootRecordOffset + SmmCommData->BootRecordSiz= e > SmmBootRecordDataSize) { - CopyMem ((UINT8 *)SmmBootRecordData + SmmCommData->BootRecor= dOffset, SmmCommData->BootRecordData, SmmBootRecordDataSize - SmmCommData->= BootRecordOffset); + if (SmmBootRecordDataRetrieved + SmmCommData->BootRecordSize >= SmmBootRecordDataSize) { + CopyMem ((UINT8 *)SmmBootRecordData +=20 + SmmBootRecordDataRetrieved, SmmCommData->BootRecordData,=20 + SmmBootRecordDataSize - SmmBootRecordDataRetrieved); } else { - CopyMem ((UINT8 *)SmmBootRecordData + SmmCommData->BootRecor= dOffset, SmmCommData->BootRecordData, SmmCommData->BootRecordSize); + CopyMem ((UINT8 *)SmmBootRecordData +=20 + SmmBootRecordDataRetrieved, SmmCommData->BootRecordData,=20 + SmmCommData->BootRecordSize); } =20 - SmmCommData->BootRecordOffset =3D SmmCommData->BootRecordOffse= t + SmmCommData->BootRecordSize; + SmmBootRecordDataRetrieved +=3D SmmCommData->BootRecordSize= ; + SmmCommData->BootRecordOffset +=3D=20 + SmmCommData->BootRecordSize; } =20 + mSmmBootRecordOffset =3D SmmCommData->BootRecordOffset; + *SmmPerfData =3D SmmBootRecordData; *SmmPerfDataSize =3D SmmBootRecordDataSize; } -- 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108224): https://edk2.groups.io/g/devel/message/108224 Mute This Topic: https://groups.io/mt/101047988/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-