public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg/CpuDxe: fix bad boot performance
@ 2018-01-18  7:38 Jian J Wang
  2018-01-18 12:23 ` Dong, Eric
  0 siblings, 1 reply; 2+ messages in thread
From: Jian J Wang @ 2018-01-18  7:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: Eric Dong, Laszlo Ersek

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.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UefiCpuPkg/CpuDxe: fix bad boot performance
  2018-01-18  7:38 [PATCH] UefiCpuPkg/CpuDxe: fix bad boot performance Jian J Wang
@ 2018-01-18 12:23 ` Dong, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2018-01-18 12:23 UTC (permalink / raw)
  To: Wang, Jian J, edk2-devel@lists.01.org; +Cc: Laszlo Ersek

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: Wang, Jian J 
Sent: Thursday, January 18, 2018 3:39 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>
Subject: [PATCH] UefiCpuPkg/CpuDxe: fix bad boot performance

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.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-18 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18  7:38 [PATCH] UefiCpuPkg/CpuDxe: fix bad boot performance Jian J Wang
2018-01-18 12:23 ` Dong, Eric

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