From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C2AEE2222C24D for ; Fri, 26 Jan 2018 00:57:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2018 01:03:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,415,1511856000"; d="scan'208";a="25622220" Received: from jwang36-mobl2.ccr.corp.intel.com ([10.239.192.179]) by fmsmga001.fm.intel.com with ESMTP; 26 Jan 2018 01:03:18 -0800 From: Jian J Wang To: edk2-devel@lists.01.org Date: Fri, 26 Jan 2018 17:03:05 +0800 Message-Id: <20180126090307.6872-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.15.1.windows.2 Subject: [PATCH 0/2] Fix bad performance in changing page attributes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2018 08:57:50 -0000 There's a great performance down if we enable heap guard features. This feature will frequently update page attribute to set/unset guard pages, which is done by CpuArchProtocol.SetMemoryAttributes. In the implementation of this method (in CpuDxe), it will call MpProtocol.StartupAllAps() to flush TLB for all APs after updating page attributes. We found that StartupAllAps() will spend a lot of time to complete the flush operation. For example, listing a folder content in shell will take 55s to complete. Normally it should take less than 5s. The solution is removing the flush operation for AP in CpuDxe driver but let AP do it in its own wakeup code. There's no need to flush TLB for AP who has no chance to run code. Jian J Wang (2): UefiCpuPkg/MpInitLib: force flushing TLB for AP in mwait loop mode UefiCpuPkg/CpuDxe: remove all code to flush TLB for APs UefiCpuPkg/CpuDxe/CpuPageTable.c | 85 +++--------------------------------- UefiCpuPkg/Library/MpInitLib/MpLib.c | 6 +++ 2 files changed, 11 insertions(+), 80 deletions(-) -- 2.15.1.windows.2