• Sean Christopherson's avatar
    KVM: x86/mmu: Fold max_mapping_level() into kvm_mmu_hugepage_adjust() · 293e306e
    Sean Christopherson authored
    Fold max_mapping_level() into kvm_mmu_hugepage_adjust() now that HugeTLB
    mappings are handled in kvm_mmu_hugepage_adjust(), i.e. there isn't a
    need to pre-calculate the max mapping level.  Co-locating all hugepage
    checks eliminates a memslot lookup, at the cost of performing the
    __mmu_gfn_lpage_is_disallowed() checks while holding mmu_lock.
    
    The latency of lpage_is_disallowed() is likely negligible relative to
    the rest of the code run while holding mmu_lock, and can be offset to
    some extent by eliminating the mmu_gfn_lpage_is_disallowed() check in
    set_spte() in a future patch.  Eliminating the check in set_spte() is
    made possible by performing the initial lpage_is_disallowed() checks
    while holding mmu_lock.
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    293e306e
mmu.c 169 KB