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@xxxxxxxxxxxxxx/#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(-) -- 2.34.0.rc2.393.gf8c9666880-goog