From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.15058.1686321607270188269 for ; Fri, 09 Jun 2023 07:40:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=j3EA78yX; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686321607; x=1717857607; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xtjP5aPsTEnGz+LykyjYEqyxSzTRSwteiySvErBuKI4=; b=j3EA78yXMYbB1m/j/4tJkIyTQl6aP6jTwmW0oRr8RVoCGR9Wm7ruwAbZ 6jYBSPpcAy2Z/wJAqsKGIhWxru7Qay8S6ZfLubcfR5Ze5CK1bjFw39hkN sKuuxLPJBpNJJu3L8HhvFnew4rU3t7dgDE8xTDabXROoBcMxGBbx2O6xL Cd8UPOSQK9mktoykyFD4DwUkkSuUamBKGa3yuQOiihUVv81p2xlpQj7j5 HjZXQmQfBrnJLsXIqXuQQoL5fh8eTX1LoxParBmv/dg82VaWdFCqavzUF xdnWrw0Du0ByZPX5ARIkTbqk+c6qeIVyB4Rr3JQUhQvJU+cCep3ceoRvR Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="385975999" X-IronPort-AV: E=Sophos;i="6.00,229,1681196400"; d="scan'208";a="385975999" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 07:40:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="687763539" X-IronPort-AV: E=Sophos;i="6.00,229,1681196400"; d="scan'208";a="687763539" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga006.jf.intel.com with ESMTP; 09 Jun 2023 07:40:05 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 9 Jun 2023 07:40:04 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.23 via Frontend Transport; Fri, 9 Jun 2023 07:40:04 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Fri, 9 Jun 2023 07:40:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=biNOKlGghXY3AiAshjXHBESREslg429Ocp8vUQCdzeHD5hsSld5yH3nUVm1H6IxTJe6z1FkhqAMM+HtYykiojtHp2YIYramFRTcD5zgqyM7U0YbNLq0yL7BaXYoPIqBYxuUGAVxsHO9HzyxpiNM2zZX6C/q7BpLlXF55IJTLzXQ6g0G2Svag614j9l8lyWYAQz+bFwK6r5XdOv8f8RnMzYppLTq9uEfrXGd3ehSxVQPlq4lIq47WDJcAJjoJuzgw3T2HnElr5jOh6r1s2jxjEGLLf37vP9fylSTIVxgli4nit0kNcidg7gFX9Es3LKMkIzV/oc2j5AbMl6MVu61vqw== 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=+3cUxhWdxutSl3mYmVOQyrb28TINXMfZtPiBwOTn+8s=; b=KKuDFo7Z4gIKfpGe6VjjJqT+dIlyFZB/PIB3EV3U4a8LAsXEd/W95jEGR+REJ9FuFBYlhkdFJPGlpvrIfjNqqOGydCIJ7hdP6MCkRS6ngvJv7pgbyrXnr6JunwBRikmgXBbxPsBP+oJhM/XFqmmrSE/5khP2dUOv1cnwF9RH8LsH/9SOi12ZU6NOC6gu0mEDnm8l5vdUAjQk/kAcp1eIDzpR3Zr3EEpUaUqRqmuolsWsHUSe8Q9LmHA/27CJJFu5ceATNzNUx8mwZ1xjF9uxnhYjkd6HRjNyAgRH8KgTestmmwTbJlKnz3H+JtfkwMj8BJWCZZvSE4ReR32qVe38uw== 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 Received: from MN0PR11MB6158.namprd11.prod.outlook.com (2603:10b6:208:3ca::18) by DM4PR11MB5342.namprd11.prod.outlook.com (2603:10b6:5:391::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19; Fri, 9 Jun 2023 14:40:04 +0000 Received: from MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::a50f:27de:660a:544d]) by MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::a50f:27de:660a:544d%4]) with mapi id 15.20.6455.037; Fri, 9 Jun 2023 14:40:04 +0000 From: "Wu, Jiaxin" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Bi, Dandan" , "Gao, Liming" , "Wang, Jian J" Subject: Re: [PATCH V2 5/6] MdeModulePkg/SmmPerformanceLib: Disable perf-logging after ExitBS Thread-Topic: [PATCH V2 5/6] MdeModulePkg/SmmPerformanceLib: Disable perf-logging after ExitBS Thread-Index: AQHZk7PvciKWu7nQDkuBqnUEP0SMm6+CmRug Date: Fri, 9 Jun 2023 14:40:04 +0000 Message-ID: References: <20230531113438.1797-1-ray.ni@intel.com> <20230531113438.1797-6-ray.ni@intel.com> In-Reply-To: <20230531113438.1797-6-ray.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6158:EE_|DM4PR11MB5342:EE_ x-ms-office365-filtering-correlation-id: 810bf1fb-893a-4d38-d678-08db68f769b4 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sWmKdMg/UFEZfaSXzLJysK8vti3ic9ilBt1HVxb6yfu0kJqos6bNtl/b0yJh0HNlO+NTbvSB/xCJ5UFMtKnK5fI/xawklBk8IGBdEDaJlzQ+3gHGHoZMKsJxNf7iYxxegxFnTRPZY/QmrXz8u14pdQabXci9Qbi4C4WtAUsQe7Xm9Xd2hpPRdyr+d/gBqEaO5+OM77/qBCaDkuw91hHgWYD0WYZxRlICeg1zdwtq2QF0rCN3J/gf443iXGY5fIBKV/yr+NlQ/ijDCzCUhtF2f2yiqsVuBjC+mrBPFQBGuWKsdJtvLtmQZLTnzbvmI4yZ5eZWXBs43WvlSPSTBEXb9y3jg4rnSOnvbgej4YjTD/audNmHq8MCDI2BjYclAXT7d43yHWAZ3nQbMkAIbG6UqPih9nv7QACKrPAZfTZMF/ewfOyVly0Ntng3iFeQqaAm8WyJHqnevaYKmgM2zuG6sr+98JEdEtre1G55bbaqKyBlfljd6Eea0iGP/ysHa/CJ2wfe52KKzvskxSsvcFT0oUIclgwtLmn/Bj5pz/45GN2fM+1OzgAFSJbUzb6XcF9yaXNuVMSIPj25E02evcUk/Os2iF4+dpmRTkPeNkBORBINXxzYb4kmMSz/rUlScT+C x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6158.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199021)(6506007)(53546011)(86362001)(186003)(82960400001)(107886003)(9686003)(55016003)(33656002)(26005)(7696005)(83380400001)(8676002)(71200400001)(8936002)(478600001)(5660300002)(110136005)(54906003)(38070700005)(52536014)(38100700002)(2906002)(316002)(41300700001)(66446008)(66946007)(66556008)(122000001)(4326008)(64756008)(76116006)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zgHlKxAZPH6zQZM6xECbjMiLIGBGNzB+4cAbypcGjSC9R7zQ54JM0ppgRHH9?= =?us-ascii?Q?QbTv+HbeIgm21h5Ysi2OwKGZ/uuxzGdIwIhTxg35yTdnNVo25QcpBfRECTP+?= =?us-ascii?Q?dC6gxObgHWgPSWqFb3Fh7UOQpM5JDMTR7QfU0vwdoxpNlbt8MkMpyvsfGEfs?= =?us-ascii?Q?58Ogb7xk45N6UZL3b4C1BfWyS5w5niB/CHim9EKOGcNufoR8HZoqZ3RmtBwN?= =?us-ascii?Q?22XXAbhvtQtcBnJT+W3suz+BzbWF2VaDmi0bP/COAyzLeY2obcoevTJvKfto?= =?us-ascii?Q?tahukkp6dreGTAO0qITv/dLK/r1WOeotkjHhejd0C91MJ/ZFohzXuVLef6jM?= =?us-ascii?Q?oNEfICmy0X1QyxcXupEAg2loTST7TYhBIEcUeeeeHKTX8ch+9kBaqsRJJxU+?= =?us-ascii?Q?syoyo4c++6F9+sMbnWexvk9YgO90lXPQOz9YbNLVHFjMys/8dDylD59mED2v?= =?us-ascii?Q?SaQ6vMVoucQYJh6AvHikunj+yBBGrq2pobvKDPioV7qO1oxXRuFzskVxivYJ?= =?us-ascii?Q?bZWWGiA5Vu2qAuFbOIRMhO2v+xERgEUhBo0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pl/4if41KyQENqW0f981iAw2AEY5qr9Md2eR4Bz7fFSlijTIIlqb?= =?us-ascii?Q?e2DrGcchOrygcxAI6kpY+/rRxSEIedYnYSC7bF3bpHK0GSgHiA9cUpJOk5sD?= =?us-ascii?Q?8I62vG8jvXKLjPnL1CsNoEsgwzkagL40KQPH4/Qh?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6158.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 810bf1fb-893a-4d38-d678-08db68f769b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jun 2023 14:40:04.2593 (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: H2jxwv8A37BSqgsnJFkAlZrOHljzT18APq98EIkaQj82ueLNHSMaVa6qLfBCXA8KjWUxhzMk3YRfneUt9RmUZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5342 Return-Path: jiaxin.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiaxin Wu > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, May 31, 2023 7:35 PM > To: devel@edk2.groups.io > Cc: Wu, Jiaxin ; Bi, Dandan ; > Gao, Liming ; Wang, Jian J > > Subject: [PATCH V2 5/6] MdeModulePkg/SmmPerformanceLib: Disable perf- > logging after ExitBS >=20 > Because SMM perf-logging is migrated to non-SMRAM at ReadyToBoot > by DxeCorePerformanceLib, the perf-logging after ExitBS is useless and > impact the SMI latency at runtime. > Hence the SmmPerformanceLib is updated to disable perf-logging > after ExitBS. >=20 > Cc: Jiaxin Wu > Cc: Dandan Bi > Cc: Liming Gao > Cc: Jian J Wang > --- > .../SmmPerformanceLib/SmmPerformanceLib.c | 63 > ++++++++++++++++++- > .../SmmPerformanceLib/SmmPerformanceLib.inf | 4 ++ > 2 files changed, 66 insertions(+), 1 deletion(-) >=20 > diff --git > a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c > b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c > index 623f8a978c..b9c33c0f64 100644 > --- a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c > +++ b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c > @@ -23,6 +23,36 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // The cached SMM Performance Protocol and SMM PerformanceEx > Protocol interface. >=20 > EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL > *mPerformanceMeasurement =3D NULL; >=20 > BOOLEAN mPerformanceMeasurementEnabled; >=20 > +VOID *mPerformanceLibExitBootServices= Registration; >=20 > + >=20 > +/** >=20 > + This is the Event call back function is triggered in SMM to notify the= Library >=20 > + the system is entering runtime phase. >=20 > + >=20 > + @param[in] Protocol Points to the protocol's unique identifier >=20 > + @param[in] Interface Points to the interface instance >=20 > + @param[in] Handle The handle on which the interface was installed >=20 > + >=20 > + @retval EFI_SUCCESS SmmAtRuntimeCallBack runs successfully >=20 > + **/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmPerformanceLibExitBootServicesCallback ( >=20 > + IN CONST EFI_GUID *Protocol, >=20 > + IN VOID *Interface, >=20 > + IN EFI_HANDLE Handle >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // Disable performance measurement after ExitBootServices because >=20 > + // 1. Performance measurement might impact SMI latency at runtime; >=20 > + // 2. Performance log is copied to non SMRAM at ReadyToBoot so runtime > performance >=20 > + // log is not useful. >=20 > + // >=20 > + mPerformanceMeasurementEnabled =3D FALSE; >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 >=20 >=20 > /** >=20 > The constructor function initializes the Performance Measurement Enabl= e > flag >=20 > @@ -40,9 +70,40 @@ SmmPerformanceLibConstructor ( > IN EFI_SYSTEM_TABLE *SystemTable >=20 > ) >=20 > { >=20 > + EFI_STATUS Status; >=20 > + >=20 > mPerformanceMeasurementEnabled =3D (BOOLEAN)((PcdGet8 > (PcdPerformanceLibraryPropertyMask) & > PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) !=3D 0); >=20 >=20 >=20 > - return EFI_SUCCESS; >=20 > + Status =3D gSmst->SmmRegisterProtocolNotify ( >=20 > + &gEdkiiSmmExitBootServicesProtocolGuid, >=20 > + SmmPerformanceLibExitBootServicesCallback, >=20 > + &mPerformanceLibExitBootServicesRegistration >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + return Status; >=20 > +} >=20 > + >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmPerformanceLibDestructor ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + // >=20 > + // Unregister SmmExitBootServices notification. >=20 > + // >=20 > + Status =3D gSmst->SmmRegisterProtocolNotify ( >=20 > + &gEdkiiSmmExitBootServicesProtocolGuid, >=20 > + NULL, >=20 > + &mPerformanceLibExitBootServicesRegistration >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + return Status; >=20 > } >=20 >=20 >=20 > /** >=20 > diff --git > a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf > b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf > index d79cd5c8da..002462f5ca 100644 > --- a/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf > +++ > b/MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf > @@ -21,6 +21,7 @@ > LIBRARY_CLASS =3D PerformanceLib|DXE_SMM_DRIVER >=20 >=20 >=20 > CONSTRUCTOR =3D SmmPerformanceLibConstructor >=20 > + DESTRUCTOR =3D SmmPerformanceLibDestructor >=20 >=20 >=20 > # >=20 > # The following information is for reference only and not required by th= e > build tools. >=20 > @@ -46,5 +47,8 @@ > [Guids] >=20 > gEdkiiSmmPerformanceMeasurementProtocolGuid ## > SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol >=20 >=20 >=20 > +[Protocols] >=20 > + gEdkiiSmmExitBootServicesProtocolGuid ## CONSUMES >=20 > + >=20 > [Pcd] >=20 > gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## > CONSUMES >=20 > -- > 2.39.1.windows.1