]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Shove refcounted page dependency into host_pfn_mapping_level()
authorSean Christopherson <seanjc@google.com>
Fri, 29 Apr 2022 01:04:16 +0000 (01:04 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 20 Jun 2022 10:21:36 +0000 (06:21 -0400)
commit4dc27d71ab6a5a21ed837a115f9daf5f95f5ef3c
tree6834015a1fa39025ad274f9c0b64609731118695
parent3acf2b668164b1e19537d2d966f32d84e2746c6e
KVM: x86/mmu: Shove refcounted page dependency into host_pfn_mapping_level()

Move the check that restricts mapping huge pages into the guest to pfns
that are backed by refcounted 'struct page' memory into the helper that
actually "requires" a 'struct page', host_pfn_mapping_level().  In
addition to deduplicating code, moving the check to the helper eliminates
the subtle requirement that the caller check that the incoming pfn is
backed by a refcounted struct page, and as an added bonus avoids an extra
pfn_to_page() lookup.

Note, the is_error_noslot_pfn() check in kvm_mmu_hugepage_adjust() needs
to stay where it is, as it guards against dereferencing a NULL memslot in
the kvm_slot_dirty_track_enabled() that follows.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220429010416.2788472-11-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.c