All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] x86: Mandate asm-goto support
@ 2018-03-19 15:41 Peter Zijlstra
  2018-03-19 15:41 ` [PATCH 1/2] x86: Force asm-goto Peter Zijlstra
  2018-03-19 15:41 ` [PATCH 2/2] x86: Remove FAST_FEATURE_TESTS Peter Zijlstra
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Zijlstra @ 2018-03-19 15:41 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel, torvalds, peterz

Its been many _many_ years since asm-goto got introduced and recently there's
been some desire to unconditionally rely on it.

This makes the x86 build hard rely on asm-goto (effectively lifts the minimum
to GCC-4.5).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] x86: Force asm-goto
  2018-03-19 15:41 [PATCH 0/2] x86: Mandate asm-goto support Peter Zijlstra
@ 2018-03-19 15:41 ` Peter Zijlstra
  2018-03-19 19:57   ` Thomas Gleixner
  2018-03-20 15:45   ` Jonathan Corbet
  2018-03-19 15:41 ` [PATCH 2/2] x86: Remove FAST_FEATURE_TESTS Peter Zijlstra
  1 sibling, 2 replies; 12+ messages in thread
From: Peter Zijlstra @ 2018-03-19 15:41 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel, torvalds, Peter Zijlstra (Intel)

[-- Attachment #1: peterz-x86-force-asm-goto.patch --]
[-- Type: text/plain, Size: 1923 bytes --]

We want to start using asm-goto to guarantee the absence of dynamic
branches (and thus speculation).

A primary prerequisite for this is of course that the compiler
supports asm-goto. This effecively lifts the minimum GCC version to
build an x86 kernel to gcc-4.5.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 Makefile          |   13 +++++++------
 arch/x86/Makefile |    4 ++++
 2 files changed, 11 insertions(+), 6 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
 RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
 export RETPOLINE_CFLAGS
 
+# check for 'asm goto'
+ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
+  CC_HAVE_ASM_GOTO := 1
+  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
 ifeq ($(config-targets),1)
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -l
 # Tell gcc to never replace conditional load with a non-conditional one
 KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
 
-# check for 'asm goto'
-ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
-	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
-	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
-endif
-
 include scripts/Makefile.kcov
 include scripts/Makefile.gcc-plugins
 
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
   endif
 endif
 
+ifndef CC_HAVE_ASM_GOTO
+  $(error Compiler lacks asm-goto support.)
+endif
+
 #
 # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a
 # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226).  There's no way

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] x86: Remove FAST_FEATURE_TESTS
  2018-03-19 15:41 [PATCH 0/2] x86: Mandate asm-goto support Peter Zijlstra
  2018-03-19 15:41 ` [PATCH 1/2] x86: Force asm-goto Peter Zijlstra
@ 2018-03-19 15:41 ` Peter Zijlstra
  2018-03-20 10:01   ` [tip:x86/build] " tip-bot for Peter Zijlstra
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Zijlstra @ 2018-03-19 15:41 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel, torvalds, Peter Zijlstra (Intel)

[-- Attachment #1: peterz-x86-remove-fast-feature.patch --]
[-- Type: text/plain, Size: 1861 bytes --]

Since we want to rely on static branches to avoid speculation, remove
any possible fallback code for static_cpu_has.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/Kconfig                  |   11 -----------
 arch/x86/include/asm/cpufeature.h |    8 --------
 2 files changed, 19 deletions(-)

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -393,17 +393,6 @@ config X86_FEATURE_NAMES
 
 	  If in doubt, say Y.
 
-config X86_FAST_FEATURE_TESTS
-	bool "Fast CPU feature tests" if EMBEDDED
-	default y
-	---help---
-	  Some fast-paths in the kernel depend on the capabilities of the CPU.
-	  Say Y here for the kernel to patch in the appropriate code at runtime
-	  based on the capabilities of the CPU. The infrastructure for patching
-	  code at runtime takes up some additional space; space-constrained
-	  embedded systems may wish to say N here to produce smaller, slightly
-	  slower code.
-
 config X86_X2APIC
 	bool "Support x2apic"
 	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -140,7 +140,6 @@ extern void clear_cpu_cap(struct cpuinfo
 
 #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
 
-#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_X86_FAST_FEATURE_TESTS)
 /*
  * Static testing of CPU features.  Used the same as boot_cpu_has().
  * These will statically patch the target code for additional
@@ -196,13 +195,6 @@ static __always_inline __pure bool _stat
 		boot_cpu_has(bit) :				\
 		_static_cpu_has(bit)				\
 )
-#else
-/*
- * Fall back to dynamic for gcc versions which don't support asm goto. Should be
- * a minority now anyway.
- */
-#define static_cpu_has(bit)		boot_cpu_has(bit)
-#endif
 
 #define cpu_has_bug(c, bit)		cpu_has(c, (bit))
 #define set_cpu_bug(c, bit)		set_cpu_cap(c, (bit))

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-19 15:41 ` [PATCH 1/2] x86: Force asm-goto Peter Zijlstra
@ 2018-03-19 19:57   ` Thomas Gleixner
  2018-03-19 20:13     ` Peter Zijlstra
  2018-03-20 15:45   ` Jonathan Corbet
  1 sibling, 1 reply; 12+ messages in thread
From: Thomas Gleixner @ 2018-03-19 19:57 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, linux-kernel, torvalds

On Mon, 19 Mar 2018, Peter Zijlstra wrote:

> We want to start using asm-goto to guarantee the absence of dynamic
> branches (and thus speculation).
> 
> A primary prerequisite for this is of course that the compiler
> supports asm-goto. This effecively lifts the minimum GCC version to
> build an x86 kernel to gcc-4.5.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  Makefile          |   13 +++++++------
>  arch/x86/Makefile |    4 ++++
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
>  RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
>  export RETPOLINE_CFLAGS
>  
> +# check for 'asm goto'
> +ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)

Why are you not using the shell-cached version which you remove further
down?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-19 19:57   ` Thomas Gleixner
@ 2018-03-19 20:13     ` Peter Zijlstra
  2018-03-20 10:00       ` [tip:x86/build] " tip-bot for Peter Zijlstra
  2018-03-27 16:43       ` [PATCH 1/2] " Anders Roxell
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Zijlstra @ 2018-03-19 20:13 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: mingo, linux-kernel, torvalds

On Mon, Mar 19, 2018 at 08:57:48PM +0100, Thomas Gleixner wrote:
> On Mon, 19 Mar 2018, Peter Zijlstra wrote:
> 
> > We want to start using asm-goto to guarantee the absence of dynamic
> > branches (and thus speculation).
> > 
> > A primary prerequisite for this is of course that the compiler
> > supports asm-goto. This effecively lifts the minimum GCC version to
> > build an x86 kernel to gcc-4.5.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> >  Makefile          |   13 +++++++------
> >  arch/x86/Makefile |    4 ++++
> >  2 files changed, 11 insertions(+), 6 deletions(-)
> > 
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
> >  RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
> >  export RETPOLINE_CFLAGS
> >  
> > +# check for 'asm goto'
> > +ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
> 
> Why are you not using the shell-cached version which you remove further
> down?

Bah, I'm an idiot. I fixed that up at least two times, but clearly I
forgot to check that again before sending.

---
Subject: x86: Force asm-goto
From: Peter Zijlstra <peterz@infradead.org>
Date: Wed Jan 17 11:42:07 CET 2018

We want to start using asm-goto to guarantee the absence of dynamic
branches (and thus speculation).

A primary prerequisite for this is of course that the compiler
supports asm-goto. This effecively lifts the minimum GCC version to
build an x86 kernel to gcc-4.5.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 Makefile          |   13 +++++++------
 arch/x86/Makefile |    4 ++++
 2 files changed, 11 insertions(+), 6 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
 RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
 export RETPOLINE_CFLAGS
 
+# check for 'asm goto'
+ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
+  CC_HAVE_ASM_GOTO := 1
+  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
 ifeq ($(config-targets),1)
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -l
 # Tell gcc to never replace conditional load with a non-conditional one
 KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
 
-# check for 'asm goto'
-ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
-	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
-	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
-endif
-
 include scripts/Makefile.kcov
 include scripts/Makefile.gcc-plugins
 
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
   endif
 endif
 
+ifndef CC_HAVE_ASM_GOTO
+  $(error Compiler lacks asm-goto support.)
+endif
+
 #
 # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a
 # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226).  There's no way

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tip:x86/build] x86: Force asm-goto
  2018-03-19 20:13     ` Peter Zijlstra
