From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jes Sorensen Subject: Re: [patch] qemu-kvm introduce -maxcpus argument Date: Fri, 19 Jun 2009 16:23:09 +0200 Message-ID: <4A3B9F4D.3000907@gmail.com> References: <4A3B99DD.50306@gmail.com> <20090619141527.GA18392@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Gleb Natapov , "kvm@vger.kernel.org" To: "Daniel P. Berrange" Return-path: Received: from fg-out-1718.google.com ([72.14.220.155]:31282 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750928AbZFSOY1 (ORCPT ); Fri, 19 Jun 2009 10:24:27 -0400 Received: by fg-out-1718.google.com with SMTP id d23so97415fga.17 for ; Fri, 19 Jun 2009 07:24:28 -0700 (PDT) In-Reply-To: <20090619141527.GA18392@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/19/2009 04:15 PM, Daniel P. Berrange wrote: > On Fri, Jun 19, 2009 at 03:59:57PM +0200, Jes Sorensen wrote: >> Hi, >> >> This one introduces a -maxcpus setting, allowing the user to specify >> the maximum number of vCPUs the system can have, as discussed with Gleb >> earlier in the week. > > What is the maximum value for the 'maxcpus' setting for KVM ? Right now it is still 16, however I plan to change this. > libvirt currently does > > fd = open("/dev/kvm") > r = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS); > > to figure out what the maximum allowed vCPUs will be for KVM, > and currently it is returning 16 IIRC. Interesting, this will need to be addressed as well. I have plans to introduce a mechanism telling the kernel where the limit will be, in order to allow it to allocate data structures in a reasonable manner. >> @@ -5666,6 +5667,13 @@ int main(int argc, char **argv, char **e >> exit(1); >> } >> break; >> + case QEMU_OPTION_maxcpus: >> + max_cpus = atoi(optarg); >> + if ((max_cpus< 1) || (max_cpus> machine->max_cpus)) { >> + fprintf(stderr, "Invalid number of CPUs\n"); >> + exit(1); >> + } > This implies the limit (for x86 pc machine at least) is now 255. Is that > the correct interpretation on my part ? Actually the 255 limit is tied to ACPI. Once we support ACPI 3.0 and x2apic, it will get much worse. Be afraid, be very afraid :-) To be honest, that is going to be a while before we get to that, but I hope to get to it eventually. I strongly recommend you try not to impose static limits within libvirt for the number of vCPUs. I guess it will become a tricky issue who is telling who what the limit is. Ideally I would like to see the kernel limit becoming unlimited and the restrictions being set by userland. Cheers, Jes