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=eric.dong@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 30E0B2119307C for ; Wed, 19 Dec 2018 17:23:05 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 17:23:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,374,1539673200"; d="scan'208";a="111971754" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 19 Dec 2018 17:23:04 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 17:23:04 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.182]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.222]) with mapi id 14.03.0415.000; Thu, 20 Dec 2018 09:22:59 +0800 From: "Dong, Eric" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , Laszlo Ersek Thread-Topic: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. Thread-Index: AQHUmAGX/fDvKfBfyEu9xGF40WkoqqWGTfKAgACGwnA= Date: Thu, 20 Dec 2018 01:22:59 +0000 Message-ID: References: <20181220011553.14900-1-eric.dong@intel.com> <20181220011553.14900-2-eric.dong@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503F460E44@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503F460E44@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US 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 01:23:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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. >=20 > Hi > If we think below code is generic, can we have an API for that? >=20 > + // > + // Wait for the AP to release the MSR spin lock. > + // > + while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) { > + CpuPause (); > + } >=20 >=20 >=20 >=20 > > -----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