From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 10245740040 for ; Tue, 30 Jul 2024 16:38:43 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kPPyQos76JoCCxAFT78Iz/VSeaeJ858XtwZ0wWlY6WM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1722357523; v=1; b=XSyERxbFMccT14SKGxhKzdlVdOSGz68rkbV/FhW8R2dO8zrI717QMpRq2CE2SNtyrI49O+2u 4iCynPx9rBvTua6Rd/FB6FLYDzFghw+VCcq839F1r3Ycvm5k1kmkacziUEwbhqUXOFk4PMwEQGP FTT9ZxFx0xKS+YfxdChRIhF6X+pbh7y+uM69pjqdE+ZfIJLitvdBE2YY/jlj+nhGHbo0TPmIAhg 0ym0YC7CkSGLhtcW6ETS2tDznjK0mC7yAduXpQHMpp/mRDjzB+1xllp3zlIkMgeMJRd4HasR/JX ZBvrBk3kLzzZozF2COnSimX1aCdLSlsz47KwOXGjeTKYQ== X-Received: by 127.0.0.2 with SMTP id YAzsYY7687511xkbq7ZU30ZV; Tue, 30 Jul 2024 09:38:42 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mx.groups.io with SMTP id smtpd.web11.31779.1721896529344494841 for ; Thu, 25 Jul 2024 01:35:29 -0700 X-CSE-ConnectionGUID: ft0LJdIhS7Kr/VuU6pdMrA== X-CSE-MsgGUID: f0E06nhBQdO2pa+f0FV3jQ== X-IronPort-AV: E=McAfee;i="6700,10204,11143"; a="23376322" X-IronPort-AV: E=Sophos;i="6.09,235,1716274800"; d="scan'208";a="23376322" X-Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2024 01:35:18 -0700 X-CSE-ConnectionGUID: fKQDr0FlQEC0XMtXXs3epw== X-CSE-MsgGUID: UPi2I3bJQsK3fy4C+A+GLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,235,1716274800"; d="scan'208";a="53463509" X-Received: from xzhang-desk.ccr.corp.intel.com ([10.240.82.53]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2024 01:35:16 -0700 From: Xiaoqiang Zhang To: devel@edk2.groups.io Cc: Xiaoqiang Zhang , Ray Ni , Star Zeng , Liming Gao Subject: [edk2-devel] [PATCH v1] MdeModulePkg/Core: CoreValidateHandle optimization Date: Thu, 25 Jul 2024 16:34:47 +0800 Message-ID: <20240725083447.2550-1-xiaoqiang.zhang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 30 Jul 2024 09:38:42 -0700 Resent-From: xiaoqiang.zhang@intel.com Reply-To: devel@edk2.groups.io,xiaoqiang.zhang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Mwod3drw14ZPPN6C7QdFCzo0x7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=XSyERxbF; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io 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 Cc: Star Zeng Cc: Liming Gao Signed-off-by: Xiaoqiang Zhang --- 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] -=-=-=-=-=-=-=-=-=-=-=-