mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/MpService: avoid dead lock caused by CheckAllAPsStatus
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16369 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0e724fc198
commit
cd8c700b03
|
@ -632,6 +632,11 @@ StartupAllAPs (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// temporarily stop checkAllAPsStatus for avoid resource dead-lock.
|
||||
//
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
|
||||
for (Number = 0; Number < mMpSystemData.NumberOfProcessors; Number++) {
|
||||
CpuData = &mMpSystemData.CpuDatas[Number];
|
||||
if (TestCpuStatusFlag (CpuData, PROCESSOR_AS_BSP_BIT)) {
|
||||
|
@ -653,11 +658,6 @@ StartupAllAPs (
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// temporarily stop checkAllAPsStatus for initialize parameters.
|
||||
//
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
|
||||
mMpSystemData.Procedure = Procedure;
|
||||
mMpSystemData.ProcedureArgument = ProcedureArgument;
|
||||
mMpSystemData.WaitEvent = WaitEvent;
|
||||
|
@ -716,6 +716,11 @@ StartupAllAPs (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Blocking temporarily stop CheckAllAPsStatus()
|
||||
//
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
|
||||
while (TRUE) {
|
||||
CheckAndUpdateAllAPsToIdleState ();
|
||||
if (mMpSystemData.FinishCount == mMpSystemData.StartCount) {
|
||||
|
@ -859,6 +864,11 @@ StartupThisAP (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// temporarily stop checkAllAPsStatus for avoid resource dead-lock.
|
||||
//
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
|
||||
CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
|
||||
if (TestCpuStatusFlag (CpuData, PROCESSOR_AS_BSP_BIT) ||
|
||||
!TestCpuStatusFlag (CpuData, PROCESSOR_ENABLED_BIT)) {
|
||||
|
@ -869,11 +879,6 @@ StartupThisAP (
|
|||
return EFI_NOT_READY;
|
||||
}
|
||||
|
||||
//
|
||||
// temporarily stop checkAllAPsStatus for initialize parameters.
|
||||
//
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
|
||||
SetApState (CpuData, CpuStateReady);
|
||||
|
||||
SetApProcedure (CpuData, Procedure, ProcedureArgument);
|
||||
|
@ -1013,6 +1018,10 @@ EnableDisableAP (
|
|||
)
|
||||
{
|
||||
CPU_DATA_BLOCK *CpuData;
|
||||
BOOLEAN TempStopCheckState;
|
||||
|
||||
CpuData = NULL;
|
||||
TempStopCheckState = FALSE;
|
||||
|
||||
if (!IsBSP ()) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
@ -1022,6 +1031,14 @@ EnableDisableAP (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// temporarily stop checkAllAPsStatus for initialize parameters.
|
||||
//
|
||||
if (!mStopCheckAllAPsStatus) {
|
||||
mStopCheckAllAPsStatus = TRUE;
|
||||
TempStopCheckState = TRUE;
|
||||
}
|
||||
|
||||
CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
|
||||
if (TestCpuStatusFlag (CpuData, PROCESSOR_AS_BSP_BIT)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -1048,6 +1065,10 @@ EnableDisableAP (
|
|||
CpuStatusFlagOr (CpuData, (*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT));
|
||||
}
|
||||
|
||||
if (TempStopCheckState) {
|
||||
mStopCheckAllAPsStatus = FALSE;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1303,20 +1324,6 @@ CheckAllAPsStatus (
|
|||
//
|
||||
for (Number = 0; Number < mMpSystemData.NumberOfProcessors; Number++) {
|
||||
CpuData = &mMpSystemData.CpuDatas[Number];
|
||||
if (TestCpuStatusFlag (CpuData, PROCESSOR_AS_BSP_BIT)) {
|
||||
//
|
||||
// Skip BSP
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TestCpuStatusFlag (CpuData, PROCESSOR_ENABLED_BIT)) {
|
||||
//
|
||||
// Skip Disabled processors
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CpuData->WaitEvent) {
|
||||
CheckThisAPStatus (NULL, (VOID *)CpuData);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue