If features like memory profile, protection and heap guard are enabled,
a lot of more memory page attributes update actions will happen than
usual. An unnecessary sync of CR0.WP setting among APs will then cause
worse performance in memory allocation action. Removing the calling of
SyncMemoryPageAttributesAp() in function DisableReadOnlyPageWriteProtect
and EnableReadOnlyPageWriteProtect can fix this problem. In DEBUG build
case, the boot performance can be boosted from 11 minute to 6 minute.

Cc: Eric Dong <eric.d...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.w...@intel.com>
---
 UefiCpuPkg/CpuDxe/CpuPageTable.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c
index a9c9bc9d5e..b97a444c09 100644
--- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
@@ -597,7 +597,6 @@ DisableReadOnlyPageWriteProtect (
   )
 {
   AsmWriteCr0 (AsmReadCr0() & ~BIT16);
-  SyncMemoryPageAttributesAp (SyncCpuDisableWriteProtection);
 }
 
 /**
@@ -609,7 +608,6 @@ EnableReadOnlyPageWriteProtect (
   )
 {
   AsmWriteCr0 (AsmReadCr0() | BIT16);
-  SyncMemoryPageAttributesAp (SyncCpuEnableWriteProtection);
 }
 
 /**
-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to