From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbcGAPGe (ORCPT ); Fri, 1 Jul 2016 11:06:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41950 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbcGAPGd (ORCPT ); Fri, 1 Jul 2016 11:06:33 -0400 Subject: Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <20160630205429.16480-1-rkrcmar@redhat.com> <20160630205429.16480-4-rkrcmar@redhat.com> <20160701124421.GA2301@potion> <20160701143827.GE27840@potion> Cc: Andrew Honig , linux-kernel@vger.kernel.org, kvm , "Lan, Tianyu" , Igor Mammedov , Jan Kiszka , Peter Xu From: Paolo Bonzini Message-ID: Date: Fri, 1 Jul 2016 17:06:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160701143827.GE27840@potion> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 01 Jul 2016 15:06:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/07/2016 16:38, Radim Krčmář wrote: >> > Should it? > Yes, x2APIC ID cannot be changed in hardware and is initialized to the > intitial APIC ID. > Letting LAPIC_SET change x2APIC ID would allow scenarios where userspace > reuses old VMs instead of building new ones after reconfiguration. > I don't think it's a sensible use case and it it is currently broken, > because we don't exit to userspace when changing APIC mode, so KVM would > just set APIC ID to VCPU ID on any transition and userspace couldn't > amend it. > >> > According to QEMU if you have e.g. 3 cores per socket one >> > socket take 4 APIC IDs. For Knights Landing the "worst" prime factor in >> > 288 is 3^2 so you need APIC IDs up to 288 * (4/3)^2 = 512. > The topology can result in sparse APIC ID and APIC ID is initialized > from VCPU ID, so userspace has to pick VCPU ID accordingly. Right, I was confusing KVM_MAX_VCPUS and KVM_MAX_VCPU_ID. So the overflow case cannot happen and neither can the 32GB allocation. On the other hand, I suspect you need to bump KVM_MAX_VCPU_ID beyond its current default setting (which is equal to KVM_MAX_VCPUS), up to 511 or 1023. Thanks, Paolo