From: Dong, Eric Date: Fri, 10 Apr 2020 06:54:01 +0000 (+0800) Subject: UefiCpuPkg/PiSmmCpuDxeSmm: Remove useless code in ResetTokens. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1cae0d42155771bdaa9712868bef507666efa85c;p=people%2Faperard%2Fovmf.git UefiCpuPkg/PiSmmCpuDxeSmm: Remove useless code in ResetTokens. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2388 After remove Used parameter, below code in ResetTokens can also be removed: 1. The RunningApCount parameter will be reset in GetFreeToken. 2. The ReleaseSpinLock should be called in ReleaseToken function, Code in this function seems like a later fix if ReleaseToken not Release it. We should remove code here and fix the real issue if existed. Signed-off-by: Eric Dong Reviewed-by: Ray Ni Cc: Star Zeng Cc: Laszlo Ersek --- diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c index 305bffa9bc..57e788c01b 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -433,26 +433,6 @@ ResetTokens ( VOID ) { - LIST_ENTRY *Link; - PROCEDURE_TOKEN *ProcToken; - - Link = GetFirstNode (&gSmmCpuPrivate->TokenList); - while (!IsNull (&gSmmCpuPrivate->TokenList, Link)) { - ProcToken = PROCEDURE_TOKEN_FROM_LINK (Link); - - ProcToken->RunningApCount = 0; - - // - // Check the spinlock status and release it if not released yet. - // - if (!AcquireSpinLockOrFail(ProcToken->SpinLock)) { - DEBUG((DEBUG_ERROR, "Risk::SpinLock still not released!")); - } - ReleaseSpinLock (ProcToken->SpinLock); - - Link = GetNextNode (&gSmmCpuPrivate->TokenList, Link); - } - // // Reset the FirstFreeToken to the beginning of token list upon exiting SMI. //