[edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.

Dong, Eric posted 2 patches 5 years, 10 months ago
[edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.
Posted by Dong, Eric 5 years, 10 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2388

After patch "UefiCpuPkg/PiSmmCpuDxeSmm: Improve the
performance of GetFreeToken()" which adds new parameter
FirstFreeToken, it's not need to use Uses parameter.
This patch used to remove this parameter.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c      | 10 +++++-----
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 93cac5e4fa..305bffa9bc 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -441,7 +441,6 @@ ResetTokens (
     ProcToken = PROCEDURE_TOKEN_FROM_LINK (Link);
 
     ProcToken->RunningApCount = 0;
-    ProcToken->Used = FALSE;
 
     //
     // Check the spinlock status and release it if not released yet.
@@ -1049,10 +1048,13 @@ IsTokenInUse (
   }
 
   Link = GetFirstNode (&gSmmCpuPrivate->TokenList);
-  while (!IsNull (&gSmmCpuPrivate->TokenList, Link)) {
+  //
+  // Only search used tokens.
+  //
+  while (Link != gSmmCpuPrivate->FirstFreeToken) {
     ProcToken = PROCEDURE_TOKEN_FROM_LINK (Link);
 
-    if (ProcToken->Used && ProcToken->SpinLock == Token) {
+    if (ProcToken->SpinLock == Token) {
       return TRUE;
     }
 
@@ -1104,7 +1106,6 @@ AllocateTokenBuffer (
 
     ProcTokens[Index].Signature      = PROCEDURE_TOKEN_SIGNATURE;
     ProcTokens[Index].SpinLock       = SpinLock;
-    ProcTokens[Index].Used           = FALSE;
     ProcTokens[Index].RunningApCount = 0;
 
     InsertTailList (&gSmmCpuPrivate->TokenList, &ProcTokens[Index].Link);
@@ -1140,7 +1141,6 @@ GetFreeToken (
   NewToken = PROCEDURE_TOKEN_FROM_LINK (gSmmCpuPrivate->FirstFreeToken);
   gSmmCpuPrivate->FirstFreeToken = GetNextNode (&gSmmCpuPrivate->TokenList, gSmmCpuPrivate->FirstFreeToken);
 
-  NewToken->Used = TRUE;
   NewToken->RunningApCount = RunningApsCount;
   AcquireSpinLock (NewToken->SpinLock);
 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index c9b3b739f3..7fb3a2d9e4 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -214,7 +214,6 @@ typedef struct {
 
   SPIN_LOCK               *SpinLock;
   volatile UINT32         RunningApCount;
-  BOOLEAN                 Used;
 } PROCEDURE_TOKEN;
 
 #define PROCEDURE_TOKEN_FROM_LINK(a)  CR (a, PROCEDURE_TOKEN, Link, PROCEDURE_TOKEN_SIGNATURE)
-- 
2.23.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57183): https://edk2.groups.io/g/devel/message/57183
Mute This Topic: https://groups.io/mt/72915831/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.
Posted by Ni, Ray 5 years, 10 months ago

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong, Eric
> Sent: Friday, April 10, 2020 2:54 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2388
> 
> 
> After patch "UefiCpuPkg/PiSmmCpuDxeSmm: Improve the
> performance of GetFreeToken()" which adds new parameter
> FirstFreeToken, it's not need to use Uses parameter.

Used field in PROCEDURE_TOKEN structure is not needed

> This patch used to remove this parameter.

This patch removes this field.

With above commit message change, Reviewed-by: Ray Ni <ray.ni@intel.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57185): https://edk2.groups.io/g/devel/message/57185
Mute This Topic: https://groups.io/mt/72915831/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-