From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD4xd-0007zH-14 for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VD4xT-0004JU-Ut for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:56:24 -0400 Received: from mail-ee0-x234.google.com ([2a00:1450:4013:c00::234]:52568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD4xT-0004JI-OM for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:56:15 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so609004eek.11 for ; Fri, 23 Aug 2013 20:56:15 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sat, 24 Aug 2013 05:55:45 +0200 Message-Id: <1377316547-2959-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1377316547-2959-1-git-send-email-pbonzini@redhat.com> References: <1377316547-2959-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