@ 2018-03-20 10:00       ` tip-bot for Peter Zijlstra
  2018-03-27 16:43       ` [PATCH 1/2] " Anders Roxell
  1 sibling, 0 replies; 12+ messages in thread
From: tip-bot for Peter Zijlstra @ 2018-03-20 10:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: hpa, linux-kernel, tglx, peterz, mingo

Commit-ID:  e501ce957a786ecd076ea0cfb10b114e6e4d0f40
Gitweb:     https://git.kernel.org/tip/e501ce957a786ecd076ea0cfb10b114e6e4d0f40
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 17 Jan 2018 11:42:07 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 20 Mar 2018 10:58:02 +0100

x86: Force asm-goto

We want to start using asm-goto to guarantee the absence of dynamic
branches (and thus speculation).

A primary prerequisite for this is of course that the compiler
supports asm-goto. This effecively lifts the minimum GCC version to
build an x86 kernel to gcc-4.5.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: torvalds@linux-foundation.org
Link: https://lkml.kernel.org/r/20180319201327.GJ4043@hirez.programming.kicks-ass.net
---
 Makefile          | 13 +++++++------
 arch/x86/Makefile |  4 ++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index d65e2e229017..6fb6fd28a124 100644
--- a/Makefile
+++ b/Makefile
@@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
 RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
 export RETPOLINE_CFLAGS
 
