Received: by 10.223.185.116 with SMTP id b49csp3369662wrg; Tue, 13 Feb 2018 01:17:35 -0800 (PST) X-Google-Smtp-Source: AH8x224zdZOdzRzzvI6ylJmH8rEJzfO/+XG2DpkhLmxKMXTKMvCg3lgTOJ2qgW16D85dau6gP43d X-Received: by 2002:a17:902:6b83:: with SMTP id p3-v6mr528746plk.18.1518513455300; Tue, 13 Feb 2018 01:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518513455; cv=none; d=google.com; s=arc-20160816; b=clQEMPOck0Q+DD726mobUQEuq3iB4jpcb1VHSXNnk6SSM8J3Pe/+fYo0CeypeOc9Fc eSDXIot/nviJ+1mQNrv3cMJj2hr76Ql/Cywe5YSwe9GdmXrRp4AB5VTqLutJOHRMRxYB Lti2tJvoGw19C4DKZx/yHEeSS+f9cjlxwyLvOBX/p07q3Hx6ftgP4INY5GjcclBcoOyu l4H5hn8tul6Q7qahv4AcCyqhbsS9/h4hkNzUiywq6vJpZtq4cKP4j5pM+SPBQFOBX0e9 ofHFniaM0aHDOlcT+Let/rxKD0bNRBuRvb7BSiyD6pIjzJuYfx+4J+XpGunZyYV3ioXs zgFg== 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=PPRp5aiwEPTmr7+9TfZMoIrTYGLKLtTOutqqYnXLRoI=; b=dT29hGW85TNFzhfOds1hPs6duk57p1bGGjQrDttgZG08Bu6J3jFxslbD/Q+t7GEwwi 8ZEWC6v1H3kWUieQi9n63Dtk2XKYBN0BtSNxOKXLvGVQXUsgz945o4B5U6vDKQYAbemS CLJ39qGn4onaPJEyGcFTeHPjUA70neDjPXwWaOKedn8L1Y616wCG7hXHS2Ra/4nufKbn 7rwKRnqfF5SbORh25X3VGK5WL1KZ2x68xPUdR41A9pF5qF46SDYdD9c94EeD5yuLmeUj PJg2oaA/3nXdNpuouuHKu/Jl27QS2HlPU0/P87dZgLVjamTprLu8zWLAeNwwQy9h/Sjc 22RA== 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 p9-v6si5410135pls.317.2018.02.13.01.17.20; Tue, 13 Feb 2018 01:17:35 -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 S934562AbeBMJOv (ORCPT + 99 others); Tue, 13 Feb 2018 04:14:51 -0500 Received: from terminus.zytor.com ([198.137.202.136]:34491 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934024AbeBMJOr (ORCPT ); Tue, 13 Feb 2018 04:14:47 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1D8wLH4023952; Tue, 13 Feb 2018 00:58:21 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1D8wLe0023949; Tue, 13 Feb 2018 00:58:21 -0800 Date: Tue, 13 Feb 2018 00:58:21 -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: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, dwmw2@infradead.org, dan.j.williams@intel.com, gregkh@linuxfoundation.org, luto@kernel.org, dwmw@amazon.co.uk, jpoimboe@redhat.com, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, bp@alien8.de, peterz@infradead.org, tglx@linutronix.de, arjan@linux.intel.com Reply-To: torvalds@linux-foundation.org, dave.hansen@linux.intel.com, bp@alien8.de, tglx@linutronix.de, peterz@infradead.org, arjan@linux.intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, hpa@zytor.com, gregkh@linuxfoundation.org, dan.j.williams@intel.com, dwmw@amazon.co.uk, luto@kernel.org, jpoimboe@redhat.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: f208820a321f9b23d77d7eed89945d862d62a3ed 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: f208820a321f9b23d77d7eed89945d862d62a3ed Gitweb: https://git.kernel.org/tip/f208820a321f9b23d77d7eed89945d862d62a3ed Author: David Woodhouse AuthorDate: Sat, 10 Feb 2018 23:39:23 +0000 Committer: Ingo Molnar CommitDate: Tue, 13 Feb 2018 08:59:00 +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);