[edk2-devel] [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

Ni, Ray ray.ni at intel.com
Wed Apr 22 08:00:15 UTC 2020


Reviewed-by: Ray Ni <ray.ni at intel.com> with a bit comments update:

"Current been used wake up buffer is allocated in PEI phase and no long valid at this time."
->
"Wakeup buffer allocated in PEI phase is no longer valid in DXE."


> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Wednesday, April 22, 2020 9:35 AM
> To: devel at edk2.groups.io
> Cc: Ni, Ray <ray.ni at intel.com>; Laszlo Ersek <lersek at redhat.com>; Kumar,
> Chandana C <chandana.c.kumar at intel.com>
> Subject: [edk2-devel] [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid
> ApInitReconfig in PEI.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
> 
> 
> In PEI phase, AP already been waked up through ApInitConfig,
> so it can directly wake up it through change wakup buffer
> instead of use ApInitReconfig flag. It can save some time.
> 
> Change code to only use ApInitReconfig flag in DXE phase
> which must need to update the wake up buffer.
> 
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar at intel.com>
> Signed-off-by: Eric Dong <eric.dong at intel.com>
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index ac7f92fd48..644971b68f 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1819,7 +1819,14 @@ MpInitLibInitialize (
>    // Wakeup APs to do some AP initialize sync (Microcode & MTRR)
> 
>    //
> 
>    if (CpuMpData->CpuCount > 1) {
> 
> -    CpuMpData->InitFlag = ApInitReconfig;
> 
> +    if (OldCpuMpData != NULL) {
> 
> +      //
> 
> +      // Only needs to use this flag for DXE phase to update the wake up
> 
> +      // buffer. Current been used wake up buffer is allocated in PEI phase
> 
> +      // and no long valid at this time.
> 
> +      //
> 
> +      CpuMpData->InitFlag = ApInitReconfig;
> 
> +    }
> 
>      WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
> 
>      //
> 
>      // Wait for all APs finished initialization
> 
> @@ -1827,7 +1834,9 @@ MpInitLibInitialize (
>      while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
> 
>        CpuPause ();
> 
>      }
> 
> -    CpuMpData->InitFlag = ApInitDone;
> 
> +    if (OldCpuMpData != NULL) {
> 
> +      CpuMpData->InitFlag = ApInitDone;
> 
> +    }
> 
>      for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
> 
>        SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);
> 
>      }
> 
> --
> 2.23.0.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#57774): https://edk2.groups.io/g/devel/message/57774
> Mute This Topic: https://groups.io/mt/73187417/1712937
> Group Owner: devel+owner at edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [ray.ni at intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57783): https://edk2.groups.io/g/devel/message/57783
Mute This Topic: https://groups.io/mt/73187417/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list