Commit d012a06ab1d23178fc6856d8d2161fbcc4dd8ebd

Authored by Paolo Bonzini
1 parent 54577e5018

Revert "KVM: x86/mmu: Zap only the relevant pages when removing a memslot"

This reverts commit 4e103134b862314dc2f2f18f2fb0ab972adc3f5f.
Alex Williamson reported regressions with device assignment with
this patch.  Even though the bug is probably elsewhere and still
latent, this is needed to fix the regression.

Fixes: 4e103134b862 ("KVM: x86/mmu: Zap only the relevant pages when removing a memslot", 2019-02-05)
Reported-by: Alex Willamson <alex.williamson@redhat.com>
Cc: stable@vger.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Showing 1 changed file with 1 additions and 32 deletions Side-by-side Diff

... ... @@ -5653,38 +5653,7 @@
5653 5653 struct kvm_memory_slot *slot,
5654 5654 struct kvm_page_track_notifier_node *node)
5655 5655 {
5656   - struct kvm_mmu_page *sp;
5657   - LIST_HEAD(invalid_list);
5658   - unsigned long i;
5659   - bool flush;
5660   - gfn_t gfn;
5661   -
5662   - spin_lock(&kvm->mmu_lock);
5663   -
5664   - if (list_empty(&kvm->arch.active_mmu_pages))
5665   - goto out_unlock;
5666   -
5667   - flush = slot_handle_all_level(kvm, slot, kvm_zap_rmapp, false);
5668   -
5669   - for (i = 0; i < slot->npages; i++) {
5670   - gfn = slot->base_gfn + i;
5671   -
5672   - for_each_valid_sp(kvm, sp, gfn) {
5673   - if (sp->gfn != gfn)
5674   - continue;
5675   -
5676   - kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list);
5677   - }
5678   - if (need_resched() || spin_needbreak(&kvm->mmu_lock)) {
5679   - kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush);
5680   - flush = false;
5681   - cond_resched_lock(&kvm->mmu_lock);
5682   - }
5683   - }
5684   - kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush);
5685   -
5686   -out_unlock:
5687   - spin_unlock(&kvm->mmu_lock);
  5656 + kvm_mmu_zap_all(kvm);
5688 5657 }
5689 5658  
5690 5659 void kvm_mmu_init_vm(struct kvm *kvm)