Revision: 16368
          http://sourceforge.net/p/edk2/code/16368
Author:   jljusten
Date:     2014-11-13 18:29:40 +0000 (Thu, 13 Nov 2014)
Log Message:
-----------
UefiCpuPkg/MpService: avoid reset AP still hold a lock

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>

Modified Paths:
--------------
    trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
    trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.h

Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:29:31 UTC (rev 
16367)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:29:40 UTC (rev 
16368)
@@ -52,6 +52,7 @@
   while (!AcquireSpinLockOrFail (&CpuData->CpuDataLock)) {
     CpuPause ();
   }
+  CpuData->LockSelf = GetApicId ();
 }
 
 /**
@@ -1145,6 +1146,13 @@
   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 @@
   CpuData->Procedure        = NULL;
   CpuData->Parameter        = NULL;
   InitializeSpinLock (&CpuData->CpuDataLock);
+  CpuData->LockSelf         = -1;
 
   return EFI_SUCCESS;
 }

Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.h
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.h        2014-11-13 18:29:31 UTC (rev 
16367)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.h        2014-11-13 18:29:40 UTC (rev 
16368)
@@ -90,6 +90,7 @@
 typedef struct {
   EFI_PROCESSOR_INFORMATION      Info;
   SPIN_LOCK                      CpuDataLock;
+  INTN                           LockSelf;
   volatile CPU_STATE             State;
 
   EFI_AP_PROCEDURE               Procedure;


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to