Skip to content

KVM: x86/mmu: Rework TDP MMU eager page splitting SP allocations

David Matlack kvm 2 versions – Applied

Status from this message: Applied to kvm-x86 mmu, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyApplied
  2. v31 patch 3 repliesSuperseded

Changes in v4 from the cover letter

- Use kmem_cache_zalloc() instead of __GFP_ZERO [Sean]
- Move mmu_lock and RCU acquire/release into the loop [Sean]
- Avoid unnecessary reaquire of RCU read lock [Sean]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: x86/mmu: Always drop mmu_lock to allocate TDP MMU SPs for eager splittingarch/x86/kvm/mmu/tdp_mmu.c+1 -150 replies
2/4KVM: x86/mmu: Hard code GFP flags for TDP MMU eager split allocationsarch/x86/kvm/mmu/tdp_mmu.c+4 -60 replies
3/4KVM: x86/mmu: Unnest TDP MMU helpers to allocate SPs for eager splittingarch/x86/kvm/mmu/tdp_mmu.c+18 -300 replies
4/4KVM: x86/mmu: Avoid reacquiring RCU if TDP MMU fails to allocate an SParch/x86/kvm/mmu/tdp_mmu.c+5 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/4] KVM: x86/mmu: Rework TDP MMU eager page splitting SP allocations

Rework the TDP MMU eager page splitting code to always drop mmu_lock when allocation shadow pages, to avoid causing lock contention with vCPU threads during CLEAR_DIRTY_LOG (where mmu_lock is held for write).

The first patch changes KVM to always drop mmu_lock lock and the subsequent patches clean up and simplify the code now that conditional locking is gone.

v4:
- Use kmem_cache_zalloc() instead of __GFP_ZERO [Sean]
- Move mmu_lock and RCU acquire/release into the loop [Sean]
- Avoid unnecessary reaquire of RCU read lock [Sean]

v3: https://lore.kernel.org/kvm/[email protected]/
- Only drop mmu_lock during TDP MMU eager page splitting. This fixes the performance regression without regressing CLEAR_DIRTY_LOG performance on other architectures from frequent lock dropping.

v2: https://lore.kernel.org/kvm/[email protected]/
- Rebase onto kvm/queue [Marc]

v1: https://lore.kernel.org/kvm/[email protected]/

Cc Bibo Mao <[email protected]>
Cc Sean Christopherson <[email protected]>

David Matlack (4):
KVM: x86/mmu: Always drop mmu_lock to allocate TDP MMU SPs for eager
splitting
KVM: x86/mmu: Hard code GFP flags for TDP MMU eager split allocations
KVM: x86/mmu: Unnest TDP MMU helpers to allocate SPs for eager
splitting
KVM: x86/mmu: Avoid reacquiring RCU if TDP MMU fails to allocate an SP

 arch/x86/kvm/mmu/tdp_mmu.c | 78 ++++++++++++--------------------------
 1 file changed, 24 insertions(+), 54 deletions(-)

base-commit: af0903ab52ee6d6f0f63af67fa73d5eb00f79b9a

Signature · 1 line
2.45.2.505.gda0bf45e8d-goog