KVM: Assert that notifier count is elevated in .change_pte()
[linux-2.6-microblaze.git] / virt / kvm / kvm_main.c
index b299c03..5ce9125 100644 (file)
@@ -461,12 +461,17 @@ static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
 
        trace_kvm_set_spte_hva(address);
 
+       /*
+        * .change_pte() must be surrounded by .invalidate_range_{start,end}(),
+        * and so always runs with an elevated notifier count.  This obviates
+        * the need to bump the sequence count.
+        */
+       WARN_ON_ONCE(!kvm->mmu_notifier_count);
+
        idx = srcu_read_lock(&kvm->srcu);
 
        KVM_MMU_LOCK(kvm);
 
-       kvm->mmu_notifier_seq++;
-
        if (kvm_set_spte_hva(kvm, address, pte))
                kvm_flush_remote_tlbs(kvm);