diff options
author | Lai Jiangshan <[email protected]> | 2023-02-02 18:28:17 +0000 |
---|---|---|
committer | Paolo Bonzini <[email protected]> | 2023-03-14 10:28:57 -0400 |
commit | 9a967700496feac1f006ffd97ffe2d82b6aac5ac (patch) | |
tree | 677c06f507d82074fed837915764cec0b65f406a /tools/testing/selftests/bpf/progs/test_autoload.c | |
parent | 39fda5d873eb1f59613ce49249ee2effea9f8e06 (diff) |
KVM: x86/mmu: Remove FNAME(is_self_change_mapping)
Drop FNAME(is_self_change_mapping) and instead rely on
kvm_mmu_hugepage_adjust() to adjust the hugepage accordingly. Prior to
commit 4cd071d13c5c ("KVM: x86/mmu: Move calls to thp_adjust() down a
level"), the hugepage adjustment was done before allocating new shadow
pages, i.e. failed to restrict the hugepage sizes if a new shadow page
resulted in account_shadowed() changing the disallowed hugepage tracking.
Removing FNAME(is_self_change_mapping) fixes a bug reported by Huang Hang
where KVM unnecessarily forces a 4KiB page. FNAME(is_self_change_mapping)
has a defect in that it blindly disables _all_ hugepage mappings rather
than trying to reduce the size of the hugepage. If the guest is writing
to a 1GiB page and the 1GiB is self-referential but a 2MiB page is not,
then KVM can and should create a 2MiB mapping.
Add a comment above the call to kvm_mmu_hugepage_adjust() to call out the
new dependency on adjusting the hugepage size after walking indirect PTEs.
Reported-by: Huang Hang <[email protected]>
Signed-off-by: Lai Jiangshan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[sean: rework changelog after separating out the emulator change]
Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_autoload.c')
0 files changed, 0 insertions, 0 deletions