From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD4s1-0007I3-3v for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:50:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VD4rs-0002X7-GJ for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:50:37 -0400 Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]:41208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD4rs-0002Wx-9t for qemu-devel@nongnu.org; Fri, 23 Aug 2013 23:50:28 -0400 Received: by mail-ea0-f172.google.com with SMTP id r16so606713ead.17 for ; Fri, 23 Aug 2013 20:50:27 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sat, 24 Aug 2013 05:50:00 +0200 Message-Id: <1377316202-2849-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1377316202-2849-1-git-send-email-pbonzini@redhat.com> References: <1377316202-2849-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