public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Ni, Ray" <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
	"Kumar, Chandana C" <chandana.c.kumar@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service.
Date: Fri, 12 Jul 2019 10:53:00 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB04831040363B2C@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20190712015308.26492-2-eric.dong@intel.com>

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 <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [Patch 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS
> service.

"gBS service" is not match with the assertion information, gBS is the concept in DXE phase.
So here, please "PEI service" to be accurate.

> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1972
> 
> 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 != ((void *) 0)
> 
> This change uses saved global pcd size instead of calls PcdGetSize to
> fix this issue.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  .../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 size.
> +
>  **/
>  VOID
>  SupportedMaskOr (
>    IN UINT8               *SupportedFeatureMask,
> -  IN UINT8               *OrFeatureBitMask
> +  IN UINT8               *OrFeatureBitMask,
> +  IN UINT32              BitMaskSize
>    )
>  {
>    UINTN                  Index;
> -  UINTN                  BitMaskSize;
>    UINT8                  *Data1;
>    UINT8                  *Data2;
> 
> -  BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
>    Data1 = SupportedFeatureMask;
>    Data2 = OrFeatureBitMask;
>    for (Index = 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 = 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 <star.zeng@intel.com>

Thanks,
Star

> +    //
> +    ASSERT (PcdGetSize (PcdCpuFeaturesSetting) == PcdGetSize
> (PcdCpuFeaturesCapability));
> +    ASSERT (PcdGetSize (PcdCpuFeaturesSetting) == PcdGetSize
> (PcdCpuFeaturesSupport));
>      CpuFeaturesData->BitMaskSize = (UINT32) BitMaskSize;
>    }
>    ASSERT (CpuFeaturesData->BitMaskSize == BitMaskSize);
> --
> 2.21.0.windows.1


  reply	other threads:[~2019-07-12 10:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12  1:53 [Patch 0/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service Dong, Eric
2019-07-12  1:53 ` [Patch 1/2] " Dong, Eric
2019-07-12 10:53   ` Zeng, Star [this message]
2019-07-15  4:59     ` Ni, Ray
2019-07-12  1:53 ` [Patch 2/2] UefiCpuPkg/Library/RegisterCpuFeaturesLib: avoid use dynamic PCD Dong, Eric
2019-07-12 11:10   ` [edk2-devel] " Zeng, Star
2019-07-15  4:57   ` Ni, Ray
2019-07-15  7:04     ` Dong, Eric
2019-07-12 22:16 ` [Patch 0/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls gBS service Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C09AFA07DD0434D9E2A0C6AEB04831040363B2C@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox