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.120; helo=mga04.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 21F9B211A2DBC for ; Wed, 19 Dec 2018 18:08:05 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:08:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="305267189" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 19 Dec 2018 18:08:04 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 18:08:04 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.182]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.201]) with mapi id 14.03.0415.000; Thu, 20 Dec 2018 10:08:00 +0800 From: "Yao, Jiewen" To: "Ni, Ruiyu" , "Dong, Eric" , "edk2-devel@lists.01.org" CC: Laszlo Ersek Thread-Topic: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. Thread-Index: AQHUmAGXF6hD6J9pekaBvnpz3ItKQ6WG0+KQ//97FICAAAwtAIAAhkIg Date: Thu, 20 Dec 2018 02:08:00 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F4610D1@shsmsx102.ccr.corp.intel.com> References: <20181220011553.14900-1-eric.dong@intel.com> <20181220011553.14900-2-eric.dong@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503F460E44@shsmsx102.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5BF673E1@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BF673E1@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDIyMDVlMDktMzk2Mi00ZDc3LWJjOWItOTlmYjE5MThkMTMwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibzZSQTcrYUNRNFd0QmQwVFFGODVCWldsbW5CSVBwNlF2OU5QamVlN2lnK0tcL05KV05FSTNHNCthM2M3eUNJSUUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2018 02:08:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, I agree, if we don't have any real case. > -----Original Message----- > From: Ni, Ruiyu > Sent: Thursday, December 20, 2018 10:07 AM > To: Dong, Eric ; Yao, Jiewen > ; edk2-devel@lists.01.org > Cc: Laszlo Ersek > Subject: RE: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid > AP calls PeiService. >=20 > Can you just change the AcquireSpinLock() behavior to remove the Timeout > PCD consumption? >=20 > I haven't seen a real case that the timed acquisition of spin lock is nee= ded. >=20 >=20 > Thanks/Ray >=20 > > -----Original Message----- > > From: Dong, Eric > > Sent: Thursday, December 20, 2018 9:23 AM > > To: Yao, Jiewen ; edk2-devel@lists.01.org > > Cc: Ni, Ruiyu ; Laszlo Ersek > > Subject: RE: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoi= d > > AP calls PeiService. > > > > > > Agreed, Maybe it's time to add a new API like > > AcquireSpinLockWithoutTimeOut? > > > > Thanks, > > Eric > > > -----Original Message----- > > > From: Yao, Jiewen > > > Sent: Thursday, December 20, 2018 9:19 AM > > > To: Dong, Eric ; edk2-devel@lists.01.org > > > Cc: Ni, Ruiyu ; Laszlo Ersek > > > Subject: RE: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: > > > Avoid AP calls PeiService. > > > > > > Hi > > > If we think below code is generic, can we have an API for that? > > > > > > + // > > > + // Wait for the AP to release the MSR spin lock. > > > + // > > > + while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) { > > > + CpuPause (); > > > + } > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf > > > > Of Eric Dong > > > > Sent: Thursday, December 20, 2018 9:16 AM > > > > To: edk2-devel@lists.01.org > > > > Cc: Ni, Ruiyu ; Laszlo Ersek > > > > Subject: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoi= d > > > > AP calls PeiService. > > > > > > > > In AcquireSpinLock function, it calls GetPerformanceCounter which > > > > final calls PeiService service. This patch avoid to call > > > > AcquireSpinLock function. > > > > > > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1411 > > > > > > > > Cc: Ruiyu Ni > > > > Cc: Laszlo Ersek > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Eric Dong > > > > --- > > > > UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c = | > > > > 7 > > > > ++++++- > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > diff --git > > > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > > > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > > > > index 624ddee055..a64326239f 100644 > > > > --- > > > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > > > > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize. > > > > +++ c > > > > @@ -832,7 +832,12 @@ ProgramProcessorRegister ( > > > > RegisterTableEntry =3D &RegisterTableEntryHead[Index]; > > > > > > > > DEBUG_CODE_BEGIN (); > > > > - AcquireSpinLock (&CpuFlags->ConsoleLogLock); > > > > + // > > > > + // Wait for the AP to release the MSR spin lock. > > > > + // > > > > + while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) { > > > > + CpuPause (); > > > > + } > > > > ThreadIndex =3D ApLocation->Package * > CpuStatus->MaxCoreCount * > > > > CpuStatus->MaxThreadCount + > > > > ApLocation->Core * CpuStatus->MaxThreadCount + > > > > ApLocation->Thread; > > > > -- > > > > 2.15.0.windows.1 > > > > > > > > _______________________________________________ > > > > edk2-devel mailing list > > > > edk2-devel@lists.01.org > > > > https://lists.01.org/mailman/listinfo/edk2-devel