From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCnIo-0005Nk-0P for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:05:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCnIf-0007Nz-KX for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:05:05 -0400 Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]:41770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCnIf-0007Nt-EL for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:04:57 -0400 Received: by mail-ee0-f53.google.com with SMTP id b15so166296eek.40 for ; Fri, 23 Aug 2013 02:04:56 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 23 Aug 2013 11:03:33 +0200 Message-Id: <1377248615-23039-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1377248615-23039-1-git-send-email-pbonzini@redhat.com> References: <1377248615-23039-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 7/9] kvm-all.c: max_cpus should not exceed KVM vcpu limit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti , anthony@codemonkey.ws, gleb@redhat.com From: Marcelo Tosatti 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 --- kvm-all.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index ef52a0f..a2d4978 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 -- 1.8.3.1