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.88, mailfrom: ray.ni@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Sun, 14 Jul 2019 21:59:26 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jul 2019 21:59:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,493,1557212400"; d="scan'208";a="174992226" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 14 Jul 2019 21:59:26 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jul 2019 21:59:26 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jul 2019 21:59:26 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.55]) with mapi id 14.03.0439.000; Mon, 15 Jul 2019 12:59:24 +0800 From: "Ni, Ray" To: "Zeng, Star" , "Dong, Eric" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Chandana C" 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: AQHVOJ/5CILbJn2cP0OS9RRgzTbnvKbLInzA Date: Mon, 15 Jul 2019 04:59:23 +0000 Deferred-Delivery: Mon, 15 Jul 2019 04:58:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C22D0FC@SHSMSX104.ccr.corp.intel.com> References: <20190712015308.26492-1-eric.dong@intel.com> <20190712015308.26492-2-eric.dong@intel.com> <0C09AFA07DD0434D9E2A0C6AEB04831040363B2C@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB04831040363B2C@shsmsx102.ccr.corp.intel.com> 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 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Zeng, Star > Sent: Friday, July 12, 2019 6:53 PM > 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 call= s > gBS service. >=20 > Some minor comments inline. >=20 > > -----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 > > gBS service. >=20 > "gBS service" is not match with the assertion information, gBS is the con= cept > in DXE phase. > So here, please "PEI service" to be accurate. >=20 > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1972 > > > > AP calls CollectProcessorData() to collect processor info. > > CollectProcessorData function finally calls PcdGetSize function to get > > DynamicPCD PcdCpuFeaturesSetting value. PcdGetSize will use gBS >=20 > Same comments with above. >=20 > > 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) > > > > This change uses saved global pcd size instead of calls PcdGetSize to > > fix this issue. > > > > 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(-) > > > > 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 ( > > > > @param[in] SupportedFeatureMask The pointer to CPU feature bits > > mask buffer > > @param[in] OrFeatureBitMask The feature bit mask to do OR > operation > > + @param[in] BitMaskSize The CPU feature bits mask buffer s= ize. > > + > > **/ > > VOID > > SupportedMaskOr ( > > IN UINT8 *SupportedFeatureMask, > > - IN UINT8 *OrFeatureBitMask > > + IN UINT8 *OrFeatureBitMask, > > + IN UINT32 BitMaskSize > > ) > > { > > UINTN Index; > > - UINTN BitMaskSize; > > UINT8 *Data1; > > UINT8 *Data2; > > > > - 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. >=20 > It is library, not driver. So how about "The code has assumption that the= se > three PCDs should have same buffer size."? > The proposed sentence also uses 'PCDs' and 'have'. >=20 >=20 > With the comments handled, Reviewed-by: Star Zeng >=20 > Thanks, > Star >=20 > > + // > > + 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