Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753287AbeAEXud (ORCPT + 1 other); Fri, 5 Jan 2018 18:50:33 -0500 Received: from mail-it0-f43.google.com ([209.85.214.43]:41627 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752621AbeAEXuc (ORCPT ); Fri, 5 Jan 2018 18:50:32 -0500 X-Google-Smtp-Source: ACJfBotOtJ+YkQR+rkRN+ZI7jbA0Ug6lE47MOfchFS7QoxnhSxCb8cO3hUt8taClLwIcI7J+4wBHmBok0HCwzRKLiiY= MIME-Version: 1.0 In-Reply-To: <1515189618.29312.197.camel@amazon.co.uk> References: <1515058213.12987.89.camel@amazon.co.uk> <20180104143710.8961-1-dwmw@amazon.co.uk> <1515160619.29312.126.camel@amazon.co.uk> <1515170506.29312.149.camel@amazon.co.uk> <20180105164505.xpw5pefxsyu3z56e@pd.tnic> <1515172353.29312.161.camel@amazon.co.uk> <1515189618.29312.197.camel@amazon.co.uk> From: Linus Torvalds Date: Fri, 5 Jan 2018 15:50:30 -0800 X-Google-Sender-Auth: E-nfi09xXQe2TjyncTpZB2Ig8tk Message-ID: Subject: Re: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support To: "Woodhouse, David" Cc: "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "tim.c.chen@linux.intel.com" , "bp@suse.de" , "tglx@linutronix.de" , "ak@linux.intel.com" , "riel@redhat.com" , "keescook@google.com" , "gnomes@lxorguk.ukuu.org.uk" , "pjt@google.com" , "dave.hansen@intel.com" , "luto@amacapital.net" , "jikos@kernel.org" , "gregkh@linux-foundation.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, Jan 5, 2018 at 2:00 PM, Woodhouse, David wrote: > +.macro RETPOLINE_JMP reg:req > + call 1112f > +1111: lfence > + jmp 1111b > +1112: mov %\reg, (%_ASM_SP) > + ret > +.endm > + > +.macro RETPOLINE_CALL reg:req > + jmp 1113f > +1110: RETPOLINE_JMP \reg > +1113: call 1110b > +.endm Why do these still force a register name? Is it because this is the only user? > index 2a4b1f09eb84..90d9a1589a54 100644 > --- a/arch/x86/lib/retpoline.S > +++ b/arch/x86/lib/retpoline.S > @@ -6,19 +6,14 @@ > #include > #include > #include > +#include > > -.macro THUNK sp reg > +.macro THUNK reg > .section .text.__x86.indirect_thunk.\reg > > ENTRY(__x86.indirect_thunk.\reg) > CFI_STARTPROC > - ALTERNATIVE_2 "call 2f", __stringify(lfence;jmp *%\reg), X86_FEATURE_K8, __stringify(jmp *%\reg), X86_FEATURE_NO_RETPOLINE > -1: > - lfence > - jmp 1b > -2: > - mov %\reg, (%\sp) > - ret > + NOSPEC_JMP \reg > CFI_ENDPROC Can we just move those macros into retpoline.S because using them outside that shouldn't happen? Linus