• Sean Christopherson's avatar
    KVM: x86/mmu: Add RET_PF_CONTINUE to eliminate bool+int* "returns" · 5276c616
    Sean Christopherson authored
    Add RET_PF_CONTINUE and use it in handle_abnormal_pfn() and
    kvm_faultin_pfn() to signal that the page fault handler should continue
    doing its thing.  Aside from being gross and inefficient, using a boolean
    return to signal continue vs. stop makes it extremely difficult to add
    more helpers and/or move existing code to a helper.
    
    E.g. hypothetically, if nested MMUs were to gain a separate page fault
    handler in the future, everything up to the "is self-modifying PTE" check
    can be shared by all shadow MMUs, but communicating up the stack whether
    to continue on or stop becomes a nightmare.
    
    More concretely, proposed support for private guest memory ran into a
    similar issue, where it'll be forced to forego a helper in order to yield
    sane code: https://lore.kernel.org/all/YkJbxiL%2FAz7olWlq@google.com.
    
    No functional change intended.
    
    Cc: David Matlack <dmatlack@google.com>
    Cc: Chao Peng <chao.p.peng@linux.intel.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20220423034752.1161007-7-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    5276c616
mmu.c 174 KB