diff options
author | Chen Fan <chen.fan.fnst@cn.fujitsu.com> | 2014-11-13 18:29:54 +0000 |
---|---|---|
committer | jljusten <jljusten@Edk2> | 2014-11-13 18:29:54 +0000 |
commit | cd8c700b03e38e9389a8f13e193a431072802593 (patch) | |
tree | 1ca4c936f564fc8fa581634a86bca08221781071 /UefiCpuPkg/CpuDxe/CpuMp.c | |
parent | 0e724fc1981b3c47bb16432c4c414a50c9e3a519 (diff) | |
download | edk2-cd8c700b03e38e9389a8f13e193a431072802593.tar.gz edk2-cd8c700b03e38e9389a8f13e193a431072802593.tar.bz2 edk2-cd8c700b03e38e9389a8f13e193a431072802593.zip |
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
Diffstat (limited to 'UefiCpuPkg/CpuDxe/CpuMp.c')
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuMp.c | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index e03c7f1e49..5d5c7db765 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -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);
}
|