Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756982AbdDROaZ (ORCPT ); Tue, 18 Apr 2017 10:30:25 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34155 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754063AbdDROaU (ORCPT ); Tue, 18 Apr 2017 10:30:20 -0400 Subject: Re: [PATCH 3/4] KVM: add KVM_CREATE_VM2 system ioctl To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20170413201951.11939-1-rkrcmar@redhat.com> <20170413201951.11939-4-rkrcmar@redhat.com> <28b31907-80d8-3d5f-a3a3-0131621fa4c2@redhat.com> Cc: Christoffer Dall , Marc Zyngier , Christian Borntraeger , Cornelia Huck , James Hogan , Paul Mackerras , Alexander Graf From: Paolo Bonzini Message-ID: Date: Tue, 18 Apr 2017 16:30:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <28b31907-80d8-3d5f-a3a3-0131621fa4c2@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 965 Lines: 23 On 18/04/2017 16:16, Paolo Bonzini wrote: >> This patch allows userspace to tell how many VCPUs it is going to use, >> which can save memory when allocating the kvm->vcpus array. This will >> be done with a new KVM_CREATE_VM2 IOCTL. >> >> An alternative would be to redo kvm->vcpus as a list or protect the >> array with RCU. RCU is slower and a list is not even practical as >> kvm->vcpus are being used for index-based accesses. >> >> We could have an IOCTL that is called in between KVM_CREATE_VM and first >> KVM_CREATE_VCPU and sets the size of the vcpus array, but we'd be making >> one useless allocation. Knowing the desired number of VCPUs from the >> beginning is seems best for now. >> >> This patch also prepares generic code for architectures that will set >> KVM_CONFIGURABLE_MAX_VCPUS to a non-zero value. > Why is KVM_MAX_VCPU_ID or KVM_MAX_VCPUS not enough? Ok, for KVM_MAX_VCPUS I should have read the cover letter more carefully. :) Paolo