public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] KVM: Make the maximum number of user memslots configurable and raise the default
@ 2021-01-27 17:57 Vitaly Kuznetsov
  2021-01-27 17:57 ` [PATCH 1/5] KVM: Make the maximum number of user memslots a per-VM thing Vitaly Kuznetsov
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Vitaly Kuznetsov @ 2021-01-27 17:57 UTC (permalink / raw)
  To: kvm, Paolo Bonzini
  Cc: Sean Christopherson, Wanpeng Li, Jim Mattson, Igor Mammedov,
	Maciej S . Szmigiero

This is a successor of previously sent "[PATCH RFC 0/4] KVM: x86:
Drastically raise KVM_USER_MEM_SLOTS limit".

Changes since RFC:
- Re-wrote everything [Sean]. The maximum number of slots is now
a per-VM thing controlled by an ioctl.

Original description:

Current KVM_USER_MEM_SLOTS limit on x86 (509) can be a limiting factor
for some configurations. In particular, when QEMU tries to start a Windows
guest with Hyper-V SynIC enabled and e.g. 256 vCPUs the limit is hit as
SynIC requires two pages per vCPU and the guest is free to pick any GFN for
each of them, this fragments memslots as QEMU wants to have a separate
memslot for each of these pages (which are supposed to act as 'overlay'
pages).

Memory slots are allocated dynamically in KVM when added so the only real
limitation is 'id_to_index' array which is 'short'. We don't seem to have
any other KVM_MEM_SLOTS_NUM/KVM_USER_MEM_SLOTS-sized statically defined
structures.

We could've just raised the limit to e.g. '1021' (we have 3 private
memslots on x86) and this should be enough for now as KVM_MAX_VCPUS is
'288' but AFAIK there are plans to raise this limit as well. Raise the
default value to 32768 - KVM_PRIVATE_MEM_SLOTS and introduce a new ioctl
to set the limit per-VM.

Vitaly Kuznetsov (5):
  KVM: Make the maximum number of user memslots a per-VM thing
  KVM: Raise the maximum number of user memslots
  KVM: Make the maximum number of user memslots configurable
  selftests: kvm: Test the newly introduced KVM_CAP_MEMSLOTS_LIMIT
  selftests: kvm: Raise the default timeout to 120 seconds

 Documentation/virt/kvm/api.rst                | 16 +++++++
 arch/arm64/include/asm/kvm_host.h             |  1 -
 arch/mips/include/asm/kvm_host.h              |  1 -
 arch/powerpc/include/asm/kvm_host.h           |  1 -
 arch/powerpc/kvm/book3s_hv.c                  |  2 +-
 arch/s390/include/asm/kvm_host.h              |  1 -
 arch/s390/kvm/kvm-s390.c                      |  2 +-
 arch/x86/include/asm/kvm_host.h               |  2 -
 include/linux/kvm_host.h                      |  6 +--
 include/uapi/linux/kvm.h                      |  1 +
 .../testing/selftests/kvm/include/kvm_util.h  |  1 +
 tools/testing/selftests/kvm/lib/kvm_util.c    | 30 ++++++++++++-
 .../selftests/kvm/set_memory_region_test.c    | 43 ++++++++++++++++---
 tools/testing/selftests/kvm/settings          |  1 +
 virt/kvm/dirty_ring.c                         |  2 +-
 virt/kvm/kvm_main.c                           | 42 +++++++++++++++---
 16 files changed, 128 insertions(+), 24 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/settings

-- 
2.29.2


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

end of thread, other threads:[~2021-02-08 15:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-27 17:57 [PATCH 0/5] KVM: Make the maximum number of user memslots configurable and raise the default Vitaly Kuznetsov
2021-01-27 17:57 ` [PATCH 1/5] KVM: Make the maximum number of user memslots a per-VM thing Vitaly Kuznetsov
2021-01-27 22:27   ` Maciej S. Szmigiero
2021-01-28  8:45     ` Vitaly Kuznetsov
2021-01-28 10:48       ` Maciej S. Szmigiero
2021-01-28 13:01         ` Paolo Bonzini
2021-01-28 15:26           ` Vitaly Kuznetsov
2021-01-28 17:31           ` Sean Christopherson
2021-01-28 17:59             ` Paolo Bonzini
2021-02-08 14:20               ` Vitaly Kuznetsov
2021-02-08 15:02                 ` Paolo Bonzini
2021-01-27 17:57 ` [PATCH 2/5] KVM: Raise the maximum number of user memslots Vitaly Kuznetsov
2021-01-27 17:57 ` [PATCH 3/5] KVM: Make the maximum number of user memslots configurable Vitaly Kuznetsov
2021-01-27 17:57 ` [PATCH 4/5] selftests: kvm: Test the newly introduced KVM_CAP_MEMSLOTS_LIMIT Vitaly Kuznetsov
2021-01-27 17:57 ` [PATCH 5/5] selftests: kvm: Raise the default timeout to 120 seconds Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox