linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	"H.J. Lu" <hjl.tools@gmail.com>,
	llvm@lists.linux.dev, linux-toolchains@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [PATCH] x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds
Date: Thu, 18 Nov 2021 14:08:04 -0800	[thread overview]
Message-ID: <CAKwvOdkrN0tLMrEyx98JY6wGdwi0Be3Z8fbTQ3vNHckM4dmG8g@mail.gmail.com> (raw)
In-Reply-To: <20211118185421.GK174703@worktop.programming.kicks-ass.net>

On Thu, Nov 18, 2021 at 10:54 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
>
> In order to further enable commit:
>
>   bbe2df3f6b6d ("x86/alternative: Try inline spectre_v2=retpoline,amd")
>
> add the new GCC flag -mindirect-branch-cs-prefix:
>
>   https://gcc.gnu.org/g:2196a681d7810ad8b227bf983f38ba716620545e
>
> to RETPOLINE=y builds. This should allow fully inlining retpoline,amd
> for GCC builds.

Do you mind adding the following link tags:

Link: https://gcc.gnu.org/g:2196a681d7810ad8b227bf983f38ba716620545e
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952
Link: https://bugs.llvm.org/show_bug.cgi?id=52323

If the feature would be helpful to implement in Clang, would you mind
keeping the cc-option, but moving the check outside of the `ifdef
CONFIG_CC_IS_GCC` block? That way, we don't need to revisit the
Makefile?

(Tangential: I wonder why RETPOLINE_CFLAGS aren't defined in
arch/x86/Makefile; they seem to be x86 specific at the moment).

With the above link tags, and with or without moving this outside the
gcc-specific guard:
Acked-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 9e12c14ea0fb..5fd5b5f091ae 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -690,6 +690,7 @@ endif
>
>  ifdef CONFIG_CC_IS_GCC
>  RETPOLINE_CFLAGS       := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
> +RETPOLINE_CFLAGS       += $(call cc-option,-mindirect-branch-cs-prefix)
>  RETPOLINE_VDSO_CFLAGS  := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register)
>  endif
>  ifdef CONFIG_CC_IS_CLANG



-- 
Thanks,
~Nick Desaulniers

       reply	other threads:[~2021-11-18 22:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211118185421.GK174703@worktop.programming.kicks-ass.net>
2021-11-18 22:08 ` Nick Desaulniers [this message]
2021-11-19 15:11   ` [PATCH] x86: Use -mindirect-branch-cs-prefix for RETPOLINE builds Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdkrN0tLMrEyx98JY6wGdwi0Be3Z8fbTQ3vNHckM4dmG8g@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=hjl.tools@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).