Message ID | 20240823235648.3236880-1-dmatlack@google.com (mailing list archive) |
---|---|
Headers | show |
Series | KVM: x86/mmu: Optimize TDP MMU huge page recovery during disable-dirty-log | expand |
On Fri, Aug 23, 2024, David Matlack wrote: > 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/20240805233114.4060019-8-dmatlack@google.com/ > > 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(-) FYI, these are sitting in kvm-x86 mmu, but will be rebased next week, at which point I'll send the "official" thank yous. [1/8] KVM: x86/mmu: Drop @max_level from kvm_mmu_max_mapping_level() https://github.com/kvm-x86/linux/commit/8ccd51cb5911 [2/8] KVM: x86/mmu: Batch TLB flushes when zapping collapsible TDP MMU SPTEs https://github.com/kvm-x86/linux/commit/35ef80eb29ab [3/8] KVM: x86/mmu: Check yielded_gfn for forward progress iff resched is needed https://github.com/kvm-x86/linux/commit/d400ce271d9c [4/8] KVM: x86/mmu: Demote the WARN on yielded in xxx_cond_resched() to KVM_MMU_WARN_ON https://github.com/kvm-x86/linux/commit/012a5c17cba4 [5/8] KVM: x86/mmu: Refactor TDP MMU iter need resched check https://github.com/kvm-x86/linux/commit/cb059b9e2432 [6/8] KVM: x86/mmu: Recover TDP MMU huge page mappings in-place instead of zapping https://github.com/kvm-x86/linux/commit/13237fb40c74 [7/8] KVM: x86/mmu: Rename make_huge_page_split_spte() to make_small_spte() https://github.com/kvm-x86/linux/commit/1d2a6d0b6438 [8/8] KVM: x86/mmu: WARN if huge page recovery triggered during dirty logging https://github.com/kvm-x86/linux/commit/ed5ca61d995f
On Fri, 23 Aug 2024 16:56:42 -0700, David Matlack wrote: > 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: > > [...] Applied to kvm-x86 mmu, thanks! Note, these won't be contiguous due to the insertion of the other patches, but the hashes should be correct (knock wood). [1/6] KVM: x86/mmu: Drop @max_level from kvm_mmu_max_mapping_level() https://github.com/kvm-x86/linux/commit/8ccd51cb5911 [2/6] KVM: x86/mmu: Batch TLB flushes when zapping collapsible TDP MMU SPTEs https://github.com/kvm-x86/linux/commit/35ef80eb29ab [3/6] KVM: x86/mmu: Refactor TDP MMU iter need resched check https://github.com/kvm-x86/linux/commit/dd2e7dbc4ae2 [4/6] KVM: x86/mmu: Recover TDP MMU huge page mappings in-place instead of zapping https://github.com/kvm-x86/linux/commit/13e2e4f62a4b [5/6] KVM: x86/mmu: Rename make_huge_page_split_spte() to make_small_spte() https://github.com/kvm-x86/linux/commit/430e264b7653 [6/6] KVM: x86/mmu: WARN if huge page recovery triggered during dirty logging https://github.com/kvm-x86/linux/commit/06c4cd957b5c -- https://github.com/kvm-x86/linux/tree/next