+# check for 'asm goto'
+ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
+  CC_HAVE_ASM_GOTO := 1
+  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
 ifeq ($(config-targets),1)
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
 # Tell gcc to never replace conditional load with a non-conditional one
 KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
 
-# check for 'asm goto'
-ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
-	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
-	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
-endif
-
 include scripts/Makefile.kcov
 include scripts/Makefile.gcc-plugins
 
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 498c1b812300..d798e36d103c 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
   endif
 endif
 
+ifndef CC_HAVE_ASM_GOTO
+  $(error Compiler lacks asm-goto support.)
+endif
+
 #
 # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a
 # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226).  There's no way

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [tip:x86/build] x86: Remove FAST_FEATURE_TESTS
  2018-03-19 15:41 ` [PATCH 2/2] x86: Remove FAST_FEATURE_TESTS Peter Zijlstra
@ 2018-03-20 10:01   ` tip-bot for Peter Zijlstra
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Peter Zijlstra @ 2018-03-20 10:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, peterz, mingo, hpa, linux-kernel

Commit-ID:  d0266046ad54e0c964941364cd82a0d0478ce286
Gitweb:     https://git.kernel.org/tip/d0266046ad54e0c964941364cd82a0d0478ce286
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 19 Mar 2018 16:41:26 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 20 Mar 2018 10:58:03 +0100

x86: Remove FAST_FEATURE_TESTS

Since we want to rely on static branches to avoid speculation, remove
any possible fallback code for static_cpu_has.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: torvalds@linux-foundation.org
Link: https://lkml.kernel.org/r/20180319154717.705383007@infradead.org

---
 arch/x86/Kconfig                  | 11 -----------
 arch/x86/include/asm/cpufeature.h |  8 --------
 2 files changed, 19 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 0fa71a78ec99..cb5b5907dbd6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -393,17 +393,6 @@ config X86_FEATURE_NAMES
 
 	  If in doubt, say Y.
 
-config X86_FAST_FEATURE_TESTS
-	bool "Fast CPU feature tests" if EMBEDDED
-	default y
-	---help---
-	  Some fast-paths in the kernel depend on the capabilities of the CPU.
-	  Say Y here for the kernel to patch in the appropriate code at runtime
-	  based on the capabilities of the CPU. The infrastructure for patching
-	  code at runtime takes up some additional space; space-constrained
-	  embedded systems may wish to say N here to produce smaller, slightly
-	  slower code.
-
 config X86_X2APIC
 	bool "Support x2apic"
 	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 736771c9822e..b27da9602a6d 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -140,7 +140,6 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit);
 
 #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
 
