From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.525.1686886065491678659 for ; Thu, 15 Jun 2023 20:27:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZWxwNj7a; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: jian.j.wang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686886065; x=1718422065; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xFBFdLpGbM0YVm2E89vssYjJrcP70Ox6fR26LZMcOQU=; b=ZWxwNj7a+XsHWMPd58Gkprm3ilpSN+HNgh8vgsVsGajnRe9OsOgbJ8JU m3QCQeO+EKcCc/g1mIosUZAMlj+saxDYOgja/NTr0zCCAynDe8/QzApXy sjHFIxa2Nr2gfWg2gjnV9LHocycvEZSqXIXZ4mgC1hTfYl0WgueVIqVGT rt+ElYD6s8orcWDZ0pgho/adSDOF3gcBpVpnkzk3ijgO+ZzuPi3TqRIhM hnUIU/D1QzMO7opTwU4J7XiFl22ofwX6QqyKqPx1wOEj3LSUZqbS//WDu dxqBE0UmRqrMd8kA+OkWscfw7zihAYclKfFF+OdY5mvXZzkKgjGfMjTyt A==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="445486587" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="445486587" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 20:27:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825561263" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="825561263" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 15 Jun 2023 20:27:45 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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; Thu, 15 Jun 2023 20:27:44 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 15 Jun 2023 20:27:44 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 15 Jun 2023 20:27:44 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) 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; Thu, 15 Jun 2023 20:27:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LW6RpgeOygC7q+lq+H4oK+kKyMyIQcwfh0AcyjOCah/1yHsoG4Hlw9jje5HwVBNeZbgoO+q+Pa3zrW+cZQOatwb0WY4O0/5K/SGKcGMAFcP4Hi4WUm4E+Y2pczsyC2a147Q2Pq3eybGRQW4IybPWtoP8dXD7QN4Sx6AQDmKWH6mtdarTAmzGZXMCyuMR+yFl/58YYnmM+kJ1PCmzHYG62gRLAIBXfJLSVpPIjvXfC0ldwUHJ8Q9CbkYWjTp4ZlruAclEbvBeUx2KQIZKwNgSqp3ZA/0ioEdqPQ/1oBD3xA140k4LL89NBT7147XM+cVR/stpfBOCuIsVpo72PQpV/w== 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=EcjdNe0YLnC2LFIUX4vIM0MoA0apjKzTDSpjfIuzFUk=; b=BLXJHOqN11QCO3pd3KGqOiFVX/YHI1OEbM2M6lN1o9ioL7bVlP4U9dM8TBXJoXBcuBliJlpHao6ywv9kouFKgsv6ORj89JwvVqqv+UzOq0Bm8sENWXS+BmwE/jkq8cWKCDjYGuTPBP79Y5zkE7QCE48ZJemi072Ph8acysPPfsjgY1P3q12hlaEz/buyeDyLwQKJjdbXv7xDcb6YkDAWSsCWWN0Ltk7mXbARCTHyEMPm5zb9mtb3E8RqwYf9RJbjIwngckM2Zfy0kJP2qfTqO/9vBMZGB2rXImk5T0hb29923012r9pnWDQWbJoASXgOZGDhulwU5GzSypXat8PgeQ== 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 SN7PR11MB6749.namprd11.prod.outlook.com (2603:10b6:806:267::22) by MN2PR11MB4631.namprd11.prod.outlook.com (2603:10b6:208:262::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.27; Fri, 16 Jun 2023 03:27:36 +0000 Received: from SN7PR11MB6749.namprd11.prod.outlook.com ([fe80::44ba:3af9:1e34:cf53]) by SN7PR11MB6749.namprd11.prod.outlook.com ([fe80::44ba:3af9:1e34:cf53%7]) with mapi id 15.20.6500.025; Fri, 16 Jun 2023 03:27:36 +0000 From: "Wang, Jian J" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Wu, Jiaxin" , "Bi, Dandan" , "Gao, Liming" , "Dong, Eric" Subject: Re: [PATCH V3 5/8] MdeModulePkg/SmmPerformanceLib: Disable perf-logging after ExitBS Thread-Topic: [PATCH V3 5/8] MdeModulePkg/SmmPerformanceLib: Disable perf-logging after ExitBS Thread-Index: AQHZnb46hDOI+N3/z0yEcAQq+uaXQq+MyXbA Date: Fri, 16 Jun 2023 03:27:35 +0000 Message-ID: References: <20230613061325.1664-1-ray.ni@intel.com> <20230613061325.1664-6-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-6-ray.ni@intel.com> Accept-Language: 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: SN7PR11MB6749:EE_|MN2PR11MB4631:EE_ x-ms-office365-filtering-correlation-id: d6d5363f-86bc-4aa3-96e4-08db6e19a0e5 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: QcguPawvLY/BPyqhjx1Sxgg2ojd2u5+yjrY7ONbV+BpMlFjTAFRKD7nPHRhICS3vyAy7Hz2e4qcwtIAgTYW1OHc4Dnhba336+myVkS+AGtplPcwo6Ufnt9MPCOZkWZSH3inqobxd/RPGfQPM+b+liZ/OTHv8HR87JsAT5VqNCVapkmkeqifJlqb9hjnKEHg3fi8+x9BgAKVovLviEp9tlmFz9UHKyIyrGzh8dJn2ZZI1ROEMbPpYU/otS0rSHNJm92lfClTPxFC1KqlfS+qSxNTLndtmGLFI9NuJpG2ryKvNYcpZ6v9JWufZrKpBqSOQJKyZ/SKMe9ziPnslgUNTE2Tj7jya8oOxZNggXtOTJPaD0P7USj7i8HG8Wsl8K1obZE2d2a3fRB0A2dRb0ZcgQT63l+8OiOjtFFDcZxN1VAEzY4ZsNhECKfr9XOvAjb8I1mw4WDZdcffCTxXUvrbEvldTpg1rPY5ifQfX1exGwCGqzqR03muYBDG8hjQK8RtyMagnlwU/7+QJcdo5ZJwe7vgzLyLM4jwcqVKGa9WjEJK87v57l8ByvfWW/b8REM3gN7NIO8zjHttjD7XAvyl0ao+TN4TML/8pyT9wnpMKvjseVJl23CCoLbYpfTj5nEmK x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR11MB6749.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(366004)(376002)(136003)(39860400002)(346002)(451199021)(110136005)(54906003)(41300700001)(8676002)(86362001)(7696005)(64756008)(66946007)(66556008)(66476007)(66446008)(8936002)(316002)(33656002)(71200400001)(4326008)(76116006)(38070700005)(9686003)(478600001)(26005)(107886003)(55016003)(5660300002)(52536014)(83380400001)(6506007)(53546011)(2906002)(186003)(82960400001)(38100700002)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WnQ61ankc6m5zqKOszaekN1//qaBaT35xq6ObkLJswnNZselw+A2gvRzv5ma?= =?us-ascii?Q?YlKxSjvmWsAG2KG60Nk/Lp9IF8lsuF7B/wRcd7Lay+8Q0N6CdU/yAV0iheiI?= =?us-ascii?Q?EG17eX67ncMQBYAsVkKiwr1T4cuG3VrliiLKPzhj0LqwxugTlkDJ9YqfDi+c?= =?us-ascii?Q?rhXR6w+MvIBfwvT5fgJgRA6mOpomhZQLH1gTGsEDf82LhJFHgJmlf4NJHJ2w?= =?us-ascii?Q?zOvritnii0+0q/lK9FOvBjaECi5jpMitv5LX8OTT+KjZ3xXSAtjBgh65cJkp?= =?us-ascii?Q?SqT4P7coClgOhiCF/rFuyVQGhS9xBIlaghwJ3RQpF9E5eDqHdVvBieNaUq5i?= =?us-ascii?Q?gYbEBUrxoE7zuHS9HADZiv9se5srBgXl6tNLcwtR1tdWlbdyW3QjYjR4ONiU?= =?us-ascii?Q?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jExdkY46GY4mXOH?= =?us-ascii?Q?XjD79jO0P+W2noi97wJyRfqZeaFBWYRk2CMziD1ZCcpN2es42ZQnhEvAaSVz?= =?us-ascii?Q?3dlLk9E1Rz9xMBlUBNDQ65Bp6+M+UkOY4tEL9DXebFaukbVYwBmFwG+7BO1W?= =?us-ascii?Q?tYXFobvbtMTVJWfCwCieSWBiLV70KN/JuXvLq5FxbUWNKrSWO2wqAF/QMTLk?= =?us-ascii?Q?tN8JgwQEo0nZIHr5wDMg0ewK/NXllbjrm7fxqPFVC5x3H2nSJpTQPX5/k72X?= =?us-ascii?Q?Ecsy2v9LzAoYKUSurqn9g00dLjqsB7QuyHEivlMQ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB6749.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6d5363f-86bc-4aa3-96e4-08db6e19a0e5 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2023 03:27:35.5156 (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: VZajdIhGpLULWC1hLLRCxMu5LmPDJ0D1/xeIuEBgwGHCGxlVOq1bhGx/HVPdbHZP1ntjatvUg7QlK0MN/oX1Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4631 Return-Path: jian.j.wang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang Regards, Jian > -----Original Message----- > From: Ni, Ray > Sent: Tuesday, June 13, 2023 2:13 PM > To: devel@edk2.groups.io > Cc: Wu, Jiaxin ; Bi, Dandan ; G= ao, > Liming ; Wang, Jian J ; > Dong, Eric > Subject: [PATCH V3 5/8] 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 > Reviewed-by: Jiaxin Wu > Reviewed-by: Eric Dong > --- > .../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