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.web10.468.1686885559189996716 for ; Thu, 15 Jun 2023 20:19:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=DBYnArmM; 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=1686885559; x=1718421559; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=CoLsqb2tu3Q3V1dtKEfqWM6P4cuY/rjFxrZHM/3j320=; b=DBYnArmMCHb9WvMhm5NwkhZEG0cEJgwzTq+q+lEijCSs/we2S+fiUyEB wZb/NjlqqKs0wc1frj+8Q/jiyqiqBJ9Fx19DvFrPBItIRsDKXrwDhHTHC giCEMyja80j8iWT4MUV509MrFHwgp/jFSIsMV+797hnPglyJBkFpCRnuv qtJqRS0nTgS4jKlBrNGIVoa6QSrJatueRcLIb3bld+4dOwOdeozA1hJix VWsk+IMiyNZxkNQhH1Dq1sxGyjhbMI45zfciBYYow10gBiZzzC/V1dji4 FRVEtdHpDLc9k+5lHRnryP7coL+HXrj8elU15sP98/BfUzXZgqaRG9hXZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="445484749" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="445484749" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 20:19:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="690042965" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="690042965" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 15 Jun 2023 20:19:18 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) 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:19:18 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX611.amr.corp.intel.com (10.22.229.24) 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:19:17 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) 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:19:17 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) by edgegateway.intel.com (134.134.137.102) 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:19:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYpLmA91BxyGf9WPSEBzfYe7AZAaV/7kXZyJndUHOXv0+HqNb+loSjF++LX3TAb909cvBZoVWxxSsrueUUnuzCD3k+sX8GImN7RCcvkWeGJMdbTlaNdL/8oY+TSF7muiwdsRKgSESyVKfGY/2TahSpnpUUSnyc/fpDP1skPrj2fnZWrPc98YAB9jiKZtDs1B0E/rv38MFGtjGJyUlSV820eEkjaugSDEiYezkjVuGgD1jpknYvr1KD8ieaPJKtG+VovIQ8kqxp4G6dmcjtwHYE/11ehe6Y9y4huKaWGq9RgD7+XDaiZon7x1jMApBaXRmfLX4DmAJA55nyatgqTA2w== 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=l6N2NJJOW53iq4RJ9zoMt6SP/CJPdlAOYipzCm1V8LA=; b=FZQPK+pktOlFo7OcpqAQSwe4pxrfKc0qJwfTHdMbUtGBvIdiydhX5XGpXox8XtTWUiP5iefaiEB2X3SPCHq1BNGwduKRsFf0NRRwsqB86XW2dvF8ZtgsuFeMxqGAnkUBfTT8vCCgLrtefAUYAKvW5rryFKzZt3TVoIKd3Wp5PSZISSQd9ehevhy2ePYX86jLNJgdxIedYm48uozhKtOiBqeUIrlZF1JKbZZueKto63q3QRctQBO8DM/mU1Hjnb2gcfEA+dEWqLrZtMy1QGC2/VVPvAfGX6vtkL3Klq3Jwre4mUOww8TspWhFSew/obMrGDBZ1SeMu6jtErko6U1Hmw== 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 SN7PR11MB7509.namprd11.prod.outlook.com (2603:10b6:806:346::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 03:19:15 +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:19:15 +0000 From: "Wang, Jian J" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Wu, Jiaxin" , "Dong, Eric" Subject: Re: [PATCH V3 3/8] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures Thread-Topic: [PATCH V3 3/8] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures Thread-Index: AQHZnb4zXTO8xNSW3kWDkKg7vMfITq+MxxcQ Date: Fri, 16 Jun 2023 03:19:15 +0000 Message-ID: References: <20230613061325.1664-1-ray.ni@intel.com> <20230613061325.1664-4-ray.ni@intel.com> In-Reply-To: <20230613061325.1664-4-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_|SN7PR11MB7509:EE_ x-ms-office365-filtering-correlation-id: 8d7ed60c-505d-4d7f-abd3-08db6e1876e9 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: RzICoKYJSgojIoX2Mb2pAjoij25lWmmGdRFKIRmGpKsANj50vijHFCR6ii9yqJ5NyPWCisvW+yYO1tfcIQVPfkEdVqqC3qwFO4/u3EK45pMobALbDwUvPUXwmwO6NUxbZReSL+s4g4yUCIKo0kpcogRrYbuBevwX9rQLCZF2Zk0zwGNPTXpccyzH2Qj+FxooxWUBpevIwWz8HPxFh/hb6PHXA/EgQHFxgzrEuqV+Rf4aNc5TPHexjPb3nuWeIgiCJKT3A/5I2mQHv4YlNaIf1KC6oI4wusMJE4hgJ96Odctftd51XgrSQK0sBUSGkFVXQGHHtEDc4zksqDjddE1qqCR0lr3QOGslcYC7w+lvp7eIW0w0nkX84EZBCkO+h5PLgk7ulSVGg1Ph6HeXPilo9xnSeUrPLXk+L2u+pB/Js4dliW+JFB+98tDJjAqRty2trkLBmEn4goMp0kGf6IdIWps8tmAGMHSpWpzCfXps0HCsSZB10MqXYPtgLe+NRibFNZA0ArysEYiPqT5A5UyP+bVMRxPUBDVvxQvzGKh0zm9vItMPS2F9Q5TquMW5qZoSOWiTBhh9f5y1ywiosb0xmuZw04pQuEhA1458Nk404Od6hDb+uV6otZTEVDLDkLsJ 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)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199021)(26005)(7696005)(8936002)(9686003)(8676002)(41300700001)(82960400001)(478600001)(71200400001)(66446008)(66556008)(4326008)(66946007)(66476007)(38100700002)(86362001)(76116006)(64756008)(54906003)(38070700005)(316002)(33656002)(122000001)(110136005)(53546011)(55016003)(6506007)(52536014)(83380400001)(5660300002)(186003)(107886003)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hJuJNvLZVIMhDmrXZEAtRagOxAs03VlMhJ+hZ5AICzPgQR8wJbB5f/60avNb?= =?us-ascii?Q?Px0YurB3bSHghJSDDxOGHGgCDEvqNUDqL2Nl1Vv72WZzyt4J1QA4zcGotp7C?= =?us-ascii?Q?xcI00mrb3CDv5uwEEUN3psf2eAtlZBhcUzAbqsMxi2HZ5K6FTfCM6QJ28LkW?= =?us-ascii?Q?8v0+cyLKWwNrLQ0o3o7doNdxUAqjh9/NKyr9z8kZGFNpgYgXUxX/5Kg0de3v?= =?us-ascii?Q?f+nKSPziuPYKDV2WUT+eoHarrU+RhI9MsSNiiltthBRpWZGRt//fC/KTc+2c?= =?us-ascii?Q?CpD9BkNLzYwhgl3zZVoEvIz94cE5hr2CLOo7VWj18okDY9O7/8vV0MNAR3Ib?= =?us-ascii?Q?b18fUWA8+C6bEReBRt/IRc4lUsoHaE4DJtZIfGqTvEtk3QmNWKJbjlS3S2KL?= =?us-ascii?Q?S23lz0/AJ0TEwISMMXYvj3ic95pKQMhbGZ2qDildACi4uZQqyXL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Vjpys+c3cWZrfIraGw6SEjf7UMk5kc?= =?us-ascii?Q?iGTgluJq0i+YkqEPxgotkjMW2nqp+xPGvytrIz0ofyIKWoBIVGe0oM2Z0Hug?= =?us-ascii?Q?VYFlxOwAav9QGPIB5l8hT6I9k47HHHF3bQlO6Jx3Ess84Tt5iXF8G+Q3hEZJ?= =?us-ascii?Q?/LbZ/5QOb1lv4kkgMET1WZVfYU1qZRrN3h9YNVqpHkagswEIpKH6NxSXjAc8?= =?us-ascii?Q?0TYhBOULgaBqG+hj7fCrYJBjKre8aKxoqh6znPE4?= 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: 8d7ed60c-505d-4d7f-abd3-08db6e1876e9 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2023 03:19:15.5705 (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: ot968chXu2gJSEOEN4TOjVQ+SaEqXyQKwvXEOQGvVGLnKL58yp/OaaWBmi7Mz6h0HHgAJvcaAoHvXhGGUn1Z4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7509 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: Wang, Jian J ; Gao, Liming > ; Wu, Jiaxin ; Dong, Eric > > Subject: [PATCH V3 3/8] MdeModulePkg/SmmCore: Add perf-logging for time- > consuming procedures >=20 > Following procedures are perf-logged: > * SmmReadyToBootHandler > * SmmReadyToLockHandler > * SmmEndOfDxeHandler > * SmmEntryPoint > (It's the main routine run in BSP when SMI happens.) > * SmiManage >=20 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Jiaxin Wu > Reviewed-by: Jiaxin Wu > Reviewed-by: Eric Dong > --- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 15 ++++++++++++++- > MdeModulePkg/Core/PiSmmCore/Smi.c | 6 ++++++ > 2 files changed, 20 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > index 875c7c0258..68af9ab81b 100644 > --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > @@ -1,7 +1,7 @@ > /** @file >=20 > SMM Core Main Entry Point >=20 >=20 >=20 > - Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > @@ -305,6 +305,8 @@ SmmReadyToBootHandler ( > EFI_STATUS Status; >=20 > EFI_HANDLE SmmHandle; >=20 >=20 >=20 > + PERF_CALLBACK_BEGIN (&gEfiEventReadyToBootGuid); >=20 > + >=20 > // >=20 > // Install SMM Ready To Boot protocol. >=20 > // >=20 > @@ -318,6 +320,7 @@ SmmReadyToBootHandler ( >=20 >=20 > SmiHandlerUnRegister (DispatchHandle); >=20 >=20 >=20 > + PERF_CALLBACK_END (&gEfiEventReadyToBootGuid); >=20 > return Status; >=20 > } >=20 >=20 >=20 > @@ -352,6 +355,8 @@ SmmReadyToLockHandler ( > EFI_HANDLE SmmHandle; >=20 > VOID *Interface; >=20 >=20 >=20 > + PERF_CALLBACK_BEGIN (&gEfiDxeSmmReadyToLockProtocolGuid); >=20 > + >=20 > // >=20 > // Unregister SMI Handlers that are no required after the SMM driver d= ispatch > is stopped >=20 > // >=20 > @@ -408,6 +413,7 @@ SmmReadyToLockHandler ( >=20 >=20 > SmramProfileReadyToLock (); >=20 >=20 >=20 > + PERF_CALLBACK_END (&gEfiDxeSmmReadyToLockProtocolGuid); >=20 > return Status; >=20 > } >=20 >=20 >=20 > @@ -442,6 +448,8 @@ SmmEndOfDxeHandler ( >=20 >=20 > DEBUG ((DEBUG_INFO, "SmmEndOfDxeHandler\n")); >=20 >=20 >=20 > + PERF_CALLBACK_BEGIN (&gEfiEndOfDxeEventGroupGuid); >=20 > + >=20 > // >=20 > // Install SMM EndOfDxe protocol >=20 > // >=20 > @@ -479,6 +487,7 @@ SmmEndOfDxeHandler ( > } >=20 > } >=20 >=20 >=20 > + PERF_CALLBACK_END (&gEfiEndOfDxeEventGroupGuid); >=20 > return EFI_SUCCESS; >=20 > } >=20 >=20 >=20 > @@ -669,6 +678,8 @@ SmmEntryPoint ( > VOID *CommunicationBuffer; >=20 > UINTN BufferSize; >=20 >=20 >=20 > + PERF_FUNCTION_BEGIN (); >=20 > + >=20 > // >=20 > // Update SMST with contents of the SmmEntryContext structure >=20 > // >=20 > @@ -769,6 +780,8 @@ SmmEntryPoint ( > // >=20 > gSmmCorePrivate->InSmm =3D FALSE; >=20 > } >=20 > + >=20 > + PERF_FUNCTION_END (); >=20 > } >=20 >=20 >=20 > /** >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c > b/MdeModulePkg/Core/PiSmmCore/Smi.c > index 6d13969979..2985f989c3 100644 > --- a/MdeModulePkg/Core/PiSmmCore/Smi.c > +++ b/MdeModulePkg/Core/PiSmmCore/Smi.c > @@ -109,6 +109,8 @@ SmiManage ( > BOOLEAN SuccessReturn; >=20 > EFI_STATUS Status; >=20 >=20 >=20 > + PERF_FUNCTION_BEGIN (); >=20 > + >=20 > Status =3D EFI_NOT_FOUND; >=20 > SuccessReturn =3D FALSE; >=20 > if (HandlerType =3D=3D NULL) { >=20 > @@ -125,6 +127,7 @@ SmiManage ( > // >=20 > // There is no handler registered for this interrupt source >=20 > // >=20 > + PERF_FUNCTION_END (); >=20 > return Status; >=20 > } >=20 > } >=20 > @@ -148,6 +151,7 @@ SmiManage ( > // no additional handlers will be processed and EFI_INTERRUPT_PE= NDING > will be returned. >=20 > // >=20 > if (HandlerType !=3D NULL) { >=20 > + PERF_FUNCTION_END (); >=20 > return EFI_INTERRUPT_PENDING; >=20 > } >=20 >=20 >=20 > @@ -160,6 +164,7 @@ SmiManage ( > // additional handlers will be processed. >=20 > // >=20 > if (HandlerType !=3D NULL) { >=20 > + PERF_FUNCTION_END (); >=20 > return EFI_SUCCESS; >=20 > } >=20 >=20 >=20 > @@ -194,6 +199,7 @@ SmiManage ( > Status =3D EFI_SUCCESS; >=20 > } >=20 >=20 >=20 > + PERF_FUNCTION_END (); >=20 > return Status; >=20 > } >=20 >=20 >=20 > -- > 2.39.1.windows.1