-#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_X86_FAST_FEATURE_TESTS)
 /*
  * Static testing of CPU features.  Used the same as boot_cpu_has().
  * These will statically patch the target code for additional
@@ -196,13 +195,6 @@ t_no:
 		boot_cpu_has(bit) :				\
 		_static_cpu_has(bit)				\
 )
-#else
-/*
- * Fall back to dynamic for gcc versions which don't support asm goto. Should be
- * a minority now anyway.
- */
-#define static_cpu_has(bit)		boot_cpu_has(bit)
-#endif
 
 #define cpu_has_bug(c, bit)		cpu_has(c, (bit))
 #define set_cpu_bug(c, bit)		set_cpu_cap(c, (bit))

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-19 15:41 ` [PATCH 1/2] x86: Force asm-goto Peter Zijlstra
  2018-03-19 19:57   ` Thomas Gleixner
@ 2018-03-20 15:45   ` Jonathan Corbet
  2018-03-20 15:50     ` Peter Zijlstra
  1 sibling, 1 reply; 12+ messages in thread
From: Jonathan Corbet @ 2018-03-20 15:45 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, tglx, linux-kernel, torvalds

On Mon, 19 Mar 2018 16:41:25 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> A primary prerequisite for this is of course that the compiler
> supports asm-goto. This effecively lifts the minimum GCC version to
> build an x86 kernel to gcc-4.5.

Given that, how about a patch to Documentation/Changes to reflect the new
reality?  It's not in RST yet, so you should be able to go there without
ill effect :)

Thanks,

jon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-20 15:45   ` Jonathan Corbet
@ 2018-03-20 15:50     ` Peter Zijlstra
  2018-03-20 18:44       ` Jonathan Corbet
  2018-03-22 12:10       ` Pavel Machek
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Zijlstra @ 2018-03-20 15:50 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: mingo, tglx, linux-kernel, torvalds

On Tue, Mar 20, 2018 at 09:45:54AM -0600, Jonathan Corbet wrote:
> On Mon, 19 Mar 2018 16:41:25 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > A primary prerequisite for this is of course that the compiler
> > supports asm-goto. This effecively lifts the minimum GCC version to
> > build an x86 kernel to gcc-4.5.
> 
> Given that, how about a patch to Documentation/Changes to reflect the new
> reality?  It's not in RST yet, so you should be able to go there without
> ill effect :)


That thing says:

  GCC
  ---

  The gcc version requirements may vary depending on the type of CPU in your
  computer. jon

Which is still entirely accurate. And afaik the 3.2 minimum listed there
still works for !x86.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-20 15:50     ` Peter Zijlstra
@ 2018-03-20 18:44       ` Jonathan Corbet
  2018-03-22 12:10       ` Pavel Machek
  1 sibling, 0 replies; 12+ messages in thread
From: Jonathan Corbet @ 2018-03-20 18:44 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: mingo, tglx, linux-kernel, torvalds

On Tue, 20 Mar 2018 16:50:36 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> > Given that, how about a patch to Documentation/Changes to reflect the new
> > reality?  It's not in RST yet, so you should be able to go there without
> > ill effect :)  
> 
> 
> That thing says:
> 
>   GCC
>   ---
> 
>   The gcc version requirements may vary depending on the type of CPU in your
>   computer. jon
> 
> Which is still entirely accurate. And afaik the 3.2 minimum listed there
> still works for !x86.

Well, other recent discussions established that nothing earlier than 4.1
has been observed to work anywhere for some time.

I guess what we really need is a little table of architecture-specific
minimum GCC versions so that our users actually know what's required.
I'll see if I can find a moment to pull that together at some point.

jon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-20 15:50     ` Peter Zijlstra
  2018-03-20 18:44       ` Jonathan Corbet
@ 2018-03-22 12:10       ` Pavel Machek
  1 sibling, 0 replies; 12+ messages in thread
From: Pavel Machek @ 2018-03-22 12:10 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Jonathan Corbet, mingo, tglx, linux-kernel, torvalds

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On Tue 2018-03-20 16:50:36, Peter Zijlstra wrote:
> On Tue, Mar 20, 2018 at 09:45:54AM -0600, Jonathan Corbet wrote:
> > On Mon, 19 Mar 2018 16:41:25 +0100
> > Peter Zijlstra <peterz@infradead.org> wrote:
> > 
> > > A primary prerequisite for this is of course that the compiler
> > > supports asm-goto. This effecively lifts the minimum GCC version to
> > > build an x86 kernel to gcc-4.5.
> > 
> > Given that, how about a patch to Documentation/Changes to reflect the new
> > reality?  It's not in RST yet, so you should be able to go there without
> > ill effect :)
> 
> 
> That thing says:
> 
>   GCC
>   ---
> 
>   The gcc version requirements may vary depending on the type of CPU in your
>   computer. jon
> 
> Which is still entirely accurate. And afaik the 3.2 minimum listed there
> still works for !x86.

