From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030932AbcDMLbp (ORCPT ); Wed, 13 Apr 2016 07:31:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:55678 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030889AbcDMLbl (ORCPT ); Wed, 13 Apr 2016 07:31:41 -0400 Date: Wed, 13 Apr 2016 04:30:15 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: tglx@linutronix.de, torvalds@linux-foundation.org, peterz@infradead.org, mingo@kernel.org, luto@amacapital.net, linux-kernel@vger.kernel.org, r.marek@assembler.cz, luto@kernel.org, brgerst@gmail.com, bp@alien8.de, dvlasenk@redhat.com, hpa@zytor.com, bp@suse.de Reply-To: hpa@zytor.com, bp@alien8.de, dvlasenk@redhat.com, brgerst@gmail.com, luto@kernel.org, bp@suse.de, luto@amacapital.net, mingo@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, r.marek@assembler.cz In-Reply-To: <0949337f13660461edca08ab67d1a841441289c9.1460075211.git.luto@kernel.org> References: <0949337f13660461edca08ab67d1a841441289c9.1460075211.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify() Git-Commit-ID: 0230bb038fa99af0c425fc4cffed307e545a9642 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0230bb038fa99af0c425fc4cffed307e545a9642 Gitweb: http://git.kernel.org/tip/0230bb038fa99af0c425fc4cffed307e545a9642 Author: Andy Lutomirski AuthorDate: Thu, 7 Apr 2016 17:31:48 -0700 Committer: Ingo Molnar CommitDate: Wed, 13 Apr 2016 10:20:42 +0200 x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify() It was in detect_nopl(), which was either a mistake by me or some kind of mis-merge. Signed-off-by: Andy Lutomirski Reviewed-by: Borislav Petkov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rudolf Marek Cc: Thomas Gleixner Fixes: ff236456f072 ("x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify") Link: http://lkml.kernel.org/r/0949337f13660461edca08ab67d1a841441289c9.1460075211.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/common.c | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 8e40eee..28d3255 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -862,31 +862,6 @@ static void detect_nopl(struct cpuinfo_x86 *c) #else set_cpu_cap(c, X86_FEATURE_NOPL); #endif - - /* - * ESPFIX is a strange bug. All real CPUs have it. Paravirt - * systems that run Linux at CPL > 0 may or may not have the - * issue, but, even if they have the issue, there's absolutely - * nothing we can do about it because we can't use the real IRET - * instruction. - * - * NB: For the time being, only 32-bit kernels support - * X86_BUG_ESPFIX as such. 64-bit kernels directly choose - * whether to apply espfix using paravirt hooks. If any - * non-paravirt system ever shows up that does *not* have the - * ESPFIX issue, we can change this. - */ -#ifdef CONFIG_X86_32 -#ifdef CONFIG_PARAVIRT - do { - extern void native_iret(void); - if (pv_cpu_ops.iret == native_iret) - set_cpu_bug(c, X86_BUG_ESPFIX); - } while (0); -#else - set_cpu_bug(c, X86_BUG_ESPFIX); -#endif -#endif } static void detect_null_seg_behavior(struct cpuinfo_x86 *c) @@ -952,6 +927,31 @@ static void generic_identify(struct cpuinfo_x86 *c) detect_nopl(c); detect_null_seg_behavior(c); + + /* + * ESPFIX is a strange bug. All real CPUs have it. Paravirt + * systems that run Linux at CPL > 0 may or may not have the + * issue, but, even if they have the issue, there's absolutely + * nothing we can do about it because we can't use the real IRET + * instruction. + * + * NB: For the time being, only 32-bit kernels support + * X86_BUG_ESPFIX as such. 64-bit kernels directly choose + * whether to apply espfix using paravirt hooks. If any + * non-paravirt system ever shows up that does *not* have the + * ESPFIX issue, we can change this. + */ +#ifdef CONFIG_X86_32 +# ifdef CONFIG_PARAVIRT + do { + extern void native_iret(void); + if (pv_cpu_ops.iret == native_iret) + set_cpu_bug(c, X86_BUG_ESPFIX); + } while (0); +# else + set_cpu_bug(c, X86_BUG_ESPFIX); +# endif +#endif } static void x86_init_cache_qos(struct cpuinfo_x86 *c)