Received: by 10.223.176.5 with SMTP id f5csp1219155wra; Wed, 31 Jan 2018 03:09:54 -0800 (PST) X-Google-Smtp-Source: AH8x227uTjLmE4QxTXExBQI81qcMIMJsOggvtVxWlyNfK3uDZx1iezALpQmmAZpDdSQ+MMSEg7qS X-Received: by 10.98.60.132 with SMTP id b4mr33534401pfk.120.1517396994045; Wed, 31 Jan 2018 03:09:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517396994; cv=none; d=google.com; s=arc-20160816; b=oTqFh3Hlz7mAwkkRgSUjS7WremBHK2MpgzT3Q6DhNiek+Mzkr3dMl2ucpNylEfd/NN w2Vhy6lFOnuP0xkWhFxd1/UXZ/g46ffvALnjnWW4edqwoNqzsbaYavRXHir65Q+chG4n q3rLn5vLPPPzuRTvqd4Tx5UbZtgobiwC/ivhOPQlB7KqLYrYtDMolEDgzxHAzcoCRWIG AUhfQoP8Nv/66R+MdYlohJ7jtbn7vHlnR+ryQdELQNYDqNO3BVPiApFcUjze4gtTzmpM p9IODxwDXC4HqNETtoIYNfjLEEoz2pxhWdoEYHFhJ5mayAaQcpZnMPLkNNeVZCEqt2OL 2V+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=fS7cMTDrvk/EvvjV3BEUzUDCliRzPUHgKBCyRwyZe80=; b=AvmCg7QiVUEPsLRtIW0a7MuV1KWuealDqTrAWz2+tRc9Sq+phxNM1y3qVO450VG+Ut 9n/QlIthnGsxftz1OyjAXR4Vmyq1TboTN7tjvwTkAmmp1SUUOIH7M9fdQjEfumSJcA1L tKMio+xoiwezT6MzHTeEjQWIgtrhoZiGrSjeKbvv2zV3vo/jHH97A5wEG+Iua22Yex7k FVd0sEngg6cc3CSv/cC98i4yNK+LoZr85edT4aBIn8hdc+eC1/tZ0f0AzsDB8av0TnC6 JsypZzqQFnHxtxfq2HMSC/SOB3D5GZpxEO0Y1YCJGFVnrKC6YpYBrcAiXfnT4Z3nZYUS w0Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4-v6si5892805plq.535.2018.01.31.03.09.39; Wed, 31 Jan 2018 03:09:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753012AbeAaLET (ORCPT + 99 others); Wed, 31 Jan 2018 06:04:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55084 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbeAaLER (ORCPT ); Wed, 31 Jan 2018 06:04:17 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7B264F1BA; Wed, 31 Jan 2018 11:04:16 +0000 (UTC) Received: from work-vm (ovpn-116-205.ams2.redhat.com [10.36.116.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1AB015C20B; Wed, 31 Jan 2018 11:04:09 +0000 (UTC) Date: Wed, 31 Jan 2018 11:04:07 +0000 From: "Dr. David Alan Gilbert" To: Thomas Gleixner Cc: Christophe de Dinechin , Alan Cox , Linus Torvalds , David Woodhouse , Arjan van de Ven , Eduardo Habkost , KarimAllah Ahmed , Linux Kernel Mailing List , 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 , Masami Hiramatsu , Paolo Bonzini , Peter Zijlstra , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tim Chen , Tom Lendacky , KVM list , the arch/x86 maintainers Subject: Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure Message-ID: <20180131110406.GB2521@work-vm> References: <1516476182-5153-6-git-send-email-karahmed@amazon.de> <20180129201404.GA1588@localhost.localdomain> <1517257022.18619.30.camel@infradead.org> <20180129204256.GV25150@localhost.localdomain> <31415b7f-9c76-c102-86cd-6bf4e23e3aee@linux.intel.com> <1517259759.18619.38.camel@infradead.org> <20180130204623.583b1a7a@alans-desktop> <200C59E8-80F3-4FEC-BA3B-E6A56FA12C74@dinechin.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 31 Jan 2018 11:04:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Thomas Gleixner (tglx@linutronix.de) wrote: > On Wed, 31 Jan 2018, Christophe de Dinechin wrote: > > > On 30 Jan 2018, at 21:46, Alan Cox wrote: > > > > > >> If you are ever going to migrate to Skylake, I think you should just > > >> always tell the guests that you're running on Skylake. That way the > > >> guests will always assume the worst case situation wrt Specte. > > > > > > Unfortunately if you do that then guest may also decide to use other > > > Skylake hardware features and pop its clogs when it finds out its actually > > > running on Westmere or SandyBridge. > > > > > > So you need to be able to both lie to the OS and user space via cpuid and > > > also have a second 'but do skylake protections' that only mitigation > > > aware software knows about. > > > > Yes. The most desirable lie is different depending on whether you want to > > allow virtualization features such as migration (where you’d gravitate > > towards a CPU with less features) or whether you want to allow mitigation > > (where you’d rather present the most fragile CPUID, probably Skylake). > > > > Looking at some recent patches, I’m concerned that the code being added > > often assumes that the CPUID is the correct way to get that info. > > I do not think this is correct. You really want specific information about > > the host CPUID, not whatever KVM CPUID emulation makes up. > > That wont cut it. If you have a heterogenous farm of systems, then you need: > > - All CPUs have to support IBRS/IBPB or at least hte hypervisor has to > pretend they do by providing fake MRS for that > > - Have a 'force IBRS/IBPB' mechanism so the guests don't discard it due > to missing CPU feature bits. That half is the easy bit, we've already got that (thanks to Eduardo), QEMU has -IBRS variants of CPU types, so if you start a VM with -cpu Broadwell-IBRS it'll get advertised to the guest as having IBRS; and (with appropriate flags) the management layers will only allow that to be started on hosts that support IBRS and wont allow migration between hosts with and without it. > Though this gets worse. You have to make sure that the guest keeps _ALL_ > sorts of mitigation mechanisms enabled and does not decide to disable > retpolines because IBRS/IBPB are "available". This is what's different with this set; it's all coming down to sets of heuristics which include CPU model etc, rather than just a 'we've got a feature, use it'. Dave > Good luck with making all that work. > > Thanks, > > tglx -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK