Received: by 10.223.185.116 with SMTP id b49csp1012919wrg; Wed, 21 Feb 2018 10:33:31 -0800 (PST) X-Google-Smtp-Source: AH8x225SYVFYBy9mK8YuApx2OKiA7Ohw/bMMklfOpmN+dUycGyok15P8IzfFdi/Mzunsm7bZfc+I X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr3912336pld.72.1519238010968; Wed, 21 Feb 2018 10:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238010; cv=none; d=google.com; s=arc-20160816; b=rgoRSpseoIAJzOaaFBSrNWocwSIcyhe1LgZDAgRfP6yXyrg0xM2QMQMHkYBJbSvPJu CnbKww7tIwytQoGtWp/aK/u/2iwHvp0HiIlvcNjVuhYVaWNrkGSy55ayPGTmRbbZzpJk NCgJ91LKFGMRGX5OrQJhqaCyzi9tNXspgzZi9ioU4JhJKssg4ASR+ThQgiBhDD1ocgJD /fb71105phH8HamrIYqVpkv7ieum34joCsxlBEMMERFQmLyXU5gTde0JEXVvoSRIsQPx yQ1g2qYQF21MEcI+OFZLiIOofbnOBX3KUCG4j4nJZeEzhupbbReIyc+0sGBQbyuumU2D 87qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Inin2PbMTQ0UfH7+5UDOrkOgAab3di9rryWkev2IMyk=; b=Y3EOyj2KoAMpPG4364GZUFLOxXJnK9/LYgveqJOznO/jNyglPpnUncIp1p0MbPRSDo 8/923FNuqAXr/3jt0iP7/eJSTDgtlUHtZ3TZvxsFiLvNQq1FTSayxpcLuFUvgsJ5dstS UFEZ84K+1PTFgfkQSbEGjpqSaQ7lyrV4AMHVzjoxIoaUzSVjCW26Todwdh3JBExmCdom 5aXQaBp8ToWX2GjD7iq36yk34vkxwB19E5twQDEQSACug3ZQC52x/hQCkV1EHdbYhOCh p0YUvgYxijt+lTaPGAjyT0PIJRlQIyVawxXaea7d1nplZ5lKofgLPAa4pQXud5/QWoIO DhOg== 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 t7si171868pfh.290.2018.02.21.10.33.14; Wed, 21 Feb 2018 10:33:30 -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 S965266AbeBUNHy (ORCPT + 99 others); Wed, 21 Feb 2018 08:07:54 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41872 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965246AbeBUNHv (ORCPT ); Wed, 21 Feb 2018 08:07:51 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8AC50FFC; Wed, 21 Feb 2018 13:07:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Andy Lutomirski , Arjan van de Ven , Borislav Petkov , Dan Williams , Dave Hansen , David Woodhouse , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , arjan.van.de.ven@intel.com, dave.hansen@intel.com, jmattson@google.com, karahmed@amazon.de, kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, sironi@amazon.de, Ingo Molnar Subject: [PATCH 4.15 050/163] Revert "x86/speculation: Simplify indirect_branch_prediction_barrier()" Date: Wed, 21 Feb 2018 13:47:59 +0100 Message-Id: <20180221124533.207352393@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Woodhouse commit f208820a321f9b23d77d7eed89945d862d62a3ed upstream. 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 Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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__ */ --- 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 */ --- 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 devic spectre_v2_module_string()); } #endif - -void __ibp_barrier(void) -{ - __wrmsr(MSR_IA32_PRED_CMD, PRED_CMD_IBPB, 0); -} -EXPORT_SYMBOL_GPL(__ibp_barrier);