• Sean Christopherson's avatar
    KVM: x86/mmu: Zap invalidated TDP MMU roots at 4KiB granularity · 8ca98363
    Sean Christopherson authored
    Zap invalidated TDP MMU roots at maximum granularity, i.e. with more
    frequent conditional resched checkpoints, in order to avoid running for an
    extended duration (milliseconds, or worse) without honoring a reschedule
    request.  And for kernels running with full or real-time preempt models,
    zapping at 4KiB granularity also provides significantly reduced latency
    for other tasks that are contending for mmu_lock (which isn't necessarily
    an overall win for KVM, but KVM should do its best to honor the kernel's
    preemption model).
    
    To keep KVM's assertion that zapping at 1GiB granularity is functionally
    ok, which is the main reason 1GiB was selected in the past, skip straight
    to zapping at 1GiB if KVM is configured to prove the MMU.  Zapping roots
    is far more common than a vCPU replacing a 1GiB page table with a hugepage,
    e.g. generally happens multiple times during boot, and so keeping the test
    coverage provided by root zaps is desirable, just not for production.
    
    Cc: David Matlack <dmatlack@google.com>
    Cc: Pattara Teerapong <pteerapong@google.com>
    Link: https://lore.kernel.org/r/20240111020048.844847-2-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    8ca98363
tdp_mmu.c 54.5 KB