There is one dead lock issue between BSP and AP. AP has one logic to enter into Sleep state (hlt) if it found its state is Idle state in one loop. In ProcessorToIdleState() function, AP will get current AP state, if its state is Sleep state, then it will go into real sleep(hlt) state. The dead lock may happen if BSP found AP state is Sleep state and send INIT-SIPI -SIPI to AP. But AP just acquried the lock to get its state. If AP is reset, the lock will not released correctly. This fix is to let AP enter into real sleep(hlt) state immediately after it changes its state is set to Sleep and needn't get lock again.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <[email protected]> Cc: Michael Kinney <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Laszlo Ersek <[email protected]> Cc: Chen Fan <[email protected]> --- UefiCpuPkg/CpuDxe/CpuMp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index 3de2aa5..357ee42 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -1289,14 +1289,18 @@ ProcessorToIdleState ( GetMpSpinLock (CpuData); if (CpuData->State == CpuStateIdle) { CpuData->State = CpuStateSleeping; + ReleaseMpSpinLock (CpuData); + while (TRUE) { + // + // Place AP into cli-hlt loop to handle RSM from SMM case + // + DisableInterrupts (); + CpuSleep (); + } } ReleaseMpSpinLock (CpuData); } - if (GetApState (CpuData) == CpuStateSleeping) { - CpuSleep (); - } - CpuPause (); } -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

