audk/UefiCpuPkg/Library
Yuanhao Xie 74c687cc2f UefiCpuPkg/MpInitLib: Wait for all APs to finish initialization
Aim:
- To solve the assertion that checks if CpuMpData->FinishedCount
equals (CpuMpData->CpuCount - 1). The assertion arises from a timing
discrepancy between the BSP's completion of startup signal checks and
the APs' incrementation of the FinishedCount.
- This patch also ensures that "finished" reporting from the APs is as
later as possible.

More specifially:

In the SwitchApContext() function, the BSP trigers
the startup signal and check whether the APs have received it. After
completing this check, the BSP then verifies if the FinishedCount is
equal to CpuCount-1.

On the AP side, upon receiving the startup signal, they invoke
SwitchContextPerAp() and increase the FinishedCount to indicate their
activation. However, even when all APs have received the startup signal,
they might not have finished incrementing the FinishedCount. This timing
gap results in the triggering of the assertion.

Solution:
Instead of assertion, use while loop to waits until all the APs have
incremented the FinishedCount.

Fixes: 964a4f032d

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <20231025114216.2824-1-yuanhao.xie@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2023-10-26 17:43:03 +00:00
..
BaseRiscV64CpuExceptionHandlerLib UefiCpuPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
BaseRiscV64CpuTimerLib UefiCpuPkg: RISC-V: TimerLib: Fix delay function to use 64-bit 2023-06-15 05:32:51 +00:00
BaseRiscVMmuLib UefiCpuPkg: RISC-V: MMU: Introduce a PCD for SATP mode 2023-10-17 07:44:25 +00:00
BaseXApicLib UefiCpuPkg: Add SendStartupIpiAllExcludingSelf 2023-08-14 14:40:41 +00:00
BaseXApicX2ApicLib UefiCpuPkg/BaseXApicX2ApicLib: fix CPUID_V2_EXTENDED_TOPOLOGY detection 2023-10-25 09:52:06 +00:00
CcExitLibNull OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib 2022-11-14 04:55:34 +00:00
CpuCacheInfoLib UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
CpuCommonFeaturesLib UefiCpuPkg: Update PT code to support enable collect performance 2023-04-26 09:19:51 +00:00
CpuExceptionHandlerLib UefiCpuPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
CpuPageTableLib UefiCpuPkg/Test: Disable random test cases 2023-03-31 23:44:49 +00:00
CpuTimerLib UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MicrocodeLib UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmSaveStateLib UefiCpuPkg: Uses gMmst in MmSaveStateLib 2023-07-17 09:43:43 +00:00
MpInitLib UefiCpuPkg/MpInitLib: Wait for all APs to finish initialization 2023-10-26 17:43:03 +00:00
MpInitLibUp UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MtrrLib UefiCpuPkg/MtrrUnitTest: Add Unit test of setting/getting memory 2023-10-09 08:22:02 +00:00
PlatformSecLibNull UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RegisterCpuFeaturesLib UefiCpuPkg: Calculate DisplayFamily correctly 2023-03-07 10:42:38 +00:00
SecPeiDxeTimerLibUefiCpu UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmCpuFeaturesLib UefiCpuPkg: Removes SmmCpuFeaturesReadSaveStateRegister 2023-07-03 03:01:10 +00:00
SmmCpuPlatformHookLibNull UefiCpuPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmCpuRendezvousLib UefiCpuPkg: Extend SMM CPU Service with rendezvous support. 2022-03-04 05:44:42 +00:00