From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966474AbcHBNtb (ORCPT ); Tue, 2 Aug 2016 09:49:31 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36499 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966601AbcHBNql convert rfc822-to-8bit (ORCPT ); Tue, 2 Aug 2016 09:46:41 -0400 MIME-Version: 1.0 In-Reply-To: <20160712200930.32143-5-rkrcmar@redhat.com> References: <20160712200930.32143-1-rkrcmar@redhat.com> <20160712200930.32143-5-rkrcmar@redhat.com> From: Wanpeng Li Date: Tue, 2 Aug 2016 19:39:43 +0800 Message-ID: Subject: Re: [PATCH v3 04/14] KVM: x86: dynamic kvm_apic_map To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: "linux-kernel@vger.kernel.org" , kvm , Paolo Bonzini , "Lan, Tianyu" , Igor Mammedov , Jan Kiszka , Peter Xu , Yang Zhang Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > index 9880d03f533d..224fc1c5fcc6 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -120,7 +120,7 @@ static inline bool kvm_apic_map_get_logical_dest(struct kvm_apic_map *map, > switch (map->mode) { > case KVM_APIC_MODE_X2APIC: { > u32 offset = (dest_id >> 16) * 16; > - u32 max_apic_id = ARRAY_SIZE(map->phys_map) - 1; > + u32 max_apic_id = map->max_apic_id; > > if (offset <= max_apic_id) { > u8 cluster_size = min(max_apic_id - offset + 1, 16U); > @@ -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. Regards, Wanpeng Li