public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Xiaoqiang Zhang <xiaoqiang.zhang@intel.com>
To: devel@edk2.groups.io
Cc: Xiaoqiang Zhang <xiaoqiang.zhang@intel.com>,
	Ray Ni <ray.ni@intel.com>, Star Zeng <star.zeng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [edk2-devel] [PATCH v1] MdeModulePkg/Core: CoreValidateHandle optimization
Date: Thu, 25 Jul 2024 16:34:47 +0800	[thread overview]
Message-ID: <20240725083447.2550-1-xiaoqiang.zhang@intel.com> (raw)

REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4817

Before entering BIOS setup, CoreValidateHandle function executed
over 600,000 times during BDS phase on latest 8S server platform.
For current EFI handle database, InsertTailList function is used
to insert each EFI handle into the handle database. The handle
number on latest 8S server platform is over 2000 and the EFI
handles which are inserted into handle database earlier will be
used frequently. So using ForwardLink instead of Backlink to go
through the handle database in CoreValidateHandle function will
be faster. After verification on latest 8S server platform,
changing Backlink to ForwardLink can save 14s+ BDS boot time.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Xiaoqiang Zhang <xiaoqiang.zhang@intel.com>
---
 MdeModulePkg/Core/Dxe/Hand/Handle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index 24e4fbf5f3..daad09cddd 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -68,7 +68,7 @@ CoreValidateHandle (
 
   ASSERT_LOCKED (&gProtocolDatabaseLock);
 
-  for (Link = gHandleList.BackLink; Link != &gHandleList; Link = Link->BackLink) {
+  for (Link = gHandleList.ForwardLink; Link != &gHandleList; Link = Link->ForwardLink) {
     Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
     if (Handle == (IHANDLE *)UserHandle) {
       return EFI_SUCCESS;
-- 
2.45.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120126): https://edk2.groups.io/g/devel/message/120126
Mute This Topic: https://groups.io/mt/107630731/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



                 reply	other threads:[~2024-07-30 16:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240725083447.2550-1-xiaoqiang.zhang@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