On Wed, 26 Apr 2023 15:03:23 -0700, Sean Christopherson wrote: > Preserve TDP MMU roots until they are explicitly invalidated by gifting > the TDP MMU itself a reference to a root when it is allocated. Keeping a > reference in the TDP MMU fixes a flaw where the TDP MMU exhibits terrible > performance, and can potentially even soft-hang a vCPU, if a vCPU > frequently unloads its roots, e.g. when KVM is emulating SMI+RSM. > > When KVM emulates something that invalidates _all_ TLB entries, e.g. SMI > and RSM, KVM unloads all of the vCPUs roots (KVM keeps a small per-vCPU > cache of previous roots). Unloading roots is a simple way to ensure KVM > flushes and synchronizes all roots for the vCPU, as KVM flushes and syncs > when allocating a "new" root (from the vCPU's perspective). > > [...] Applied to kvm-x86 mmu to replace v2. Same spiel as v2: pushed immediately to get testing in -next, will squash trivialities as needed. [1/1] KVM: x86: Preserve TDP MMU roots until they are explicitly invalidated https://github.com/kvm-x86/linux/commit/edbdb43fc96b -- https://github.com/kvm-x86/linux/tree/next https://github.com/kvm-x86/linux/tree/fixes