Skip to content

RFC KVM: x86/mmu: Eager Page Splitting for the TDP MMU

David Matlack kvm lkml oe-lkp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest15 patches 63 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15KVM: x86/mmu: Rename rmap_write_protect to kvm_vcpu_write_protect_gfnarch/x86/kvm/mmu/mmu.c+3 -32 replies
2/15KVM: x86/mmu: Rename __rmap_write_protect to rmap_write_protectarch/x86/kvm/mmu/mmu.c+6 -62 replies
3/15KVM: x86/mmu: Automatically update iter->old_spte if cmpxchg failsarch/x86/kvm/mmu/tdp_mmu.c+18 -382 replies
4/15KVM: x86/mmu: Factor out logic to atomically install a new page tablearch/x86/kvm/mmu/tdp_mmu.c+37 -164 replies
5/15KVM: x86/mmu: Abstract mmu caches out to a separate structarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/tdp_mmu.c+52 -263 replies
6/15KVM: x86/mmu: Derive page role from parentarch/x86/kvm/mmu/tdp_mmu.c+23 -206 replies
7/15KVM: x86/mmu: Pass in vcpu->arch.mmu_caches instead of vcpuarch/x86/kvm/mmu/tdp_mmu.c+7 -91 reply
8/15KVM: x86/mmu: Helper method to check for large and present sptesarch/x86/kvm/mmu/spte.h arch/x86/kvm/mmu/tdp_mmu.c+6 -23 replies
9/15KVM: x86/mmu: Move restore_acc_track_spte to spte.carch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/spte.c arch/x86/kvm/mmu/spte.h+19 -181 reply
10/15KVM: x86/mmu: Abstract need_resched logic from tdp_mmu_iter_cond_reschedarch/x86/kvm/mmu/tdp_mmu.c+10 -51 reply
11/15KVM: x86/mmu: Refactor tdp_mmu iterators to take kvm_mmu_page rootarch/x86/kvm/mmu/tdp_iter.c arch/x86/kvm/mmu/tdp_iter.h arch/x86/kvm/mmu/tdp_mmu.c+14 -151 reply
12/15KVM: x86/mmu: Split large pages when dirty logging is enabledarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h +5 more+273 -017 replies
13/15KVM: x86/mmu: Split large pages during CLEAR_DIRTY_LOGarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c+26 -813 replies
14/15KVM: x86/mmu: Add tracepoint for splitting large pagesarch/x86/kvm/mmu/mmutrace.h arch/x86/kvm/mmu/tdp_mmu.c+22 -00 replies
15/15KVM: x86/mmu: Update page stats when splitting large pagesarch/x86/kvm/mmu/tdp_mmu.c+6 -12 replies

Reviews trailers per patch

8 of 15 patches have a Reviewed-by or Acked-by.

PatchBen GardonPeter Xu
1/15R-b R-b
2/15R-b R-b
3/15
4/15
5/15R-b
6/15
7/15R-b
8/15R-b
9/15R-b
10/15R-b
11/15R-b
12/15
13/15
14/15
15/15

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/15] KVM: x86/mmu: Eager Page Splitting for the TDP MMU

This series is a first pass at implementing Eager Page Splitting for the TDP MMU. For context on the motivation and design of Eager Page Splitting, please see the RFC design proposal and discussion [1].

Paolo, I went ahead and added splitting in both the intially-all-set case (only splitting the region passed to CLEAR_DIRTY_LOG) and the case where we are not using initially-all-set (splitting the entire memslot when dirty logging is enabled) to give you an idea of what both look like.

Note: I will be on vacation all of next week so I will not be able to respond to reviews until Monday November 29. I thought it would be useful to seed discussion and reviews with an early version of the code rather than putting it off another week. But feel free to also ignore this until I get back :)

This series compiles and passes the most basic splitting test:

$ ./dirty_log_perf_test -s anonymous_hugetlb_2mb -v 2 -i 4

But please operate under the assumption that this code is probably buggy.

[1] https://lore.kernel.org/kvm/CALzav=dV_U4r1K9oDq4esb4mpBQDQ2ROQ5zH5wV3KpOaZrRW-A@mail.gmail.com/#t

David Matlack (15):
KVM: x86/mmu: Rename rmap_write_protect to kvm_vcpu_write_protect_gfn
KVM: x86/mmu: Rename __rmap_write_protect to rmap_write_protect
KVM: x86/mmu: Automatically update iter->old_spte if cmpxchg fails
KVM: x86/mmu: Factor out logic to atomically install a new page table
KVM: x86/mmu: Abstract mmu caches out to a separate struct
KVM: x86/mmu: Derive page role from parent
KVM: x86/mmu: Pass in vcpu->arch.mmu_caches instead of vcpu
KVM: x86/mmu: Helper method to check for large and present sptes
KVM: x86/mmu: Move restore_acc_track_spte to spte.c
KVM: x86/mmu: Abstract need_resched logic from
tdp_mmu_iter_cond_resched
KVM: x86/mmu: Refactor tdp_mmu iterators to take kvm_mmu_page root
KVM: x86/mmu: Split large pages when dirty logging is enabled
KVM: x86/mmu: Split large pages during CLEAR_DIRTY_LOG
KVM: x86/mmu: Add tracepoint for splitting large pages
KVM: x86/mmu: Update page stats when splitting large pages

 arch/x86/include/asm/kvm_host.h |  22 ++-
 arch/x86/kvm/mmu/mmu.c          | 185 +++++++++++++-----
 arch/x86/kvm/mmu/mmu_internal.h |   3 +
 arch/x86/kvm/mmu/mmutrace.h     |  20 ++
 arch/x86/kvm/mmu/spte.c         |  64 +++++++
 arch/x86/kvm/mmu/spte.h         |   7 +
 arch/x86/kvm/mmu/tdp_iter.c     |   5 +-
 arch/x86/kvm/mmu/tdp_iter.h     |  10 +-
 arch/x86/kvm/mmu/tdp_mmu.c      | 322 +++++++++++++++++++++++---------
 arch/x86/kvm/mmu/tdp_mmu.h      |   5 +
 arch/x86/kvm/x86.c              |   6 +
 11 files changed, 501 insertions(+), 148 deletions(-)
Signature · 1 line
2.34.0.rc2.393.gf8c9666880-goog