Received: by 10.223.185.116 with SMTP id b49csp1702956wrg; Sun, 11 Feb 2018 19:07:48 -0800 (PST) X-Google-Smtp-Source: AH8x226ec47ryk/1awXmee12dKQvr9hh8PIlp5+shCvZ2Ym8EW6Ky7MRekJuFrG8fBWEazMANcnp X-Received: by 10.98.254.21 with SMTP id z21mr10293919pfh.48.1518404868870; Sun, 11 Feb 2018 19:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518404868; cv=none; d=google.com; s=arc-20160816; b=Ng/QnLXdrrJ3NGn4PWQ7gh0SerTb3D21pVVjuds/Q1ZskUlKyUbxajZoCWEld7FP2R Ik7I1p/PeAkYfSeaEDqebDuTdLBHfin6TI2r7NNK9woHt+hHU+VMDkoJNobidxwJJywG Sspy44DVaWmEX8k+zX3kmQqa3Y43ZnYUkP/5mQb5iYU73GtywWcpnCsmKUnYSwcJ5vz6 /CzFizKDcX/QnIHcBqElFSSUjck8pChtKO3Bk1NTf73jT1D04ked07uO+couDPjxr0PU AoSegzLEphrguKKCLiwwjM8QnwI6fn/NrykrUxr6yw/+zYBjEeqDPnB/ew3FA6i+mIeU kKCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=P9jRrz8E+qzd0DgUEotS9+yavLh9c0E9Q2/7mEdvhP4=; b=l4aC/LDO06GQjcrQQdrKCgts1zpHO2uni+S7tTp4x6Jk+F8/ohXUHyJyrYY+UujxUh 01W0Zyjdj+n6A3AjCk3i4mVhJK02jwePkBp6uZSZOUQzh1sqWUd6aAr8sLDguuK4ZYZJ dzxhA1Z6i4EjGMRwxAIG+UwUOm8pz3xTV+7zwMAZSURqn54dvyK6U+dBZlwVZirgaTym KwdZMXK+Mpy2sIx3wDJVPitkH/f5Ev+CPonTp2XeB2hYfGRfJOMCI6T8N4cAuRu1IBNd XuxX2g4F2VMrxfAEoqr3CWL6LCMvGb9cdCdUq/w/odUl6nb944zaAX9Cy0qoHfLu95tf JA1A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si3075469pgq.500.2018.02.11.19.07.34; Sun, 11 Feb 2018 19:07:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932658AbeBLCsK (ORCPT + 99 others); Sun, 11 Feb 2018 21:48:10 -0500 Received: from [198.137.202.136] ([198.137.202.136]:59691 "EHLO mail.zytor.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932373AbeBLCsI (ORCPT ); Sun, 11 Feb 2018 21:48:08 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1BC9Q1P031720; Sun, 11 Feb 2018 04:09:26 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1BC9PBQ031717; Sun, 11 Feb 2018 04:09:25 -0800 Date: Sun, 11 Feb 2018 04:09:25 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for David Woodhouse Message-ID: Cc: dwmw@amazon.co.uk, arjan@linux.intel.com, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, bp@alien8.de, hpa@zytor.com, jpoimboe@redhat.com, peterz@infradead.org, dave.hansen@linux.intel.com, luto@kernel.org, dwmw2@infradead.org, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org Reply-To: peterz@infradead.org, jpoimboe@redhat.com, hpa@zytor.com, bp@alien8.de, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, arjan@linux.intel.com, dwmw@amazon.co.uk, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, dan.j.williams@intel.com, dwmw2@infradead.org, luto@kernel.org, dave.hansen@linux.intel.com In-Reply-To: <1518305967-31356-3-git-send-email-dwmw@amazon.co.uk> References: <1518305967-31356-3-git-send-email-dwmw@amazon.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] Revert "x86/speculation: Simplify indirect_branch_prediction_barrier()" Git-Commit-ID: 930ce1a7a55bc0eb8917f453ee22f1b6d67df5cd 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 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 930ce1a7a55bc0eb8917f453ee22f1b6d67df5cd Gitweb: https://git.kernel.org/tip/930ce1a7a55bc0eb8917f453ee22f1b6d67df5cd Author: David Woodhouse AuthorDate: Sat, 10 Feb 2018 23:39:23 +0000 Committer: Ingo Molnar CommitDate: Sun, 11 Feb 2018 11:24:15 +0100 Revert "x86/speculation: Simplify indirect_branch_prediction_barrier()" This reverts commit 64e16720ea0879f8ab4547e3b9758936d483909b. We cannot call C functions like that, without marking all the call-clobbered registers as, well, clobbered. We might have got away with it for now because the __ibp_barrier() function was *fairly* unlikely to actually use any other registers. But no. Just no. Signed-off-by: David Woodhouse Cc: Andy Lutomirski Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dan Williams Cc: Dave Hansen Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: arjan.van.de.ven@intel.com Cc: dave.hansen@intel.com Cc: jmattson@google.com Cc: karahmed@amazon.de Cc: kvm@vger.kernel.org Cc: pbonzini@redhat.com Cc: rkrcmar@redhat.com Cc: sironi@amazon.de Link: http://lkml.kernel.org/r/1518305967-31356-3-git-send-email-dwmw@amazon.co.uk Signed-off-by: Ingo Molnar --- arch/x86/include/asm/nospec-branch.h | 13 +++++++++---- arch/x86/include/asm/processor.h | 3 --- arch/x86/kernel/cpu/bugs.c | 6 ------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index 4d57894..300cc15 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -164,10 +164,15 @@ static inline void vmexit_fill_RSB(void) static inline void indirect_branch_prediction_barrier(void) { - alternative_input("", - "call __ibp_barrier", - X86_FEATURE_USE_IBPB, - ASM_NO_INPUT_CLOBBER("eax", "ecx", "edx", "memory")); + asm volatile(ALTERNATIVE("", + "movl %[msr], %%ecx\n\t" + "movl %[val], %%eax\n\t" + "movl $0, %%edx\n\t" + "wrmsr", + X86_FEATURE_USE_IBPB) + : : [msr] "i" (MSR_IA32_PRED_CMD), + [val] "i" (PRED_CMD_IBPB) + : "eax", "ecx", "edx", "memory"); } #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 513f960..99799fb 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -969,7 +969,4 @@ bool xen_set_default_idle(void); void stop_this_cpu(void *dummy); void df_debug(struct pt_regs *regs, long error_code); - -void __ibp_barrier(void); - #endif /* _ASM_X86_PROCESSOR_H */ diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 71949bf..61152aa 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -337,9 +337,3 @@ ssize_t cpu_show_spectre_v2(struct device *dev, spectre_v2_module_string()); } #endif - -void __ibp_barrier(void) -{ - __wrmsr(MSR_IA32_PRED_CMD, PRED_CMD_IBPB, 0); -} -EXPORT_SYMBOL_GPL(__ibp_barrier);