summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/CpuDxe/CpuMp.c
diff options
context:
space:
mode:
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>2014-11-13 18:29:40 +0000
committerjljusten <jljusten@Edk2>2014-11-13 18:29:40 +0000
commit0e724fc1981b3c47bb16432c4c414a50c9e3a519 (patch)
treee7b9c2fd17e043bb3a7fde5cb886da94e1aeef89 /UefiCpuPkg/CpuDxe/CpuMp.c
parent232eb4c82637e92b65ebbfc89a45e9daa8535171 (diff)
downloadedk2-0e724fc1981b3c47bb16432c4c414a50c9e3a519.tar.gz
edk2-0e724fc1981b3c47bb16432c4c414a50c9e3a519.tar.bz2
edk2-0e724fc1981b3c47bb16432c4c414a50c9e3a519.zip
UefiCpuPkg/MpService: avoid reset AP still hold a lock
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@16368 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/CpuDxe/CpuMp.c')
-rw-r--r--UefiCpuPkg/CpuDxe/CpuMp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 10065762a2..e03c7f1e49 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -52,6 +52,7 @@ GetMpSpinLock (
while (!AcquireSpinLockOrFail (&CpuData->CpuDataLock)) {
CpuPause ();
}
+ CpuData->LockSelf = GetApicId ();
}
/**
@@ -1145,6 +1146,13 @@ ProcessorToIdleState (
CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
//
+ // Avoid forcibly reset AP caused the AP got lock not release.
+ //
+ if (CpuData->LockSelf == (INTN) GetApicId ()) {
+ ReleaseSpinLock (&CpuData->CpuDataLock);
+ }
+
+ //
// Avoid forcibly reset AP caused the AP State is not updated.
//
GetMpSpinLock (CpuData);
@@ -1395,6 +1403,7 @@ FillInProcessorInformation (
CpuData->Procedure = NULL;
CpuData->Parameter = NULL;
InitializeSpinLock (&CpuData->CpuDataLock);
+ CpuData->LockSelf = -1;
return EFI_SUCCESS;
}