From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 3B67A211A2DBC for ; Wed, 19 Dec 2018 18:06:38 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:06:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="100092303" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga007.jf.intel.com with ESMTP; 19 Dec 2018 18:06:37 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 18:06:37 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 18:06:36 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Thu, 20 Dec 2018 10:06:34 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: Laszlo Ersek Thread-Topic: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. Thread-Index: AQHUmAGgHTQZvpBM/UOAE1hplxhvY6WGTfKAgAABBICAAJIMcA== Date: Thu, 20 Dec 2018 02:06:34 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BF673E1@SHSMSX104.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> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: 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:06:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Can you just change the AcquireSpinLock() behavior to remove the Timeout PC= D consumption? I haven't seen a real case that the timed acquisition of spin lock is neede= d. Thanks/Ray > -----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: Avoid > AP calls PeiService. >=20 >=20 > Agreed, Maybe it's time to add a new API like > AcquireSpinLockWithoutTimeOut? >=20 > 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: Avoid > > > 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