From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbcGAPvz (ORCPT ); Fri, 1 Jul 2016 11:51:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38649 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcGAPvx (ORCPT ); Fri, 1 Jul 2016 11:51:53 -0400 Date: Fri, 1 Jul 2016 17:43:55 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: Andrew Honig , linux-kernel@vger.kernel.org, kvm , "Lan, Tianyu" , Igor Mammedov , Jan Kiszka , Peter Xu Subject: Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Message-ID: <20160701154354.GA5965@potion> References: <20160630205429.16480-1-rkrcmar@redhat.com> <20160630205429.16480-4-rkrcmar@redhat.com> <20160701124421.GA2301@potion> <20160701143827.GE27840@potion> <46f7b2e0-3225-8a9b-6155-3588b5f60f78@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46f7b2e0-3225-8a9b-6155-3588b5f60f78@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 01 Jul 2016 15:43:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-07-01 17:12+0200, Paolo Bonzini: > On 01/07/2016 17:06, Paolo Bonzini 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. > > Forgot to reply about this: letting SET_LAPIC change x2APIC IDs is nonsense. > > In x2APIC mode + new capability disabled SET_LAPIC should ignore the id > register altogether for backwards compatibility. I'd still shift SET_LAPIC APIC ID to have internal APIC ID register in hardware-compatible format. > In x2APIC mode + new capability enabled it should either ignore it, or > fail if the x2APIC ID doesn't match the VCPU id. I suspect the latter > is better because it would help catching the case where userspace is > erroneously shifting the id left to bits 31-24. Yes, I'll make it EINVAL.