From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753323AbeAFVXp (ORCPT + 1 other); Sat, 6 Jan 2018 16:23:45 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46791 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbeAFVXo (ORCPT ); Sat, 6 Jan 2018 16:23:44 -0500 Date: Sat, 6 Jan 2018 22:23:38 +0100 (CET) From: Thomas Gleixner To: Andrew Cooper cc: David Woodhouse , Andi Kleen , Paul Turner , LKML , Linus Torvalds , Greg Kroah-Hartman , Tim Chen , Dave Hansen , Kees Cook , Rik van Riel , Peter Zijlstra , Andy Lutomirski , Jiri Kosina , gnomes@lxorguk.ukuu.org.uk, Thomas Lendacky Subject: Re: [PATCH v5 02/12] x86/retpoline: Add initial retpoline support In-Reply-To: <0c150bb9-f5eb-2bf2-1f64-84c1b315868b@citrix.com> Message-ID: References: <1515239374-23361-1-git-send-email-dwmw@amazon.co.uk> <1515239374-23361-3-git-send-email-dwmw@amazon.co.uk> <0c150bb9-f5eb-2bf2-1f64-84c1b315868b@citrix.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1323891241-1515273819=:2376" X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1323891241-1515273819=:2376 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Sat, 6 Jan 2018, Andrew Cooper wrote: > On 06/01/18 11:49, David Woodhouse wrote: > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > > index 372ba3f..40e6e54 100644 > > --- a/arch/x86/kernel/cpu/common.c > > +++ b/arch/x86/kernel/cpu/common.c > > @@ -904,6 +904,11 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) > > > > setup_force_cpu_bug(X86_BUG_SPECTRE_V1); > > setup_force_cpu_bug(X86_BUG_SPECTRE_V2); > > +#ifdef CONFIG_RETPOLINE > > + setup_force_cpu_cap(X86_FEATURE_RETPOLINE); > > + if (c->x86_vendor == X86_VENDOR_AMD) > > + setup_force_cpu_cap(X86_FEATURE_RETPOLINE_AMD); > > This isn't safe.  It needs to be dependant on finding that LFENCEs are > actually dispatch serialising. > > In particular, when virtualised, you'll most likely be saddled with the > hypervisors choice of setting, in which case you need to use retpoline > as a fallback. On bare metal we are sure, the virtualization part is a different question. Thanks, tglx --8323329-1323891241-1515273819=:2376--