• P
    KVM: x86/mmu: pull call to drop_large_spte() into __link_shadow_page() · 0cd8dc73
    Paolo Bonzini 提交于
    Before allocating a child shadow page table, all callers check
    whether the parent already points to a huge page and, if so, they
    drop that SPTE.  This is done by drop_large_spte().
    
    However, dropping the large SPTE is really only necessary before the
    sp is installed.  While the sp is returned by kvm_mmu_get_child_sp(),
    installing it happens later in __link_shadow_page().  Move the call
    there instead of having it in each and every caller.
    
    To ensure that the shadow page is not linked twice if it was present,
    do _not_ opportunistically make kvm_mmu_get_child_sp() idempotent:
    instead, return an error value if the shadow page already existed.
    This is a bit more verbose, but clearer than NULL.
    
    Finally, now that the drop_large_spte() name is not taken anymore,
    remove the two underscores in front of __drop_large_spte().
    Reviewed-by: NSean Christopherson <seanjc@google.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    0cd8dc73
paging_tmpl.h 31.8 KB