From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751384AbcEIQXw (ORCPT ); Mon, 9 May 2016 12:23:52 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:54596 "EHLO e06smtp11.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961AbcEIQXu (ORCPT ); Mon, 9 May 2016 12:23:50 -0400 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: cornelia.huck@de.ibm.com X-IBM-RcptTo: kvm@vger.kernel.org;linux-kernel@vger.kernel.org Date: Mon, 9 May 2016 18:23:39 +0200 From: Cornelia Huck To: Greg Kurz Cc: Paolo Bonzini , james.hogan@imgtec.com, mingo@redhat.com, linux-mips@linux-mips.org, kvm@vger.kernel.org, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, David Hildenbrand , qemu-ppc@nongnu.org, Paul Mackerras , David Gibson Subject: Re: [PATCH v6 2/2] kvm: introduce KVM_MAX_VCPU_ID Message-ID: <20160509182339.04fe7ef2.cornelia.huck@de.ibm.com> In-Reply-To: <146281032358.17210.17266631315196879115.stgit@bahia.huguette.org> References: <146281031018.17210.8148336192033754193.stgit@bahia.huguette.org> <146281032358.17210.17266631315196879115.stgit@bahia.huguette.org> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16050916-0041-0000-0000-00001A81128B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 09 May 2016 18:13:37 +0200 Greg Kurz wrote: > The KVM_MAX_VCPUS define provides the maximum number of vCPUs per guest, and > also the upper limit for vCPU ids. This is okay for all archs except PowerPC > which can have higher ids, depending on the cpu/core/thread topology. In the > worst case (single threaded guest, host with 8 threads per core), it limits > the maximum number of vCPUS to KVM_MAX_VCPUS / 8. > > This patch separates the vCPU numbering from the total number of vCPUs, with > the introduction of KVM_MAX_VCPU_ID, as the maximal valid value for vCPU ids > plus one. > > The corresponding KVM_CAP_MAX_VCPU_ID allows userspace to validate vCPU ids > before passing them to KVM_CREATE_VCPU. > > This patch only implements KVM_MAX_VCPU_ID with a specific value for PowerPC. > Other archs continue to return KVM_MAX_VCPUS instead. > > Suggested-by: Radim Krcmar > Signed-off-by: Greg Kurz > --- > v6: - provide cap in generic code (Cornelia) > - change PowerPC limit to threads_per_subcore * KVM_MAX_VCORES (Radim) > --- > Documentation/virtual/kvm/api.txt | 10 ++++++++-- > arch/powerpc/include/asm/kvm_host.h | 3 +++ > include/linux/kvm_host.h | 4 ++++ > include/uapi/linux/kvm.h | 1 + > virt/kvm/kvm_main.c | 4 +++- > 5 files changed, 19 insertions(+), 3 deletions(-) Reviewed-by: Cornelia Huck