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 <imamm...@redhat.com>
Cc: Daniel P. Berrangé <berra...@redhat.com>
Cc: Michael S. Tsirkin <m...@redhat.com>
Cc: Julia Suvorova <jus...@redhat.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>
---
  hw/i386/pc_q35.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)


Reply via email to