On Thu, May 01, 2025 at 08:56:00AM -0500, Tom Lendacky wrote:
On 4/30/25 18:17, Ashish Kalra wrote:
From: Ashish Kalra ashish.kalra@amd.com
When the shared pages are being made private during kdump preparation there are additional checks to handle shared GHCB pages.
These additional checks include handling the case of GHCB page being contained within a huge page.
While handling the case of GHCB page contained within a huge page any shared page just below the GHCB page gets skipped from being transitioned back to private during kdump preparation.
Why this was occurring is because the original check was incorrect. The check for
ghcb <= addr + size
can result in skipping a range that should not have been skipped because the "addr + size" is actually the start of a page/range after the end of the range being checked. If the ghcb address was equal to addr + size, then it was mistakenly considered part of the range when it really wasn't.
I think the check could have just been changed to:
if (addr <= ghcb && ghcb < addr + size) {
The new checks are a bit clearer in showing normal pages vs huge pages, though, but you can clearly see the "ghcb < addr + size" change to do the right thing in the huge page case.
While it is likely that a GHCB page hasn't been part of a huge page during all the testing, the change in snp_kexec_finish() to mask the address is the proper thing to do. It probably doesn't even need the if check as the mask can just be applied no matter what.
Sounds like I'll be getting a v3.1 with Tom's suggestions?
Thx.