Revision: 16367
          http://sourceforge.net/p/edk2/code/16367
Author:   jljusten
Date:     2014-11-13 18:29:31 +0000 (Thu, 13 Nov 2014)
Log Message:
-----------
UefiCpuPkg/MpService: free the unused cpu data buffer

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

Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:29:13 UTC (rev 
16366)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:29:31 UTC (rev 
16367)
@@ -25,7 +25,7 @@
 VOID *mTopOfApCommonStack = 0;
 VOID *mApStackStart = 0;
 
-BOOLEAN mAPsAlreadyInitFinished = FALSE;
+volatile BOOLEAN mAPsAlreadyInitFinished = FALSE;
 volatile BOOLEAN mStopCheckAllAPsStatus = TRUE;
 
 EFI_MP_SERVICES_PROTOCOL  mMpServicesTemplate = {
@@ -1135,11 +1135,15 @@
   EFI_AP_PROCEDURE      Procedure;
   VOID                  *ProcedureArgument;
 
+  AsmApDoneWithCommonStack ();
+
+  while (!mAPsAlreadyInitFinished) {
+    CpuPause ();
+  }
+
   WhoAmI (&mMpServicesTemplate, &ProcessorNumber);
   CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
 
-  AsmApDoneWithCommonStack ();
-
   //
   // Avoid forcibly reset AP caused the AP State is not updated.
   //
@@ -1486,6 +1490,11 @@
     return;
   }
 
+  mMpSystemData.CpuDatas = ReallocatePool (
+                             sizeof (CPU_DATA_BLOCK) * 
gMaxLogicalProcessorNumber,
+                             sizeof (CPU_DATA_BLOCK) * 
mMpSystemData.NumberOfProcessors,
+                             mMpSystemData.CpuDatas);
+
   mAPsAlreadyInitFinished = TRUE;
 
   if (mMpSystemData.NumberOfProcessors < gMaxLogicalProcessorNumber) {


------------------------------------------------------------------------------
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