public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1] MdeModulePkg/Core: CoreValidateHandle optimization
@ 2024-07-25  8:34 Xiaoqiang Zhang
  0 siblings, 0 replies; only message in thread
From: Xiaoqiang Zhang @ 2024-07-25  8:34 UTC (permalink / raw)
  To: devel; +Cc: Xiaoqiang Zhang, Ray Ni, Star Zeng, Liming Gao

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]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-30 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25  8:34 [edk2-devel] [PATCH v1] MdeModulePkg/Core: CoreValidateHandle optimization Xiaoqiang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox