Re: [PATCH 10/18] KVM: Move x86's MMU notifier memslot walkers to generic code

From: Paolo Bonzini
Date: Wed Mar 31 2021 - 03:53:20 EST


On 26/03/21 03:19, Sean Christopherson wrote:
+#ifdef KVM_ARCH_WANT_NEW_MMU_NOTIFIER_APIS
+ kvm_handle_hva_range(mn, address, address + 1, pte, kvm_set_spte_gfn);
+#else
struct kvm *kvm = mmu_notifier_to_kvm(mn);
int idx;
trace_kvm_set_spte_hva(address);
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);

KVM_MMU_UNLOCK(kvm);
srcu_read_unlock(&kvm->srcu, idx);
+#endif

The kvm->mmu_notifier_seq is missing in the new API side. I guess you can add an argument to __kvm_handle_hva_range and handle it also in patch 15 ("KVM: Take mmu_lock when handling MMU notifier iff the hva hits a memslot").

Paolo