On 2014-11-03 00:17:18, Chen Fan wrote:
> if any enabled APs are not in idle state, StartupAllAPs() should return 
> immediately,
> and must not change the other idled processor state. so we checked the state 
> before
> changed them.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com>
> ---
>  EmulatorPkg/CpuRuntimeDxe/MpService.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c 
> b/EmulatorPkg/CpuRuntimeDxe/MpService.c
> index dbeeaf5..06c71ec 100644
> --- a/EmulatorPkg/CpuRuntimeDxe/MpService.c
> +++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c
> @@ -397,6 +397,24 @@ CpuMpServicesStartupAllAps (
>      return EFI_UNSUPPORTED;
>    }
>  
> +  for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
> +    ProcessorData = &gMPSystem.ProcessorData[Number];
> +    if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == 
> PROCESSOR_AS_BSP_BIT) {
> +      // Skip BSP
> +      continue;
> +    }
> +
> +    if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
> +      // Skip Disabled processors
> +      continue;
> +    }
> +    gThread->MutexLock(ProcessorData->StateLock);
> +    if (ProcessorData->State != CPU_STATE_IDLE) {
> +      gThread->MutexUnlock (ProcessorData->StateLock);
> +      return EFI_NOT_READY;
> +    }
> +    gThread->MutexUnlock(ProcessorData->StateLock);
> +  }
>  
>    if (FailedCpuList != NULL) {
>      gMPSystem.FailedList = AllocatePool ((gMPSystem.NumberOfProcessors + 1) 
> * sizeof (UINTN));
> @@ -448,7 +466,6 @@ CpuMpServicesStartupAllAps (
>        }
>      } else {
>        gThread->MutexUnlock (ProcessorData->StateLock);
> -      return EFI_NOT_READY;

Based on your change in the previous hunk, instead of
  if (ProcessorData->State == CPU_STATE_IDLE)
above here, we can now
  assert (ProcessorData->State == CPU_STATE_IDLE)
and collapse the if/else.

-Jordan

>      }
>    }
>  
> -- 
> 1.9.3
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
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-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to