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=jiewen.yao@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 9ED5221199B31 for ; Wed, 19 Dec 2018 17:19:25 -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:19:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,374,1539673200"; d="scan'208";a="111970989" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 19 Dec 2018 17:19:25 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 17:19:24 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 17:19:24 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.182]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.203]) with mapi id 14.03.0415.000; Thu, 20 Dec 2018 09:19:22 +0800 From: "Yao, Jiewen" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , Laszlo Ersek Thread-Topic: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. Thread-Index: AQHUmAGXF6hD6J9pekaBvnpz3ItKQ6WG0+KQ Date: Thu, 20 Dec 2018 01:19:21 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F460E44@shsmsx102.ccr.corp.intel.com> References: <20181220011553.14900-1-eric.dong@intel.com> <20181220011553.14900-2-eric.dong@intel.com> In-Reply-To: <20181220011553.14900-2-eric.dong@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDk1NzNhMTgtZTAzMi00YTdiLWJlOWMtMjVmZjU0YzJhZGYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWERXZ0J3UkhNeUJkbXptb1BzbW9PVWN1V3AxTElTM2ViXC9sbHVxaWNpNkJkclwvbXRsb1htVWZWZzVTVnhDNkpSIn0= 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 01:19:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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. >=20 > In AcquireSpinLock function, it calls GetPerformanceCounter which > final calls PeiService service. This patch avoid to call > AcquireSpinLock function. >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1411 >=20 > 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(-) >=20 > 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]; >=20 > 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 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel