Skip to content

kvm: memory slot cleanups, fix, and increase

Alex Williamson kvm lkml 2 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 6 repliesApplied
  2. v110 patches 6 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/10kvm: Restrict non-existing slot state transitionsvirt/kvm/kvm_main.c+7 -23 replies
2/10kvm: Check userspace_addr when modifying a memory slotvirt/kvm/kvm_main.c+7 -10 replies
3/10kvm: Fix iommu map/unmap to handle memory slot movesvirt/kvm/kvm_main.c+11 -80 replies
4/10kvm: Minor memory slot optimizationvirt/kvm/kvm_main.c+14 -70 replies
5/10kvm: Rename KVM_MEMORY_SLOTS -> KVM_USER_MEM_SLOTSarch/ia64/include/asm/kvm_host.h arch/ia64/kvm/kvm-ia64.c arch/powerpc/include/asm/kvm_host.h +7 more+19 -190 replies
6/10kvm: Make KVM_PRIVATE_MEM_SLOTS optionalarch/ia64/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_host.h arch/s390/include/asm/kvm_host.h +2 more+7 -90 replies
7/10kvm: struct kvm_memory_slot.user_alloc -> boolarch/ia64/kvm/kvm-ia64.c arch/powerpc/kvm/powerpc.c arch/s390/kvm/kvm-s390.c +4 more+23 -220 replies
8/10kvm: struct kvm_memory_slot.flags -> u32include/linux/kvm_host.h+1 -10 replies
9/10kvm: struct kvm_memory_slot.id -> shortinclude/linux/kvm_host.h virt/kvm/kvm_main.c+4 -20 replies
10/10kvm: Increase user memory slots on x86 to 125arch/x86/include/asm/kvm_host.h+1 -10 replies

Reviews trailers per patch

None of the 10 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMarcelo TosattiGleb Natapov
SeriesR-b R-b
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/10] kvm: memory slot cleanups, fix, and increase

v2: Update 02/10 to not check userspace_addr when slot is removed.
Yoshikawa-san withdrew objection to increase slot_bitmap prior to his series to remove slot_bitmap.

This series does away with any kind of complicated resizing of the slot array and simply does a one time increase. I do compact struct kvm_memory_slot a bit to take better advantage of the space we are using. This reduces each slot from 64 bytes (x86_64) to 56 bytes. By enforcing the API around valid operations for an unused slot and fields that can be modified runtime, I found and was able to fix a bug in iommu mapping for slots. The renames enabled me to find the previously posted bug fix for catching slot overlaps.

As mentioned in the series, the primary motivation for increasing memory slots is assigned devices. With this, I've been able to assign 30 devices to a single VM and could have gone further, but ran out of SRIOV VFs. Typical devices use anywhere from 2-4 slots and max out at 8 slots. 125 user slots (3 private slots) allows us to support between 28 and 56 typical devices per VM.

Tested on x86_64, compiled on ia64, powerpc, and s390.

Thanks,
Alex

---

Alex Williamson (10):
kvm: Restrict non-existing slot state transitions
kvm: Check userspace_addr when modifying a memory slot
kvm: Fix iommu map/unmap to handle memory slot moves
kvm: Minor memory slot optimization
kvm: Rename KVM_MEMORY_SLOTS -> KVM_USER_MEM_SLOTS
kvm: Make KVM_PRIVATE_MEM_SLOTS optional
kvm: struct kvm_memory_slot.user_alloc -> bool
kvm: struct kvm_memory_slot.flags -> u32
kvm: struct kvm_memory_slot.id -> short
kvm: Increase user memory slots on x86 to 125

 arch/ia64/include/asm/kvm_host.h    |    4 --
 arch/ia64/kvm/kvm-ia64.c            |    8 ++--
 arch/powerpc/include/asm/kvm_host.h |    6 +--
 arch/powerpc/kvm/book3s_hv.c        |    2 -
 arch/powerpc/kvm/powerpc.c          |    4 +-
 arch/s390/include/asm/kvm_host.h    |    4 --
 arch/s390/kvm/kvm-s390.c            |    4 +-
 arch/x86/include/asm/kvm_host.h     |    8 ++--
 arch/x86/include/asm/vmx.h          |    6 +--
 arch/x86/kvm/vmx.c                  |    6 +--
 arch/x86/kvm/x86.c                  |   10 ++---
 include/linux/kvm_host.h            |   24 +++++++-----
 virt/kvm/kvm_main.c                 |   72 +++++++++++++++++++++++------------
 13 files changed, 90 insertions(+), 68 deletions(-)