Skip to contentSkip to conversation

pc: q35: Bump max_cpus to 1728 vcpus

PATCH Superseded Ani Sinha 4 participants 6 messages Jan 30, 2024

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Ani Sinha

author
#0 lore raw

PATCH 1/1 pc: q35: Bump max_cpus to 1728 vcpus

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

If KVM is not able to support the specified number of vcpus, QEMU would return the following error messages:

$ ./qemu-system-x86_64 -cpu host -accel kvm -machine q35 -smp 1728
qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
qemu-system-x86_64: -accel kvm: warning: Number of hotpluggable cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
Number of SMP cpus requested (1728) exceeds the maximum cpus supported by KVM (1024)
Cc Daniel P. Berrangé <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Julia Suvorova <[email protected]>
---
 hw/i386/pc_q35.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/pc_q35.c +2 -1
index f43d5142b8..bfa627a70b 100644
@@ -375,7 +375,7 @@ static void pc_q35_machine_options(MachineClass *m)
     m->default_nic = "e1000e";
     m->default_kernel_irqchip_split = false;
     m->no_floppy = 1;
-    m->max_cpus = 1024;
+    m->max_cpus = 1728;
     m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
@@ -396,6 +396,7 @@ static void pc_q35_8_2_machine_options(MachineClass *m)
 {
     pc_q35_9_0_machine_options(m);
     m->alias = NULL;
+    m->max_cpus = 1024;
     compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
     compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
 }
Signature · 1 line
2.42.0
#1 lore raw
Quoted 7 lines · Ani Sinha

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

Where does the 1728 number come from ?

Did something break at 1729, or did the test machine simply not have sufficient resources to do practical larger tests ?

Quoted 42 lines

If KVM is not able to support the specified number of vcpus, QEMU would return the following error messages:

$ ./qemu-system-x86_64 -cpu host -accel kvm -machine q35 -smp 1728
qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
qemu-system-x86_64: -accel kvm: warning: Number of hotpluggable cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
Number of SMP cpus requested (1728) exceeds the maximum cpus supported by KVM (1024)
Cc Daniel P. Berrangé <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Julia Suvorova <[email protected]>
---
 hw/i386/pc_q35.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/pc_q35.c +2 -1
index f43d5142b8..bfa627a70b 100644
@@ -375,7 +375,7 @@ static void pc_q35_machine_options(MachineClass *m)
     m->default_nic = "e1000e";
     m->default_kernel_irqchip_split = false;
     m->no_floppy = 1;
-    m->max_cpus = 1024;
+    m->max_cpus = 1728;
     m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
@@ -396,6 +396,7 @@ static void pc_q35_8_2_machine_options(MachineClass *m)
 {
     pc_q35_9_0_machine_options(m);
     m->alias = NULL;
+    m->max_cpus = 1024;
     compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
     compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
 }
Signature · 1 line
2.42.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author
#2 lore raw
Quoted 13 lines · Daniel P. Berrangé
Quoted 7 lines · Ani Sinha

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

Quoted 4 lines

Where does the 1728 number come from ?

Did something break at 1729, or did the test machine simply not have sufficient resources to do practical larger tests ?

Actual limit currently is 1856 for EDK2. The HPE folks tested QEMU with edk2 and QEMU fails to boot beyond that limit. There are RH internal bugs tracking this and Gerd is working on it from RH side [1].

We would ultimately like to go to 8192 vcpus for SAP HANA but 1728 vcpus is our immediate target for now. If you want, I can resend the patch with 1856 since that is currently the tested limit.

1. https://issues.redhat.com/browse/RHEL-22202

Quoted 50 lines
Quoted 43 lines

If KVM is not able to support the specified number of vcpus, QEMU would return the following error messages:

$ ./qemu-system-x86_64 -cpu host -accel kvm -machine q35 -smp 1728
qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
qemu-system-x86_64: -accel kvm: warning: Number of hotpluggable cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
Number of SMP cpus requested (1728) exceeds the maximum cpus supported by KVM (1024)
Cc Daniel P. Berrangé <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Julia Suvorova <[email protected]>

---
hw/i386/pc_q35.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/pc_q35.c +2 -1
index f43d5142b8..bfa627a70b 100644
@@ -375,7 +375,7 @@ static void pc_q35_machine_options(MachineClass *m)
    m->default_nic = "e1000e";
    m->default_kernel_irqchip_split = false;
    m->no_floppy = 1;
-    m->max_cpus = 1024;
+    m->max_cpus = 1728;
    m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
    machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
    machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
@@ -396,6 +396,7 @@ static void pc_q35_8_2_machine_options(MachineClass *m)
 {
    pc_q35_9_0_machine_options(m);
    m->alias = NULL;
+    m->max_cpus = 1024;
    compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
    compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
 }
Signature · 1 line
2.42.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
Quoted 15 lines · Ani Sinha
Quoted 15 lines · Daniel P. Berrangé
Quoted 7 lines · Ani Sinha

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

Where does the 1728 number come from ?

Quoted 7 lines
Quoted 2 lines

Did something break at 1729, or did the test machine simply not have sufficient resources to do practical larger tests ?

Actual limit currently is 1856 for EDK2. The HPE folks tested QEMU with edk2 and QEMU fails to boot beyond that limit. There are RH internal bugs tracking this and Gerd is working on it from RH side [1].

We would ultimately like to go to 8192 vcpus for SAP HANA but 1728 vcpus is our immediate target for now. If you want, I can resend the patch with 1856 since that is currently the tested limit.

Yes, could you resend with 1856, and include a description of the blocking problem in the commit message for the historical record, as this is the kind of thing that people will have forgotten when re-visiting the patch later and wondering why this limit was chosen.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
In reply to Ani Sinha
Quoted 18 lines · Ani Sinha
Quoted 13 lines · Daniel P. Berrangé
Quoted 7 lines · Ani Sinha

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

Quoted 4 lines

Where does the 1728 number come from ?

Did something break at 1729, or did the test machine simply not have sufficient resources to do practical larger tests ?

Quoted 6 lines

Actual limit currently is 1856 for EDK2. The HPE folks tested QEMU with edk2 and QEMU fails to boot beyond that limit. There are RH internal bugs tracking this and Gerd is working on it from RH side [1].

We would ultimately like to go to 8192 vcpus for SAP HANA but 1728 vcpus is our immediate target for now. If you want, I can resend the patch with 1856 since that is currently the tested limit.

1. https://issues.redhat.com/browse/RHEL-22202

Out of curiosity has the limit to be multiple of 64?

#5 lore raw
In reply to Ani Sinha
Quoted 18 lines · Ani Sinha
Quoted 13 lines · Daniel P. Berrangé
Quoted 7 lines · Ani Sinha

Since commit f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") Linux kernel can support upto a maximum number of 4096 vCPUS when MAXSMP is enabled in the kernel. QEMU has been tested to correctly boot a linux guest with 1728 vcpus both with edk2 and seabios firmwares. So bump up the max_cpus value for q35 machines versions 9 and newer to 1728. Q35 machines versions
8.2 and older continue to support 1024 maximum vcpus as before for compatibility.

Quoted 4 lines

Where does the 1728 number come from ?

Did something break at 1729, or did the test machine simply not have sufficient resources to do practical larger tests ?

Quoted 6 lines

Actual limit currently is 1856 for EDK2. The HPE folks tested QEMU with edk2 and QEMU fails to boot beyond that limit. There are RH internal bugs tracking this and Gerd is working on it from RH side [1].

We would ultimately like to go to 8192 vcpus for SAP HANA but 1728 vcpus is our immediate target for now. If you want, I can resend the patch with 1856 since that is currently the tested limit.

1. https://issues.redhat.com/browse/RHEL-22202

What is requested here is that you document the source of the number whatever it is in a code comment and commit log.

Quoted 52 lines
Quoted 51 lines
Quoted 44 lines

If KVM is not able to support the specified number of vcpus, QEMU would return the following error messages:

$ ./qemu-system-x86_64 -cpu host -accel kvm -machine q35 -smp 1728
qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
qemu-system-x86_64: -accel kvm: warning: Number of hotpluggable cpus requested (1728) exceeds the recommended cpus supported by KVM (12)
Number of SMP cpus requested (1728) exceeds the maximum cpus supported by KVM (1024)
Cc Daniel P. Berrangé <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Julia Suvorova <[email protected]>

---
hw/i386/pc_q35.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/pc_q35.c +2 -1
index f43d5142b8..bfa627a70b 100644
@@ -375,7 +375,7 @@ static void pc_q35_machine_options(MachineClass *m)
    m->default_nic = "e1000e";
    m->default_kernel_irqchip_split = false;
    m->no_floppy = 1;
-    m->max_cpus = 1024;
+    m->max_cpus = 1728;
    m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
    machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
    machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
@@ -396,6 +396,7 @@ static void pc_q35_8_2_machine_options(MachineClass *m)
 {
    pc_q35_9_0_machine_options(m);
    m->alias = NULL;
+    m->max_cpus = 1024;
    compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
    compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
 }
Signature · 1 line
2.42.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|