• Sean Christopherson's avatar
    KVM: x86/mmu: Handle no-slot faults at the beginning of kvm_faultin_pfn() · f6adeae8
    Sean Christopherson authored
    Handle the "no memslot" case at the beginning of kvm_faultin_pfn(), just
    after the private versus shared check, so that there's no need to
    repeatedly query whether or not a slot exists.  This also makes it more
    obvious that, except for private vs. shared attributes, the process of
    faulting in a pfn simply doesn't apply to gfns without a slot.
    
    Opportunistically stuff @fault's metadata in kvm_handle_noslot_fault() so
    that it doesn't need to be duplicated in all paths that invoke
    kvm_handle_noslot_fault(), and to minimize the probability of not stuffing
    the right fields.
    
    Leave the existing handle behind, but convert it to a WARN, to guard
    against __kvm_faultin_pfn() unexpectedly nullifying fault->slot.
    
    Cc: David Matlack <dmatlack@google.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Reviewed-by: default avatarKai Huang <kai.huang@intel.com>
    Message-ID: <20240228024147.41573-14-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    f6adeae8
mmu.c 207 KB