From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Habkost Subject: Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure Date: Mon, 29 Jan 2018 23:08:32 -0200 Message-ID: <20180130010832.GA21702@localhost.localdomain> References: <7EB9643C-D2DD-477A-90DE-05DC653D2D4B@vmware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Arjan van de Ven , KarimAllah Ahmed , "Wilson, Matt" , "linux-kernel@vger.kernel.org" , Andi Kleen , Andrea Arcangeli , Andy Lutomirski , Ashok Raj , Asit Mallick , Borislav Petkov , Dan Williams , Dave Hansen , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Janakarajan Natarajan , Joerg Roedel , Jun Nakajima , Laura Abbott , Linus To To: David Dunn Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41568 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbeA3BIl (ORCPT ); Mon, 29 Jan 2018 20:08:41 -0500 Content-Disposition: inline In-Reply-To: <7EB9643C-D2DD-477A-90DE-05DC653D2D4B@vmware.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jan 29, 2018 at 10:29:28PM +0000, David Dunn wrote: > On Mon, 2018-01-29 at 13:45:07 -0800, Eduardo Habkost wrote: > > > Maybe a generic "family/model/stepping/microcode really matches > > the CPU you are running on" bit would be useful. The bit could > > be enabled only on host-passthrough (aka "-cpu host") mode. > > > > If we really want to be able to migrate to host with different > > CPU models (except Skylake), we could add a more specific "we > > promise the host CPU is never going to be Skylake" bit. > > > > Now, if the hypervisor is not providing any of those bits, I > > would advise against trusting family/model/stepping/microcode > > under a hypervisor. Using a pre-defined CPU model (that doesn't > > necessarily match the host) is very common when using KVM VM > > management stacks. > > > > Eduardo, > > I don't see how this is possible in a modern virtualization > environment. > > Under VMware, a VM will be migrated to SkyLake if one is in the > cluster and supports the features exposed to the VM. This can > occur for suspend/resume as well. > > The migration pool isn't a constant. Hosts can be added to a > cluster and VMs can be instructed to move across clusters. So > there doesn't need to be a SkyLake around when the VM powers on > in order for it to eventually end up on a SkyLake. If this is the case for your deployment, this means the guest must never assume it won't run on a Skylake host (even if f/m/s is not Skylake), doesn't it? Then the hypervisor won't set the "we promise the host CPU is never going to be Skylake" bit. > > Even if we expose bit to indicate that FMS matches the > underlying host, when does the guest know to query that? The > VM can be moved at any point in time, including after the guest > asks if FMS matches host. If the VM can be moved at any point of time to a different model of host CPU, this means you won't tell the guest it can trust f/m/s because it doesn't represent the underlying host. You won't set the "f/m/s/m really matches the host CPU" bit. On both scenarios you describe above, it sounds like Linux must assume it could migrated to a Skylake host at any moment. This is exactly why I'm proposing those extra bits. -- Eduardo