Maybe accurate, but pretty user hostile :-(.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] x86: Force asm-goto
  2018-03-19 20:13     ` Peter Zijlstra
  2018-03-20 10:00       ` [tip:x86/build] " tip-bot for Peter Zijlstra
@ 2018-03-27 16:43       ` Anders Roxell
  1 sibling, 0 replies; 12+ messages in thread
From: Anders Roxell @ 2018-03-27 16:43 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Thomas Gleixner, mingo, linux-kernel, torvalds

On 2018-03-19 21:13, Peter Zijlstra wrote:
> On Mon, Mar 19, 2018 at 08:57:48PM +0100, Thomas Gleixner wrote:
> > On Mon, 19 Mar 2018, Peter Zijlstra wrote:
> > 
> > > We want to start using asm-goto to guarantee the absence of dynamic
> > > branches (and thus speculation).
> > > 
> > > A primary prerequisite for this is of course that the compiler
> > > supports asm-goto. This effecively lifts the minimum GCC version to
> > > build an x86 kernel to gcc-4.5.
> > > 
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > > ---
> > >  Makefile          |   13 +++++++------
> > >  arch/x86/Makefile |    4 ++++
> > >  2 files changed, 11 insertions(+), 6 deletions(-)
> > > 
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
> > >  RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
> > >  export RETPOLINE_CFLAGS
> > >  
> > > +# check for 'asm goto'
> > > +ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
> > 
> > Why are you not using the shell-cached version which you remove further
> > down?
> 
> Bah, I'm an idiot. I fixed that up at least two times, but clearly I
> forgot to check that again before sending.
> 
> ---
> Subject: x86: Force asm-goto
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Wed Jan 17 11:42:07 CET 2018
> 
> We want to start using asm-goto to guarantee the absence of dynamic
> branches (and thus speculation).
> 
> A primary prerequisite for this is of course that the compiler
> supports asm-goto. This effecively lifts the minimum GCC version to
> build an x86 kernel to gcc-4.5.

With this patch applied I'm not able to do "make kernelversion" without
any toolchain to get the kernel version, I was able to do that before.

Cheers,
Anders

> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  Makefile          |   13 +++++++------
>  arch/x86/Makefile |    4 ++++
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex
>  RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
>  export RETPOLINE_CFLAGS
>  
> +# check for 'asm goto'
> +ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
> +  CC_HAVE_ASM_GOTO := 1
> +  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
> +  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
> +endif
> +
>  ifeq ($(config-targets),1)
>  # ===========================================================================
>  # *config targets only - make sure prerequisites are updated, and descend
> @@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -l
>  # Tell gcc to never replace conditional load with a non-conditional one
>  KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
>  
> -# check for 'asm goto'
> -ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
> -	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
> -	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
> -endif
> -
>  include scripts/Makefile.kcov
>  include scripts/Makefile.gcc-plugins
>  
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
>    endif
>  endif
>  
> +ifndef CC_HAVE_ASM_GOTO
> +  $(error Compiler lacks asm-goto support.)
> +endif
> +
>  #
>  # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a
>  # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226).  There's no way

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-03-27 17:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 15:41 [PATCH 0/2] x86: Mandate asm-goto support Peter Zijlstra
2018-03-19 15:41 ` [PATCH 1/2] x86: Force asm-goto Peter Zijlstra
2018-03-19 19:57   ` Thomas Gleixner
2018-03-19 20:13     ` Peter Zijlstra
2018-03-20 10:00       ` [tip:x86/build] " tip-bot for Peter Zijlstra
2018-03-27 16:43       ` [PATCH 1/2] " Anders Roxell
2018-03-20 15:45   ` Jonathan Corbet
2018-03-20 15:50     ` Peter Zijlstra
2018-03-20 18:44       ` Jonathan Corbet
2018-03-22 12:10       ` Pavel Machek
2018-03-19 15:41 ` [PATCH 2/2] x86: Remove FAST_FEATURE_TESTS Peter Zijlstra
2018-03-20 10:01   ` [tip:x86/build] " tip-bot for Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.