• Sean Christopherson's avatar
    KVM: x86/mmu: Don't require refcounted "struct page" to create huge SPTEs · a8ac499b
    Sean Christopherson authored
    Drop the requirement that a pfn be backed by a refcounted, compound or
    or ZONE_DEVICE, struct page, and instead rely solely on the host page
    tables to identify huge pages.  The PageCompound() check is a remnant of
    an old implementation that identified (well, attempt to identify) huge
    pages without walking the host page tables.  The ZONE_DEVICE check was
    added as an exception to the PageCompound() requirement.  In other words,
    neither check is actually a hard requirement, if the primary has a pfn
    backed with a huge page, then KVM can back the pfn with a huge page
    regardless of the backing store.
    
    Dropping the @pfn parameter will also allow KVM to query the max host
    mapping level without having to first get the pfn, which is advantageous
    for use outside of the page fault path where KVM wants to take action if
    and only if a page can be mapped huge, i.e. avoids the pfn lookup for
    gfns that can't be backed with a huge page.
    
    Cc: Mingwei Zhang <mizhang@google.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Reviewed-by: default avatarMingwei Zhang <mizhang@google.com>
    Message-Id: <20220715232107.3775620-2-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    a8ac499b
mmu_internal.h 9.6 KB