From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227Y2Z7KloQlwoK49TPhlnie0td6XrJFgmvydKfRW+uOIjYceQnGCiHKPbuyUwy1JmImCvYA ARC-Seal: i=1; a=rsa-sha256; t=1517396657; cv=none; d=google.com; s=arc-20160816; b=bIdfNDf1yBG/8CRLkpNnLO+R0zvFTbvtY8uLkVHmaSk9NHMMXb53FPxh/MokdMhLO3 eByJVA/l/O28y7oVB7jKUlRkrbi2zCl5682uzXFAi13lv/d4GobNmXK6utEkEOpjlUZr 9YnT5MoPoED2zcA5mfpJgQ+Nk34iE8CX0oeLpPComozD1pzlgeTIri+6rgNbZzdA2OPt awpepoR+HUYtBlvomPM6U775V9UW8lpSEXpi2IOZr431XRLqLqV5d+s+dxEzzBAr3dKy /rwz0WJuY1YK/YUpiiWxIRNsrtCSUdsznJv91nBES6kBnL7OUc1rF2s7zCSy48y+Ee3i +/Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=kwYkYfSRPcqewJ2vd2IMnYw2OFdW4jZ23ev3f8W6buycR775SO85JTqzrwtXsdqzGf WsclrpfBwIdplM68dM+HliZybaG4pTtA0RTpOKxesQG2PmK94Fco1SpbJI5pFrShyaLS Zci7USiKqZdUwydWOHQ0VVTUjmqXvb15FmeKPigUr9UcvRXWpYVFEkDh/svM9zFYg1ul cVtb4jE3QSzdyPdBIJRXVdQERUs+NbUpJAv/To+iU2YQn7A5o6U/CwTKnVJzz+ymHMzA NsGfW55Tnp6B0b4AZ3FGVuQgYoWOGsa5cLWTIVaaNwNtiWDu7VXjCm+rWFxBOVD3730/ 542g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dgilbert@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=dgilbert@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of dgilbert@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=dgilbert@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590140581449802182?= X-GMAIL-MSGID: =?utf-8?q?1591105718044160404?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: * 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