From: Marc Zyngier <maz@kernel.org>
To: kvm@vger.kernel.org, linux-mips@vger.kernel.org,
kvmarm@lists.cs.columbia.edu, linuxppc-dev@lists.ozlabs.org,
Paolo Bonzini <pbonzini@redhat.com>
Cc: "Juergen Gross" <jgross@suse.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Janosch Frank" <frankja@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Sean Christopherson" <seanjc@google.com>,
"Anup Patel" <anup.patel@wdc.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
"Paul Mackerras" <paulus@samba.org>,
"James Morse" <james.morse@arm.com>,
kernel-team@android.com,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Alexandru Elisei" <alexandru.elisei@arm.com>,
"Suzuki K Poulose" <suzuki.poulose@arm.com>
Subject: [PATCH v2 0/7] KVM: Turn the vcpu array into an xarray
Date: Tue, 16 Nov 2021 16:03:56 +0000 [thread overview]
Message-ID: <20211116160403.4074052-1-maz@kernel.org> (raw)
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(-)
--
2.30.2
next reply other threads:[~2021-11-16 16:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 16:03 Marc Zyngier [this message]
2021-11-16 16:03 ` [PATCH v2 1/7] KVM: Move wiping of the kvm->vcpus array to common code Marc Zyngier
2021-11-16 16:03 ` [PATCH v2 2/7] KVM: mips: Use kvm_get_vcpu() instead of open-coded access Marc Zyngier
2021-11-16 16:03 ` [PATCH v2 3/7] KVM: s390: " Marc Zyngier
2021-11-16 16:04 ` [PATCH v2 4/7] KVM: x86: " Marc Zyngier
2021-11-16 16:04 ` [PATCH v2 5/7] KVM: Convert the kvm->vcpus array to a xarray Marc Zyngier
2021-11-16 16:04 ` [PATCH v2 6/7] KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index Marc Zyngier
2021-11-16 16:04 ` [PATCH v2 7/7] KVM: Convert kvm_for_each_vcpu() to using xa_for_each_range() Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211116160403.4074052-1-maz@kernel.org \
--to=maz@kernel.org \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=alexandru.elisei@arm.com \
--cc=anup.patel@wdc.com \
--cc=borntraeger@de.ibm.com \
--cc=chenhuacai@kernel.org \
--cc=david@redhat.com \
--cc=f4bug@amsat.org \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=james.morse@arm.com \
--cc=jgross@suse.com \
--cc=kernel-team@android.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).