From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [uq/master patch 2/2] kvm-all.c: max_cpus should not exceed KVM vcpu limit Date: Mon, 12 Aug 2013 16:56:31 -0300 Message-ID: <20130812195730.363325196@redhat.com> References: <20130812195629.350634011@redhat.com> Cc: pbonzini@redhat.com, gleb@redhat.com, Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43205 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753593Ab3HLT7e (ORCPT ); Mon, 12 Aug 2013 15:59:34 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7CJxXaS007564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 12 Aug 2013 15:59:34 -0400 Content-Disposition: inline; filename=kvm-all-check-max-cpus Sender: kvm-owner@vger.kernel.org List-ID: maxcpus, which specifies the maximum number of hotpluggable CPUs, should not exceed KVM's vcpu limit. Signed-off-by: Marcelo Tosatti Index: qemu/kvm-all.c =================================================================== --- qemu.orig/kvm-all.c +++ qemu/kvm-all.c @@ -1391,6 +1391,13 @@ int kvm_init(void) goto err; } + if (max_cpus > max_vcpus) { + ret = -EINVAL; + fprintf(stderr, "Number of max_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