From: Marcelo Tosatti Date: Mon, 12 Aug 2013 19:56:31 +0000 (-0300) Subject: kvm-all.c: max_cpus should not exceed KVM vcpu limit X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7dc52526850849e8e0fe56ced809d0798481a2f6;p=qemu.git kvm-all.c: max_cpus should not exceed KVM vcpu limit maxcpus, which specifies the maximum number of hotpluggable CPUs, should not exceed KVM's vcpu limit. Signed-off-by: Marcelo Tosatti [Reword message. - Paolo] Signed-off-by: Paolo Bonzini --- diff --git a/kvm-all.c b/kvm-all.c index ef52a0f966..a2d4978636 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1400,6 +1400,13 @@ int kvm_init(void) goto err; } + if (max_cpus > max_vcpus) { + ret = -EINVAL; + fprintf(stderr, "Number of hotpluggable cpus requested (%d) exceeds max cpus " + "supported by KVM (%d)\n", max_cpus, max_vcpus); + goto err; + } + s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0); if (s->vmfd < 0) { #ifdef TARGET_S390X