Re: [PATCH 1/3] KVM: x86/mmu: Open code walking TDP MMU roots for mmu_notifier's zap SPTEs

From: Paolo Bonzini
Date: Thu Sep 21 2023 - 14:39:08 EST


On 9/16/23 02:39, Sean Christopherson wrote:
Use the "inner" TDP MMU root walker when zapping SPTEs in response to an
mmu_notifier invalidation instead of invoking kvm_tdp_mmu_zap_leafs().
This will allow reworking for_each_tdp_mmu_root_yield_safe() to do more
work, and to also make it usable in more places, without increasing the
number of params to the point where it adds no value.

The mmu_notifier path is a bit of a special snowflake, e.g. it zaps only a
single address space (because it's per-slot), and can't always yield.

Drop the @can_yield param from tdp_mmu_zap_leafs() as its sole remaining
caller unconditionally passes "true".

Slightly rewritten commit log:

---
The mmu_notifier path is a bit of a special snowflake, e.g. it zaps only a
single address space (because it's per-slot), and can't always yield.
Because of this, it calls kvm_tdp_mmu_zap_leafs() in ways that no one
else does.

Iterate manually over the leafs in response to an mmu_notifier
invalidation, instead of invoking kvm_tdp_mmu_zap_leafs(). Drop the
@can_yield param from kvm_tdp_mmu_zap_leafs() as its sole remaining
caller unconditionally passes "true".
---

and using the "__" macro can be moved to the second patch.

Paolo