Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280936

[PATCH 4/4] x86/cpu: Provide a config option to disable static_cpu_has

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject [PATCH 4/4] x86/cpu: Provide a config option to disable static_cpu_has
Date 2015-12-01 16:10 +0100
Message-ID <qAUJ5-2Pr-39@gated-at.bofh.it> (permalink)
References <qAUJ3-2Pr-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Borislav Petkov <bp@suse.de>

This brings .text savings of about ~1.6K when building a tinyconfig. It
is off by default so nothing changes for the default.

Kconfig help text from Josh.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/Kconfig                  | 11 +++++++++++
 arch/x86/include/asm/cpufeature.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index db3622f22b61..a2abc2fb6970 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -349,6 +349,17 @@ 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 144b042c0872..43e144474043 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -409,7 +409,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
  * fast paths and boot_cpu_has() otherwise!
  */
 
-#if __GNUC__ >= 4
+#if __GNUC__ >= 4 && defined(CONFIG_X86_FAST_FEATURE_TESTS)
 extern void warn_pre_alternatives(void);
 extern bool __static_cpu_has_safe(u16 bit);
 
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] x86/cpufeature: Cleanup stuff more Borislav Petkov <bp@alien8.de> - 2015-12-01 16:10 +0100
  [PATCH 1/4] x86/cpufeature: Move some of the scattered feature bits to x86_capability Borislav Petkov <bp@alien8.de> - 2015-12-01 16:10 +0100
  [PATCH 3/4] x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros Borislav Petkov <bp@alien8.de> - 2015-12-01 16:10 +0100
    Re: [PATCH 3/4] x86/cpufeature: Remove unused and seldomly used  cpu_has_xx macros Thomas Gleixner <tglx@linutronix.de> - 2015-12-05 20:00 +0100
      [PATCH -v1.1 3/4] x86/cpufeature: Remove unused and seldomly used  cpu_has_xx macros Borislav Petkov <bp@alien8.de> - 2015-12-06 15:30 +0100
    Re: [PATCH 3/4] x86/cpufeature: Remove unused and seldomly used  cpu_has_xx macros Thomas Gleixner <tglx@linutronix.de> - 2015-12-05 21:10 +0100
      Re: [PATCH 3/4] x86/cpufeature: Remove unused and seldomly used  cpu_has_xx macros Borislav Petkov <bp@alien8.de> - 2015-12-05 21:10 +0100
  [PATCH 2/4] x86/cpufeature: Cleanup get_cpu_cap() Borislav Petkov <bp@alien8.de> - 2015-12-01 16:10 +0100
  [PATCH 4/4] x86/cpu: Provide a config option to disable static_cpu_has Borislav Petkov <bp@alien8.de> - 2015-12-01 16:10 +0100
    Re: [PATCH 4/4] x86/cpu: Provide a config option to disable  static_cpu_has Josh Triplett <josh@joshtriplett.org> - 2015-12-01 17:30 +0100
      Re: [PATCH 4/4] x86/cpu: Provide a config option to disable  static_cpu_has Borislav Petkov <bp@alien8.de> - 2015-12-01 18:00 +0100

csiph-web