Skip to content

KVM: x86/mmu: Optimize TDP MMU huge page recovery during disable-dirty-log

David Matlack kvm 2 versions – Applied

Status from this message: Applied to kvm-x86 mmu, thanks! Note, these won't be contiguous due to the

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 9 repliesApplied
  2. v17 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Use a separate iterator to walk down to child SPTEs during huge page recovery [Sean]
- Return SHADOW_NONPRESENT_VALUE in error conditions in make_huge_spte() [Vipin][off-list]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/6KVM: x86/mmu: Drop @max_level from kvm_mmu_max_mapping_level()arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h arch/x86/kvm/mmu/tdp_mmu.c+5 -90 replies
2/6KVM: x86/mmu: Batch TLB flushes when zapping collapsible TDP MMU SPTEsarch/x86/kvm/mmu/tdp_mmu.c+10 -450 replies
3/6KVM: x86/mmu: Refactor TDP MMU iter need resched checkarch/x86/kvm/mmu/tdp_mmu.c+11 -51 reply
4/6KVM: x86/mmu: Recover TDP MMU huge page mappings in-place instead of zappingarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/spte.c +4 more+94 -306 replies
5/6KVM: x86/mmu: Rename make_huge_page_split_spte() to make_small_spte()arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/spte.c arch/x86/kvm/mmu/spte.h +1 more+6 -60 replies
6/6KVM: x86/mmu: WARN if huge page recovery triggered during dirty loggingarch/x86/kvm/mmu/tdp_mmu.c+3 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/6] KVM: x86/mmu: Optimize TDP MMU huge page recovery during disable-dirty-log

Rework the TDP MMU disable-dirty-log path to batch TLB flushes and recover huge page mappings, rather than zapping and flushing for every potential huge page mapping.

With this series, dirty_log_perf_test shows a decrease in the time it takes to disable dirty logging, as well as a decrease in the number of vCPU faults:

 $ ./dirty_log_perf_test -s anonymous_hugetlb_2mb -v 64 -e -b 4g

Before: Disabling dirty logging time: 14.334453428s (131072 flushes)
After: Disabling dirty logging time: 4.794969689s (76 flushes)

Before: 393,599 kvm:kvm_page_fault
After: 262,575 kvm:kvm_page_fault

v2:
- Use a separate iterator to walk down to child SPTEs during huge page recovery [Sean]
- Return SHADOW_NONPRESENT_VALUE in error conditions in make_huge_spte() [Vipin][off-list]

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

David Matlack (6):
KVM: x86/mmu: Drop @max_level from kvm_mmu_max_mapping_level()
KVM: x86/mmu: Batch TLB flushes when zapping collapsible TDP MMU SPTEs
KVM: x86/mmu: Refactor TDP MMU iter need resched check
KVM: x86/mmu: Recover TDP MMU huge page mappings in-place instead of
zapping
KVM: x86/mmu: Rename make_huge_page_split_spte() to make_small_spte()
KVM: x86/mmu: WARN if huge page recovery triggered during dirty
logging

 arch/x86/include/asm/kvm_host.h |   4 +-
 arch/x86/kvm/mmu/mmu.c          |  16 ++--
 arch/x86/kvm/mmu/mmu_internal.h |   3 +-
 arch/x86/kvm/mmu/spte.c         |  43 +++++++++--
 arch/x86/kvm/mmu/spte.h         |   5 +-
 arch/x86/kvm/mmu/tdp_mmu.c      | 129 +++++++++++++++++---------------
 arch/x86/kvm/mmu/tdp_mmu.h      |   4 +-
 arch/x86/kvm/x86.c              |  18 ++---
 8 files changed, 128 insertions(+), 94 deletions(-)

base-commit: 728d17c2cb8cc5f9ac899173d0e9a67fb8887622

Signature · 1 line
2.46.0.295.g3b9ea8a38a-goog