From: Tim Deegan Subject: Re: [PATCH v2 2/2] x86/HVM: fix ID handling of x2APIC emulation Date: Thu, 18 Sep 2014 16:07:02 +0200 Message-ID: <20140918140702.GC81607@deinos.phlegethon.org> References: <541070390200007800033519@mail.emea.novell.com> <541071DF0200007800033534@mail.emea.novell.com> <5411CDBA.2090401@citrix.com> <5412C3740200007800034564@mail.emea.novell.com> <20140918105329.GA64996@deinos.phlegethon.org> <541AEA1502000078000362D7@mail.emea.novell.com> <20140918125928.GA81607@deinos.phlegethon.org> <541AF8D20200007800036350@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XUcMj-0006hq-6d for xen-devel@lists.xenproject.org; Thu, 18 Sep 2014 14:07:21 +0000 Content-Disposition: inline In-Reply-To: <541AF8D20200007800036350@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Ian Campbell , Andrew Cooper , Keir Fraser , IanJackson , xen-devel List-Id: xen-devel@lists.xenproject.org At 14:22 +0100 on 18 Sep (1411046578), Jan Beulich wrote: > > It would, I think, be reasonable to abandon the fix altogether and > > just let upgraded VMs continue with their bogus state -- after all it > > can't be that much of a problem for them or they'd have failed on the > > old box. > > No, we can't drop it, because it doesn't fix only LDR. It also changes > the ID representation (since in particular the GET_xAPIC_ID() use > gets dropped from hvm_x2apic_msr_read()'s APIC_ID case), and this > one must be transparent to the guest. Ah, right. > >> Nor do I think we should (implicitly) disallow restoring the same > >> state more than once before resuming the guest (or vCPU). > > > > True, but that's true whether we do the fix at unpause or beforehand. > > No, it's not: If the first load resulted in x2APIC mode and the > second one not, we'd have done an adjustment already which we > would better not have done. What I mean is: we also ought to handle multiple restores even with unpauses between them (like COLO, though IIRC that won't actually unpause), or else explicitly disallow them. > But I think I can see another alternative: Latch the most recently > loaded or live ID and LDR values into struct vlapic and restore > them into register state when hidden state got updated, applying > the fix immediately afterwards. Any write to those two registers > (or perhaps just any live register access) would then clear the > "loaded" state. Yes, I think that makes sense. Tim.