UefiCpuPkg/CpuMpPei: Don't write CR3 in ConvertMemoryPageToNotPresent

The purpose of writing CR3 in ConvertMemoryPageToNotPresent is just
to flush TLB, because CR3 won't be changed in function
ConvertMemoryPageToNotPresent.
After ConvertMemoryPageToNotPresent, there is always a flush TLB
function. Also, because ConvertMemoryPageToNotPresent in called in a
loop, to improve performance, there is no need to flush TLB
inside ConvertMemoryPageToNotPresent. Just flushing TLB after the loop
is enough.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Zhiguang Liu 2024-01-10 13:39:42 +08:00 committed by mergify[bot]
parent 2f4b07b668
commit c10e5703fe
1 changed files with 2 additions and 2 deletions

View File

@ -76,7 +76,8 @@ AllocatePageTableMemory (
/**
This function modifies the page attributes for the memory region specified
by BaseAddress and Length to not present.
by BaseAddress and Length to not present. This function only change page
table, but not flush TLB. Caller have the responsbility to flush TLB.
Caller should make sure BaseAddress and Length is at page boundary.
@ -167,7 +168,6 @@ ConvertMemoryPageToNotPresent (
}
ASSERT_EFI_ERROR (Status);
AsmWriteCr3 (PageTable);
return Status;
}