[PATCH v7 00/29] KVM: Scalable memslots implementation

From: Maciej S. Szmigiero
Date: Mon Dec 06 2021 - 14:55:25 EST


From: "Maciej S. Szmigiero" <maciej.szmigiero@xxxxxxxxxx>

This series is the seventh iteration of the scalable memslots patch set.
It contains a few minor changes that were pointed out during the review
of the previous version.

The series was tested on x86 with KASAN on and booted various guests
successfully (including nested ones; with TDP MMU both enabled and disabled).

The previous version (6) is available here:
https://lore.kernel.org/kvm/cover.1638304315.git.maciej.szmigiero@xxxxxxxxxx/


Changes from v6:
* Add braces around a "for" loop in kvm_check_memslot_overlap(),

* Add a note to commit 25 that kvm_arch_flush_shadow_memslot() might now
receive a memslot with stale data in the "arch" field,

* Keep "slot" in kvm_for_each_memslot_in_gfn_range() iterator and remove
the "end" field there,

* Reorder my SoB on patches so it's always the last SoB on a patch,

* Convert some of Sean's SoBs to "Reviewed-by:",
keeping his SoB on patches that are either from him or co-developed by
him while removing this tag on the remaining ones.


Maciej S. Szmigiero (12):
KVM: Resync only arch fields when slots_arch_lock gets reacquired
KVM: x86: Don't call kvm_mmu_change_mmu_pages() if the count hasn't
changed
KVM: x86: Use nr_memslot_pages to avoid traversing the memslots array
KVM: Integrate gfn_to_memslot_approx() into search_memslots()
KVM: Move WARN on invalid memslot index to update_memslots()
KVM: Resolve memslot ID via a hash table instead of via a static array
KVM: Use interval tree to do fast hva lookup in memslots
KVM: s390: Introduce kvm_s390_get_gfn_end()
KVM: Keep memslots in tree-based structures instead of array-based
ones
KVM: Call kvm_arch_flush_shadow_memslot() on the old slot in
kvm_invalidate_memslot()
KVM: Optimize gfn lookup in kvm_zap_gfn_range()
KVM: Optimize overlapping memslots check

Sean Christopherson (17):
KVM: Require total number of memslot pages to fit in an unsigned long
KVM: Open code kvm_delete_memslot() into its only caller
KVM: Use "new" memslot's address space ID instead of dedicated param
KVM: Let/force architectures to deal with arch specific memslot data
KVM: arm64: Use "new" memslot instead of userspace memory region
KVM: MIPS: Drop pr_debug from memslot commit to avoid using "mem"
KVM: PPC: Avoid referencing userspace memory region in memslot updates
KVM: s390: Use "new" memslot instead of userspace memory region
KVM: x86: Use "new" memslot instead of userspace memory region
KVM: RISC-V: Use "new" memslot instead of userspace memory region
KVM: Stop passing kvm_userspace_memory_region to arch memslot hooks
KVM: Use prepare/commit hooks to handle generic memslot metadata
updates
KVM: x86: Don't assume old/new memslots are non-NULL at memslot commit
KVM: s390: Skip gfn/size sanity checks on memslot DELETE or FLAGS_ONLY
KVM: Don't make a full copy of the old memslot in
__kvm_set_memory_region()
KVM: Wait 'til the bitter end to initialize the "new" memslot
KVM: Dynamically allocate "new" memslots from the get-go

arch/arm64/kvm/Kconfig | 1 +
arch/arm64/kvm/mmu.c | 27 +-
arch/mips/kvm/Kconfig | 1 +
arch/mips/kvm/mips.c | 9 +-
arch/powerpc/include/asm/kvm_ppc.h | 14 +-
arch/powerpc/kvm/Kconfig | 1 +
arch/powerpc/kvm/book3s.c | 14 +-
arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 +-
arch/powerpc/kvm/book3s_hv.c | 28 +-
arch/powerpc/kvm/book3s_hv_nested.c | 4 +-
arch/powerpc/kvm/book3s_hv_uvmem.c | 14 +-
arch/powerpc/kvm/book3s_pr.c | 9 +-
arch/powerpc/kvm/booke.c | 7 +-
arch/powerpc/kvm/powerpc.c | 9 +-
arch/riscv/kvm/mmu.c | 31 +-
arch/s390/kvm/Kconfig | 1 +
arch/s390/kvm/kvm-s390.c | 98 ++--
arch/s390/kvm/kvm-s390.h | 14 +
arch/s390/kvm/pv.c | 4 +-
arch/x86/include/asm/kvm_host.h | 3 +-
arch/x86/kvm/Kconfig | 1 +
arch/x86/kvm/debugfs.c | 6 +-
arch/x86/kvm/mmu/mmu.c | 38 +-
arch/x86/kvm/x86.c | 41 +-
include/linux/kvm_host.h | 272 ++++++---
virt/kvm/kvm_main.c | 836 ++++++++++++++++------------
26 files changed, 850 insertions(+), 637 deletions(-)