]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Zap only TDP MMU leafs in zap range and mmu_notifier unmap
authorSean Christopherson <seanjc@google.com>
Fri, 25 Mar 2022 23:03:48 +0000 (23:03 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 2 Apr 2022 09:34:39 +0000 (05:34 -0400)
commit6aae4aa12aee34447ccb15a249e7783d5d67ed87
tree15072e9c822f4ad09c856670244c3c5c753a3c91
parent14ce9189e1ac3a067de043d281399d23d428c295
KVM: x86/mmu: Zap only TDP MMU leafs in zap range and mmu_notifier unmap

Re-introduce zapping only leaf SPTEs in kvm_zap_gfn_range() and
kvm_tdp_mmu_unmap_gfn_range(), this time without losing a pending TLB
flush when processing multiple roots (including nested TDP shadow roots).
Dropping the TLB flush resulted in random crashes when running Hyper-V
Server 2019 in a guest with KSM enabled in the host (or any source of
mmu_notifier invalidations, KSM is just the easiest to force).

This effectively revert commits bf60868b783a84111b4a91684c2e804c0a9c37cc
and 924cb9bc8b60493c1f2c088a3836a17ec6907fc2, and thus restores commit
30cd9dfe3d5876def4de33c2d3c8082384707b71, plus this delta on top:

bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end,
        struct kvm_mmu_page *root;

        for_each_tdp_mmu_root_yield_safe(kvm, root, as_id)
-               flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, false);
+               flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, flush);

        return flush;
 }

Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220325230348.2587437-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/mmu/tdp_mmu.h