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
Also, keep max_cpus at 288 for machine version 8.0 and older.
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
hw/i386/pc_q35.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 371cca7484..63866a16e0 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -360,12 +360,12 @@ 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->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);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
- m->max_cpus = 288;
}
static void pc_q35_8_1_machine_options(MachineClass *m)
@@ -388,6 +388,7 @@ static void pc_q35_8_0_machine_options(MachineClass *m)
/* For pc-q35-8.0 and older, use SMBIOS 2.8 by default */
pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32;
+ m->max_cpus = 288;
}
DEFINE_Q35_MACHINE(v8_0, "pc-q35-8.0", NULL,
--
2.34.1
On Tue, 6 Jun 2023 21:49:39 -0500 Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> wrote: > 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 > > Also, keep max_cpus at 288 for machine version 8.0 and older. > > Cc: Igor Mammedov <imammedo@redhat.com> > Cc: Daniel P. Berrangé <berrange@redhat.com> > Cc: Michael S. Tsirkin <mst@redhat.com> > Cc: Julia Suvorova <jusual@redhat.com> > Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> > --- > hw/i386/pc_q35.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index 371cca7484..63866a16e0 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -360,12 +360,12 @@ 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->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); > machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); > machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); > - m->max_cpus = 288; > } > > static void pc_q35_8_1_machine_options(MachineClass *m) > @@ -388,6 +388,7 @@ static void pc_q35_8_0_machine_options(MachineClass *m) > > /* For pc-q35-8.0 and older, use SMBIOS 2.8 by default */ > pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32; > + m->max_cpus = 288; > } > > DEFINE_Q35_MACHINE(v8_0, "pc-q35-8.0", NULL,
On 7/6/23 04:49, Suravee Suthikulpanit wrote:
> 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
Odd, we already check the upper limit with KVM_CAP_NR_VCPUS.
See in kvm_init():
/* check the vcpu limits */
soft_vcpus_limit = kvm_recommended_vcpus(s);
hard_vcpus_limit = kvm_max_vcpus(s);
When testing your series I get:
qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested
(1024) exceeds the recommended cpus supported by KVM (710)
$ uname -srvp
Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64
> Also, keep max_cpus at 288 for machine version 8.0 and older.
>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Daniel P. Berrangé <berrange@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Julia Suvorova <jusual@redhat.com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> hw/i386/pc_q35.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
On Wed, 7 Jun 2023 10:26:59 +0200 Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > On 7/6/23 04:49, Suravee Suthikulpanit wrote: > > 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 > > Odd, we already check the upper limit with KVM_CAP_NR_VCPUS. > See in kvm_init(): > > /* check the vcpu limits */ > soft_vcpus_limit = kvm_recommended_vcpus(s); > hard_vcpus_limit = kvm_max_vcpus(s); > > When testing your series I get: > > qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested > (1024) exceeds the recommended cpus supported by KVM (710) Also do not forget about TCG where KVM accel is not even in the picture. > $ uname -srvp > Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64 > > > Also, keep max_cpus at 288 for machine version 8.0 and older. > > > > Cc: Igor Mammedov <imammedo@redhat.com> > > Cc: Daniel P. Berrangé <berrange@redhat.com> > > Cc: Michael S. Tsirkin <mst@redhat.com> > > Cc: Julia Suvorova <jusual@redhat.com> > > Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> > > --- > > hw/i386/pc_q35.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) >
On Wed, Jun 07, 2023 at 10:26:59AM +0200, Philippe Mathieu-Daudé wrote: > On 7/6/23 04:49, Suravee Suthikulpanit wrote: > > 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 > > Odd, we already check the upper limit with KVM_CAP_NR_VCPUS. > See in kvm_init(): > > /* check the vcpu limits */ > soft_vcpus_limit = kvm_recommended_vcpus(s); > hard_vcpus_limit = kvm_max_vcpus(s); > > When testing your series I get: > > qemu-system-x86_64: -accel kvm: warning: Number of SMP cpus requested (1024) > exceeds the recommended cpus supported by KVM (710) > > $ uname -srvp > Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64 That's a relatively old kernel. With latest kernels, the 'recommended cpus' limit reported will match the number of CPUs in your host, so for me it always complains for smp > 12. With regards, Daniel -- |: 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 :|
© 2016 - 2026 Red Hat, Inc.