From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 07/28] kvm tools: Move 'kvm__recommended_cpus' to arch-specific code Date: Wed, 07 Dec 2011 08:34:55 +0200 Message-ID: <1323239695.8489.25.camel@lappy> References: <4EDD8E73.8040505@ozlabs.org> <1323159616.3882.7.camel@lappy> <4EDF04F4.40805@ozlabs.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org To: Matt Evans Return-path: In-Reply-To: <4EDF04F4.40805@ozlabs.org> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, 2011-12-07 at 17:17 +1100, Matt Evans wrote: > On 06/12/11 19:20, Sasha Levin wrote: > > Why is it getting moved out of generic code? > > > > This is used to determine the maximum amount of vcpus supported by the > > host for a single guest, and as far as I know KVM_CAP_NR_VCPUS and > > KVM_CAP_MAX_VCPUS are not arch specific. > > I checked api.txt and you're right, it isn't arch-specific. I assumed it was, > because PPC KVM doesn't support it ;-) I've dropped this patch and in its place > implemented the api.txt suggestion of "if KVM_CAP_NR_VCPUS fails, use 4" instead > of die(); you'll see that when I repost. > > This will have the effect of PPC being limited to 4 CPUs until the kernel > supports that CAP. (I'll see about this part too.) I went to look at which limitation PPC places on amount of vcpus in guest, and saw this in kvmppc_core_vcpu_create() in the book3s code: vcpu = kvmppc_core_vcpu_create(kvm, id); vcpu->arch.wqp = &vcpu->wq; if (!IS_ERR(vcpu)) kvmppc_create_vcpu_debugfs(vcpu, id); This is wrong, right? The VCPU is dereferenced before actually checking that it's not an error. -- Sasha.