From patchwork Wed Aug 28 14:33:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 270605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 639D22C0097 for ; Thu, 29 Aug 2013 03:05:37 +1000 (EST) Received: from localhost ([::1]:35187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEgvl-0000Is-0t for incoming@patchwork.ozlabs.org; Wed, 28 Aug 2013 10:41:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEgop-00023I-Hb for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:34:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEgoj-0005iF-AW for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:33:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEgoi-0005hm-VV for qemu-devel@nongnu.org; Wed, 28 Aug 2013 10:33:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7SEXnto007635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Aug 2013 10:33:50 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-4-97.tlv.redhat.com [10.35.4.97]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7SEXnW1019703; Wed, 28 Aug 2013 10:33:49 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 699F818D3A3; Wed, 28 Aug 2013 17:33:48 +0300 (IDT) From: Gleb Natapov To: Anthony Liguori Date: Wed, 28 Aug 2013 17:33:35 +0300 Message-Id: <7dc52526850849e8e0fe56ced809d0798481a2f6.1377699174.git.gleb@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 07/10] kvm-all.c: max_cpus should not exceed KVM vcpu limit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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