On Wed, 10 Jan 2024 18:00:40 -0800, Sean Christopherson wrote: > This series is the result of digging into why deleting a memslot, which on > x86 forces all vCPUs to reload a new MMU root, causes noticeably more jitter > in vCPUs and other tasks when running with the TDP MMU than the Shadow MMU > (with TDP enabled). > > Patch 1 addresses the most obvious issue by simply zapping at a finer > granularity so that if a different task, e.g. a vCPU, wants to run on the > pCPU doing the zapping, it doesn't have to wait for KVM to zap an entire > 1GiB region, which can take a hundreds of microseconds (or more). The > shadow MMU checks for need_resched() (and mmu_lock contention, see below) > every 10 zaps, which is why the shadow MMU doesn't induce the same level > of jitter. > > [...] Applied to kvm-x86 mmu, thanks! [1/8] KVM: x86/mmu: Zap invalidated TDP MMU roots at 4KiB granularity https://github.com/kvm-x86/linux/commit/8ca983631f3c [2/8] KVM: x86/mmu: Don't do TLB flush when zappings SPTEs in invalid roots https://github.com/kvm-x86/linux/commit/fcdffe97f80e [3/8] KVM: x86/mmu: Allow passing '-1' for "all" as_id for TDP MMU iterators https://github.com/kvm-x86/linux/commit/6577f1efdff4 [4/8] KVM: x86/mmu: Skip invalid roots when zapping leaf SPTEs for GFN range https://github.com/kvm-x86/linux/commit/99b85fda91b1 [5/8] KVM: x86/mmu: Skip invalid TDP MMU roots when write-protecting SPTEs https://github.com/kvm-x86/linux/commit/d746182337c2 [6/8] KVM: x86/mmu: Check for usable TDP MMU root while holding mmu_lock for read https://github.com/kvm-x86/linux/commit/f5238c2a60f1 [7/8] KVM: x86/mmu: Alloc TDP MMU roots while holding mmu_lock for read https://github.com/kvm-x86/linux/commit/dab285e4ec73 [8/8] KVM: x86/mmu: Free TDP MMU roots while holding mmy_lock for read https://github.com/kvm-x86/linux/commit/576a15de8d29 -- https://github.com/kvm-x86/linux/tree/next