Skip to content

Commit

Permalink
UefiCpuPkg/CpuMpPei: Don't write CR3 in ConvertMemoryPageToNotPresent
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
  • Loading branch information
LiuZhiguang001 authored and mergify[bot] committed Feb 22, 2024
1 parent 2f4b07b commit c10e570
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions UefiCpuPkg/CpuMpPei/CpuPaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -167,7 +168,6 @@ ConvertMemoryPageToNotPresent (
}

ASSERT_EFI_ERROR (Status);
AsmWriteCr3 (PageTable);
return Status;
}

Expand Down

0 comments on commit c10e570

Please sign in to comment.