• Paolo Bonzini's avatar
    KVM: x86/mmu: Zap invalidated roots via asynchronous worker · 22b94c4b
    Paolo Bonzini authored
    Use the system worker threads to zap the roots invalidated
    by the TDP MMU's "fast zap" mechanism, implemented by
    kvm_tdp_mmu_invalidate_all_roots().
    
    At this point, apart from allowing some parallelism in the zapping of
    roots, the workqueue is a glorified linked list: work items are added and
    flushed entirely within a single kvm->slots_lock critical section.  However,
    the workqueue fixes a latent issue where kvm_mmu_zap_all_invalidated_roots()
    assumes that it owns a reference to all invalid roots; therefore, no
    one can set the invalid bit outside kvm_mmu_zap_all_fast().  Putting the
    invalidated roots on a linked list... erm, on a workqueue ensures that
    tdp_mmu_zap_root_work() only puts back those extra references that
    kvm_mmu_zap_all_invalidated_roots() had gifted to it.
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    22b94c4b
kvm_host.h 59.4 KB