linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/29] KVM: Scalable memslots implementation
@ 2021-11-30 21:41 Maciej S. Szmigiero
  2021-11-30 21:41 ` [PATCH v6 01/29] KVM: Require total number of memslot pages to fit in an unsigned long Maciej S. Szmigiero
                   ` (29 more replies)
  0 siblings, 30 replies; 47+ messages in thread
From: Maciej S. Szmigiero @ 2021-11-30 21:41 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel,
	Igor Mammedov, Marc Zyngier, James Morse, Julien Thierry,
	Suzuki K Poulose, Huacai Chen, Aleksandar Markovic,
	Paul Mackerras, Christian Borntraeger, Janosch Frank,
	David Hildenbrand, Cornelia Huck, Claudio Imbrenda, Anup Patel,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandru Elisei,
	Atish Patra, Ben Gardon, kvm, linux-kernel

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

This series contains the sixth iteration of the scalable memslots patch set.
It is based on Sean's version "5.5", but with integrated patches for issues
that arose during its review round.

In addition to that, the kvm_for_each_memslot_in_gfn_range() implementation
was reworked to return only strictly overlapping memslots and to use
iterators.

However, I've dropped a similar kvm_for_each_memslot_in_hva_range() rework
since the existing implementation was already returning only strictly
overlapping memslots and it was already based on interval tree iterators,
so wrapping them in another layer of iterators would only add unnecessary
complexity.
The code in this "for"-like macro is also self-contained and very simple,
so let's keep it this way.

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

Sean's previous version (5.5) is available here:
[1]: https://lore.kernel.org/kvm/20211104002531.1176691-1-seanjc@google.com/


Changes from v5.5:
* Note open-coding of kvm_copy_memslots() in the commit message of patch 3,

* When changing kvm_arch_prepare_memory_region() signature change it also
  in the RISC-V implementation of this function in patch 5,

* Avoid overflowing "nr_mmu_pages" in patch 18,

* Add a comment to the "slot id to memslot" hash table declaration
  explaining its bucket count in patch 21,

* Don't check twice for "old" being != NULL in kvm_replace_memslot()
  in patch 21,

* Remove unnecessary "new" NULL check in kvm_replace_memslot() in patch 22,

* Split out changing kvm_invalidate_memslot() to call
  kvm_arch_flush_shadow_memslot() on an old slot from patch 24 to a separate
  patch 25,

* Make kvm_for_each_memslot_in_gfn_range() return only strictly overlapping
  memslots and rewrite its implementation to use iterators in patch 26.


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            | 277 ++++++---
 virt/kvm/kvm_main.c                 | 835 ++++++++++++++++------------
 26 files changed, 854 insertions(+), 637 deletions(-)


^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2021-12-02 10:33 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 21:41 [PATCH v6 00/29] KVM: Scalable memslots implementation Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 01/29] KVM: Require total number of memslot pages to fit in an unsigned long Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 02/29] KVM: Open code kvm_delete_memslot() into its only caller Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 03/29] KVM: Resync only arch fields when slots_arch_lock gets reacquired Maciej S. Szmigiero
2021-12-01  1:07   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-12-02 10:32     ` Paolo Bonzini
2021-11-30 21:41 ` [PATCH v6 04/29] KVM: Use "new" memslot's address space ID instead of dedicated param Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 05/29] KVM: Let/force architectures to deal with arch specific memslot data Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 06/29] KVM: arm64: Use "new" memslot instead of userspace memory region Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 07/29] KVM: MIPS: Drop pr_debug from memslot commit to avoid using "mem" Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 08/29] KVM: PPC: Avoid referencing userspace memory region in memslot updates Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 09/29] KVM: s390: Use "new" memslot instead of userspace memory region Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 10/29] KVM: x86: " Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 11/29] KVM: RISC-V: " Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 12/29] KVM: Stop passing kvm_userspace_memory_region to arch memslot hooks Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 13/29] KVM: Use prepare/commit hooks to handle generic memslot metadata updates Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 14/29] KVM: x86: Don't assume old/new memslots are non-NULL at memslot commit Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 15/29] KVM: s390: Skip gfn/size sanity checks on memslot DELETE or FLAGS_ONLY Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 16/29] KVM: Don't make a full copy of the old memslot in __kvm_set_memory_region() Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 17/29] KVM: x86: Don't call kvm_mmu_change_mmu_pages() if the count hasn't changed Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 18/29] KVM: x86: Use nr_memslot_pages to avoid traversing the memslots array Maciej S. Szmigiero
2021-12-01  2:21   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 19/29] KVM: Integrate gfn_to_memslot_approx() into search_memslots() Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 20/29] KVM: Move WARN on invalid memslot index to update_memslots() Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 21/29] KVM: Resolve memslot ID via a hash table instead of via a static array Maciej S. Szmigiero
2021-12-01  2:54   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-12-01 16:23       ` Sean Christopherson
2021-11-30 21:41 ` [PATCH v6 22/29] KVM: Use interval tree to do fast hva lookup in memslots Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 23/29] KVM: s390: Introduce kvm_s390_get_gfn_end() Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 24/29] KVM: Keep memslots in tree-based structures instead of array-based ones Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 25/29] KVM: Call kvm_arch_flush_shadow_memslot() on the old slot in kvm_invalidate_memslot() Maciej S. Szmigiero
2021-12-01  3:27   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 26/29] KVM: Optimize gfn lookup in kvm_zap_gfn_range() Maciej S. Szmigiero
2021-12-01  3:41   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-12-01 16:36       ` Sean Christopherson
2021-12-01 23:08         ` Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 27/29] KVM: Optimize overlapping memslots check Maciej S. Szmigiero
2021-12-01  3:08   ` Sean Christopherson
2021-12-01 15:45     ` Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 28/29] KVM: Wait 'til the bitter end to initialize the "new" memslot Maciej S. Szmigiero
2021-11-30 21:41 ` [PATCH v6 29/29] KVM: Dynamically allocate "new" memslots from the get-go Maciej S. Szmigiero
2021-12-01  3:45 ` [PATCH v6 00/29] KVM: Scalable memslots implementation Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).