public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>, Star Zeng <star.zeng@intel.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter.
Date: Fri, 10 Apr 2020 14:54:00 +0800	[thread overview]
Message-ID: <20200410065401.966-2-eric.dong@intel.com> (raw)
In-Reply-To: <20200410065401.966-1-eric.dong@intel.com>

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


  reply	other threads:[~2020-04-10  6:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10  6:53 [PATCH 0/2] Remove useless code Dong, Eric
2020-04-10  6:54 ` Dong, Eric [this message]
2020-04-10  7:07   ` [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove Used parameter Ni, Ray
2020-04-10  6:54 ` [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Remove useless code in ResetTokens Dong, Eric
2020-04-10  7:08   ` [edk2-devel] " Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200410065401.966-2-eric.dong@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox