Skip to contentSkip to conversation

pc: q35: Bump max_cpus to 1024

PATCH In review Suravee Suthikulpanit 5 participants 7 messages May 31, 2023 – Jun 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pc: q35: Bump max_cpus to 1024

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

Thank you,
Suravee

 hw/i386/pc_q35.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_q35.c +1 -1
index f02919d92c..e7dc226bd5 100644
@@ -370,7 +370,7 @@ static void pc_q35_machine_options(MachineClass *m)
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
-    m->max_cpus = 288;
+    m->max_cpus = 1024;
 }
 
 static void pc_q35_8_1_machine_options(MachineClass *m)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 15 lines · Suravee Suthikulpanit

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Quoted 7 lines

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

I suspect smbios 3.0 (64-bit entry point) is already supported.

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

Quoted 19 lines

Thank you,
Suravee

 hw/i386/pc_q35.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc_q35.c +1 -1
index f02919d92c..e7dc226bd5 100644
@@ -370,7 +370,7 @@ static void pc_q35_machine_options(MachineClass *m)
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
-    m->max_cpus = 288;
+    m->max_cpus = 1024;
 }
 
 static void pc_q35_8_1_machine_options(MachineClass *m)
#2 lore raw
Quoted 25 lines · Joao Martins
Quoted 15 lines · Suravee Suthikulpanit

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Quoted 7 lines

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

Quoted 5 lines

I suspect smbios 3.0 (64-bit entry point) is already supported.

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

The need for the 64-bit entry point depends on a combination of RAM config and CPU count. IMHO we need to unconditionally switch the latest machine types to use the 64-bit entry point by default, rather than trying to infer some special condition to dynamically change on the fly.

Before doing that we need confirmation that our firmware builds in qemu.git (SeaBIOS and EDK2) will be happy with the 64-bit EP. I suspect they should be fine by now, but I've CC'd Gerd to confirm.

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

Hi,

Quoted 6 lines
Quoted 5 lines

I suspect smbios 3.0 (64-bit entry point) is already supported.

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

Quoted 8 lines

The need for the 64-bit entry point depends on a combination of RAM config and CPU count. IMHO we need to unconditionally switch the latest machine types to use the 64-bit entry point by default, rather than trying to infer some special condition to dynamically change on the fly.

Before doing that we need confirmation that our firmware builds in qemu.git (SeaBIOS and EDK2) will be happy with the 64-bit EP. I suspect they should be fine by now, but I've CC'd Gerd to confirm.

edk2 is ready for quite a while (years).

seabios was lagging behind for a long time, but smbios 3.0 support finally landed early last year, in release 1.16.0 (qemu 7.0).

So, yes, firmware-wise we are ready to flip the default now.

take care,
Gerd

#4 lore raw
In reply to Daniel P. Berrangé
Quoted 28 lines · Daniel P. Berrangé
Quoted 27 lines · Joao Martins
Quoted 15 lines · Suravee Suthikulpanit

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Quoted 7 lines

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

I suspect smbios 3.0 (64-bit entry point) is already supported.

Quoted 8 lines
Quoted 3 lines

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

The need for the 64-bit entry point depends on a combination of RAM config and CPU count. IMHO we need to unconditionally switch the latest machine types to use the 64-bit entry point by default, rather than trying to infer some special condition to dynamically change on the fly.

Yes, makes sense.

Quoted 6 lines

Before doing that we need confirmation that our firmware builds in qemu.git (SeaBIOS and EDK2) will be happy with the 64-bit EP. I suspect they should be fine by now, but I've CC'd Gerd to confirm.

With regards,
Daniel

#5 lore raw
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Daniel P. Berrangé
Quoted 24 lines · Joao Martins
Quoted 22 lines · Suravee Suthikulpanit

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I suspect smbios 3.0 (64-bit entry point) is already supported.

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

Quoted 1 line

The need for the 64-bit entry point depends on a combination of RAM

config

Quoted 4 lines
Quoted 3 lines

and CPU count. IMHO we need to unconditionally switch the latest machine types to use the 64-bit entry point by default, rather than trying to infer some special condition to dynamically change on the fly.

Yes, makes sense.

Thanks all for the feedback. So, IIUC, here is how the SMBIOS entry point types would be affected by the QEMU options:

- pc-q35-8.1 and later, default to SMBIOS EP type 64.
- pc-q35-8.0 and older, default to SMBIOS EP type 32.
- User can override the type w/ QEMU option "-M .., smbios-entry-point-type=[32|64]"

Please let me know if I am missing anything. If this is accurate, I'll send out v3 with this change.

Thanks,
Suravee

#6 lore raw
Quoted 45 lines · Suravee
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Daniel P. Berrangé
Quoted 24 lines · Joao Martins
Quoted 22 lines · Suravee Suthikulpanit

Since KVM_MAX_VCPUS is currently defined to 1024 for x86 as shown in arch/x86/include/asm/kvm_host.h, update QEMU limits to the same number.

In case KVM could not support the specified number of vcpus, QEMU would return the following error message:

qemu-system-x86_64: kvm_init_vcpu: kvm_get_vcpu failed (xxx): Invalid argument

---

Changes from V1:
(https://lore.kernel.org/all/[email protected]/T/)
* Bump from 512 to KVM_MAX_VCPUS (per Igor's suggestion)

Note:
From the last discussion, Daniel mentioned that SMBIO 2.1 tables might cause overflow at approx 720 CPUs, and it might require using the SMBIO 3.0 entry point. Also, we might need to change the default for the x86 machine type to SMBIO 3.0. However, I do not know the status of this.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

I suspect smbios 3.0 (64-bit entry point) is already supported.

With current qemu and all the smbios fixes in the last cycle, perhaps this is mainly just setting smbios_entry_point_type to SMBIOS_ENTRY_POINT_TYPE_64 if MachineState::smp::max_cpus is bigger than 720 (e.g. in pc_q35_init()?)

Quoted 1 line

The need for the 64-bit entry point depends on a combination of

RAM

config

Quoted 4 lines
Quoted 3 lines

and CPU count. IMHO we need to unconditionally switch the latest machine types to use the 64-bit entry point by default, rather than trying to infer some special condition to dynamically change on the fly.

Yes, makes sense.

Thanks all for the feedback. So, IIUC, here is how the SMBIOS entry point types would be affected by the QEMU options:

Quoted 7 lines

- pc-q35-8.1 and later, default to SMBIOS EP type 64.
- pc-q35-8.0 and older, default to SMBIOS EP type 32.
- User can override the type w/ QEMU option "-M .., smbios-entry-point-type=[32|64]"

Please let me know if I am missing anything. If this is accurate, I'll send out v3 with this change.

Yes, and for pc-i440fx* too

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 :|