summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorJian J Wang <jian.j.wang@intel.com>2018-01-26 16:30:40 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2018-01-29 09:38:24 +0800
commit1bc6e00bb1e3ab4568dcdf218ec4304ee2663f01 (patch)
tree5e1df3744cf14dbb89a96ec99c66959e25642aff /UefiCpuPkg
parent2bf01a60be00f0bcd4dbaf943d0d03d914527a92 (diff)
downloadedk2-1bc6e00bb1e3ab4568dcdf218ec4304ee2663f01.tar.gz
edk2-1bc6e00bb1e3ab4568dcdf218ec4304ee2663f01.tar.bz2
edk2-1bc6e00bb1e3ab4568dcdf218ec4304ee2663f01.zip
UefiCpuPkg/MpInitLib: force flushing TLB for AP in mwait loop mode
The reason doing this is that we found that calling StartupAllAps() to flush TLB for all APs in CpuDxe driver after changing page attributes will spend a lot of time to complete. If there are many page attributes update requests, the whole system performance will be slowed down explicitly, including any shell command and UI operation. The solution is removing the flush operation for AP in CpuDxe driver. Since TLB is always flushed in HLT loop mode, we just need to enforce a TLB flush for mwait loop mode. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> 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> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> (cherry picked from commit 199de89677deffffff30eda7ad17793b30042cce)
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index f8ab5f115d..f2ff40417a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -639,6 +639,13 @@ ApWakeupFunction (
// Restore AP's volatile registers saved
//
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);
+ } else {
+ //
+ // The CPU driver might not flush TLB for APs on spot after updating
+ // page attributes. AP in mwait loop mode needs to take care of it when
+ // woken up.
+ //
+ CpuFlushTlb ();
}
if (GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateReady) {