From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: star.zeng@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Fri, 12 Jul 2019 03:53:04 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2019 03:53:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,482,1557212400"; d="scan'208";a="365125316" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 12 Jul 2019 03:53:04 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 12 Jul 2019 03:53:03 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 12 Jul 2019 03:53:03 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.3]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.55]) with mapi id 14.03.0439.000; Fri, 12 Jul 2019 18:53:01 +0800 From: "Zeng, Star" To: "Dong, Eric" , "devel@edk2.groups.io" CC: "Ni, Ray" , Laszlo Ersek , "Kumar, Chandana C" , "Zeng, Star" Subject: Re: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service. Thread-Topic: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service. Thread-Index: AQHVOFSi9dm/g3XnO06/5SqQyDDAfabGzeSw Date: Fri, 12 Jul 2019 10:53:00 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB04831040363B2C@shsmsx102.ccr.corp.intel.com> References: <20190712015308.26492-1-eric.dong@intel.com> <20190712015308.26492-2-eric.dong@intel.com> In-Reply-To: <20190712015308.26492-2-eric.dong@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: star.zeng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Some minor comments inline. > -----Original Message----- > From: Dong, Eric > Sent: Friday, July 12, 2019 9:53 AM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Laszlo Ersek ; Kumar, > Chandana C ; Zeng, Star > > Subject: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gB= S > service. "gBS service" is not match with the assertion information, gBS is the conce= pt in DXE phase. So here, please "PEI service" to be accurate. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1972 >=20 > AP calls CollectProcessorData() to collect processor info. > CollectProcessorData function finally calls PcdGetSize function to > get DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use gBS Same comments with above. > which caused below assert info: > Processor Info: Package: 1, MaxCore : 4, MaxThread: 1 > Package: 0, Valid Core : 4 > ASSERT [CpuFeaturesPei] c:\projects\jsl\jsl_v1193\Edk2\MdePkg\Library > \PeiServicesTablePointerLibIdt\PeiServicesTablePointer.c(48): > PeiServices !=3D ((void *) 0) >=20 > This change uses saved global pcd size instead of calls PcdGetSize to > fix this issue. >=20 > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Cc: Star Zeng > Signed-off-by: Eric Dong > --- > .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 13 ++++++++----- > .../RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 5 +++++ > 2 files changed, 13 insertions(+), 5 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index aff7ad600c..87bfc64250 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -246,19 +246,20 @@ CpuInitDataInitialize ( >=20 > @param[in] SupportedFeatureMask The pointer to CPU feature bits mask > buffer > @param[in] OrFeatureBitMask The feature bit mask to do OR operat= ion > + @param[in] BitMaskSize The CPU feature bits mask buffer siz= e. > + > **/ > VOID > SupportedMaskOr ( > IN UINT8 *SupportedFeatureMask, > - IN UINT8 *OrFeatureBitMask > + IN UINT8 *OrFeatureBitMask, > + IN UINT32 BitMaskSize > ) > { > UINTN Index; > - UINTN BitMaskSize; > UINT8 *Data1; > UINT8 *Data2; >=20 > - BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSetting); > Data1 =3D SupportedFeatureMask; > Data2 =3D OrFeatureBitMask; > for (Index =3D 0; Index < BitMaskSize; Index++) { > @@ -384,12 +385,14 @@ CollectProcessorData ( > // > SupportedMaskOr ( > CpuFeaturesData- > >InitOrder[ProcessorNumber].FeaturesSupportedMask, > - CpuFeature->FeatureMask > + CpuFeature->FeatureMask, > + CpuFeaturesData->BitMaskSize > ); > } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, > CpuFeature->ConfigData)) { > SupportedMaskOr ( > CpuFeaturesData- > >InitOrder[ProcessorNumber].FeaturesSupportedMask, > - CpuFeature->FeatureMask > + CpuFeature->FeatureMask, > + CpuFeaturesData->BitMaskSize > ); > } > Entry =3D Entry->ForwardLink; > diff --git > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > index fa0f0b41e2..36aabd7267 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > +++ > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c > @@ -658,6 +658,11 @@ RegisterCpuFeatureWorker ( > InitializeListHead (&CpuFeaturesData->FeatureList); > InitializeSpinLock (&CpuFeaturesData->CpuFlags.MemoryMappedLock); > InitializeSpinLock (&CpuFeaturesData->CpuFlags.ConsoleLogLock); > + // > + // Driver has assumption that these three PCD should has same buffer > size. It is library, not driver. So how about "The code has assumption that these= three PCDs should have same buffer size."? The proposed sentence also uses 'PCDs' and 'have'. With the comments handled, Reviewed-by: Star Zeng Thanks, Star > + // > + ASSERT (PcdGetSize (PcdCpuFeaturesSetting) =3D=3D PcdGetSize > (PcdCpuFeaturesCapability)); > + ASSERT (PcdGetSize (PcdCpuFeaturesSetting) =3D=3D PcdGetSize > (PcdCpuFeaturesSupport)); > CpuFeaturesData->BitMaskSize =3D (UINT32) BitMaskSize; > } > ASSERT (CpuFeaturesData->BitMaskSize =3D=3D BitMaskSize); > -- > 2.21.0.windows.1