From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934756AbcHBMWp (ORCPT ); Tue, 2 Aug 2016 08:22:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934713AbcHBMWX (ORCPT ); Tue, 2 Aug 2016 08:22:23 -0400 Date: Tue, 2 Aug 2016 14:22:07 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , kvm , Paolo Bonzini , "Lan, Tianyu" , Igor Mammedov , Jan Kiszka , Peter Xu , Yang Zhang Subject: Re: [PATCH v3 04/14] KVM: x86: dynamic kvm_apic_map Message-ID: <20160802122207.GC3758@potion> References: <20160712200930.32143-1-rkrcmar@redhat.com> <20160712200930.32143-5-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 02 Aug 2016 12:22:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-08-02 19:39+0800, Wanpeng Li: > 2016-07-13 4:09 GMT+08:00 Radim Krčmář : > [...] >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c >> @@ -152,14 +152,22 @@ static void recalculate_apic_map(struct kvm *kvm) >> struct kvm_apic_map *new, *old = NULL; >> struct kvm_vcpu *vcpu; >> int i; >> - >> - new = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL); >> + u32 max_id = 255; > > If this should be max_id = KVM_MAX_VCPU_ID? I have a patch on hand to > fix it, but I didn't know whether it is your desired behavior or not. No, we could just have static array then. KVM_MAX_VCPU_ID is expected to be raised to INT_MAX and eventually UINT_MAX, so it would not be practical. The dynamic array is there to avoid wasting space in the common case, where VMs have only low APIC IDs. Inintial patches had 255 to minimize a chance of regressions as the static array was that big, but starting with max_id = 0 is our goal and should be ok even without other changes.