kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Increase KVM_MAX_VCPUS to 4096
@ 2023-08-15 15:35 Kyle Meyer
  2023-08-15 17:11 ` Sean Christopherson
  0 siblings, 1 reply; 6+ messages in thread
From: Kyle Meyer @ 2023-08-15 15:35 UTC (permalink / raw)
  To: seanjc, pbonzini, tglx, mingo, bp, dave.hasen, x86, hpa, kvm,
	linux-kernel, vkuznets, dmatlack
  Cc: russ.anderson, dimitri.sivanich, steve.wahl, Kyle Meyer

Increase KVM_MAX_VCPUS to 4096 when MAXSMP is enabled.

Notable changes (when MAXSMP is enabled):

* KMV_MAX_VCPUS will increase from 1024 to 4096.
* KVM_MAX_VCPU_IDS will increase from 4096 to 16384.
* KVM_HV_MAX_SPARSE_VCPU_SET_BITS will increase from 16 to 64.
* CPUID[HYPERV_CPUID_IMPLEMENT_LIMITS (0x40000005)].EAX will now be 4096.

* struct kvm will increase from 39408 B to 39792 B.
* struct kvm_ioapic will increase from 5240 B to 19064 B.

* The following (on-stack) bitmaps will increase from 128 B to 512 B:
	* dest_vcpu_bitmap in kvm_irq_delivery_to_apic.
	* vcpu_mask in kvm_hv_flush_tlb.
	* vcpu_bitmap in ioapic_write_indirect.
	* vp_bitmap in sparse_set_to_vcpu_mask.

Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
Virtual machines with 4096 virtual CPUs have been created on 32 socket
Cascade Lake and Sapphire Rapids systems.

4096 is the current maximum value because of the Hyper-V TLFS. See
BUILD_BUG_ON in arch/x86/kvm/hyperv.c, commit 79661c3, and Vitaly's
comment on https://lore.kernel.org/all/87r136shcc.fsf@redhat.com.

 arch/x86/include/asm/kvm_host.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3bc146dfd38d..91a01fa17fa7 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -39,7 +39,11 @@
 
 #define __KVM_HAVE_ARCH_VCPU_DEBUGFS
 
+#ifdef CONFIG_MAXSMP
+#define KVM_MAX_VCPUS 4096
+#else
 #define KVM_MAX_VCPUS 1024
+#endif
 
 /*
  * In x86, the VCPU ID corresponds to the APIC ID, and APIC IDs
-- 
2.35.3


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

end of thread, other threads:[~2023-09-08 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15 15:35 [PATCH] KVM: x86: Increase KVM_MAX_VCPUS to 4096 Kyle Meyer
2023-08-15 17:11 ` Sean Christopherson
2023-08-17 20:23   ` Meyer, Kyle
2023-08-17 23:44     ` Sean Christopherson
2023-09-06 15:54   ` Vitaly Kuznetsov
2023-09-08 17:44     ` 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).