Skip to content

KVM: Turn the vcpu array into an xarray

Marc Zyngier kvm kvmarm linux-mips linuxppc-dev 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 0 repliesNew
  2. v15 patches 18 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7KVM: Move wiping of the kvm->vcpus array to common codearch/arm64/kvm/arm.c arch/mips/kvm/mips.c arch/powerpc/kvm/powerpc.c +5 more+22 -750 replies
2/7KVM: mips: Use kvm_get_vcpu() instead of open-coded accessarch/mips/kvm/loongson_ipi.c arch/mips/kvm/mips.c+3 -30 replies
3/7KVM: s390: Use kvm_get_vcpu() instead of open-coded accessarch/s390/kvm/kvm-s390.c+5 -30 replies
4/7KVM: x86: Use kvm_get_vcpu() instead of open-coded accessarch/x86/kvm/vmx/posted_intr.c+1 -10 replies
5/7KVM: Convert the kvm->vcpus array to a xarrayinclude/linux/kvm_host.h virt/kvm/kvm_main.c+12 -80 replies
6/7KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s indexarch/arm64/kvm/arch_timer.c arch/arm64/kvm/arm.c arch/arm64/kvm/pmu-emul.c +36 more+114 -1000 replies
7/7KVM: Convert kvm_for_each_vcpu() to using xa_for_each_range()include/linux/kvm_host.h+3 -50 replies

Reviews trailers per patch

3 of 7 patches have a Reviewed-by or Acked-by.

PatchClaudio ImbrendaPhilippe Mathieu-Daudé
1/7R-b
2/7R-b
3/7R-b
4/7
5/7
6/7
7/7

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 0/7] KVM: Turn the vcpu array into an xarray

The kvm structure is pretty large. A large portion of it is the vcpu array, which is 4kB on arm64 with 512 vcpu, double that on x86-64. Of course, hardly anyone runs VMs this big, so this is often a net waste of memory and cache locality.

A possible approach is to turn the fixed-size array into an xarray, which results in a net code deletion after a bit of cleanup.

* From v1:
- Rebased on v5.16-rc1
- Dropped the dubious locking on teardown
- Converted kvm_for_each_vcpu() to xa_for_each_range(), together with an invasive change converting the index to an unsigned long

Marc Zyngier (7):
KVM: Move wiping of the kvm->vcpus array to common code
KVM: mips: Use kvm_get_vcpu() instead of open-coded access
KVM: s390: Use kvm_get_vcpu() instead of open-coded access
KVM: x86: Use kvm_get_vcpu() instead of open-coded access
KVM: Convert the kvm->vcpus array to a xarray
KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index
KVM: Convert kvm_for_each_vcpu() to using xa_for_each_range()

 arch/arm64/kvm/arch_timer.c           |  8 ++---
 arch/arm64/kvm/arm.c                  | 16 +++------
 arch/arm64/kvm/pmu-emul.c             |  2 +-
 arch/arm64/kvm/psci.c                 |  6 ++--
 arch/arm64/kvm/reset.c                |  2 +-
 arch/arm64/kvm/vgic/vgic-init.c       | 10 +++---
 arch/arm64/kvm/vgic/vgic-kvm-device.c |  2 +-
 arch/arm64/kvm/vgic/vgic-mmio-v2.c    |  3 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c    |  7 ++--
 arch/arm64/kvm/vgic/vgic-v3.c         |  4 +--
 arch/arm64/kvm/vgic/vgic-v4.c         |  5 +--
 arch/arm64/kvm/vgic/vgic.c            |  2 +-
 arch/mips/kvm/loongson_ipi.c          |  4 +--
 arch/mips/kvm/mips.c                  | 23 ++-----------
 arch/powerpc/kvm/book3s_32_mmu.c      |  2 +-
 arch/powerpc/kvm/book3s_64_mmu.c      |  2 +-
 arch/powerpc/kvm/book3s_hv.c          |  8 ++---
 arch/powerpc/kvm/book3s_pr.c          |  2 +-
 arch/powerpc/kvm/book3s_xics.c        |  6 ++--
 arch/powerpc/kvm/book3s_xics.h        |  2 +-
 arch/powerpc/kvm/book3s_xive.c        | 15 +++++----
 arch/powerpc/kvm/book3s_xive.h        |  4 +--
 arch/powerpc/kvm/book3s_xive_native.c |  8 ++---
 arch/powerpc/kvm/e500_emulate.c       |  2 +-
 arch/powerpc/kvm/powerpc.c            | 10 +-----
 arch/riscv/kvm/vcpu_sbi.c             |  2 +-
 arch/riscv/kvm/vm.c                   | 10 +-----
 arch/riscv/kvm/vmid.c                 |  2 +-
 arch/s390/kvm/interrupt.c             |  2 +-
 arch/s390/kvm/kvm-s390.c              | 47 ++++++++++-----------------
 arch/s390/kvm/kvm-s390.h              |  4 +--
 arch/x86/kvm/hyperv.c                 |  7 ++--
 arch/x86/kvm/i8254.c                  |  2 +-
 arch/x86/kvm/i8259.c                  |  5 +--
 arch/x86/kvm/ioapic.c                 |  4 +--
 arch/x86/kvm/irq_comm.c               |  7 ++--
 arch/x86/kvm/kvm_onhyperv.c           |  3 +-
 arch/x86/kvm/lapic.c                  |  6 ++--
 arch/x86/kvm/svm/avic.c               |  2 +-
 arch/x86/kvm/svm/sev.c                |  3 +-
 arch/x86/kvm/vmx/posted_intr.c        |  2 +-
 arch/x86/kvm/x86.c                    | 30 +++++++----------
 include/linux/kvm_host.h              | 17 +++++-----
 virt/kvm/kvm_main.c                   | 41 ++++++++++++++++-------
 44 files changed, 158 insertions(+), 193 deletions(-)
Signature · 6 lines
2.30.2

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm