Skip to contentSkip to conversation

Add Intel Ivy bridge CPU flags

PATCH In review Alec Bickerton 5 participants 7 messages Jan 23, 2013 – Feb 14, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Intel Ivy bridge CPU flags

Hi,

I'd like to submit the attached patch to add Ivy Bridge processor support to the processor type menu in menuconfig. Setting this configures the appropriate CFLAGS (core-avx-i) for ivy bridge.

As this is my first kbuild patch, could somebody review it and let me know what I've done wrong. ;-)

Thanks
Alec.

From 2eaf7717da5b7f753c66e2158d29744aafbc2a0c Mon Sep 17 00:00:00 2001
From: Alec Bickerton <[email protected]>
Date: Mon, 1 Oct 2012 21:12:55 +0200
Subject: [PATCH] Added Ivy bridge to menu

---
 arch/x86/Kconfig.cpu          |    5 +++++
 arch/x86/Makefile             |    5 ++++-
 arch/x86/Makefile_32.cpu      |    1 +
 arch/x86/include/asm/module.h |    2 ++
 4 files changed, 12 insertions(+), 1 deletion(-)
arch/x86/Kconfig.cpu +5 -0
index f3b86d0..e7834c0 100644
@@ -267,6 +267,11 @@ config MCORE2
 	  53xx) CPUs. You can distinguish newer from older Xeons by the CPU
 	  family in /proc/cpuinfo. Newer ones have 6 and older ones 15
 	  (not a typo)
+config MIVYBRIDGE
+    bool "Intel Ivy Bridge"
+    --help--
+    
+      Select this foe Intel 3770K family processors.
 
 config MATOM
 	bool "Intel Atom"
arch/x86/Makefile +4 -1
index 474ca35..e945e58 100644
@@ -61,7 +61,10 @@ else
         cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
 
         cflags-$(CONFIG_MCORE2) += \
-                $(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
+                $(call cc-option,-march=core2,$(call cc-option,-mtune=generic)
+		)
+        cflags-$(CONFIG_MIVYBRIDGE) += \
+                $(call cc-option,-march=core-avx-i,$(call cc-option,-mtune=generic))
 	cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
 		$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
         cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
arch/x86/Makefile_32.cpu +1 -0
index 86cee7b..f5194ff 100644
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)	+= $(call cc-option,-march=c3,-march=i486) $(align)-f
 cflags-$(CONFIG_MVIAC3_2)	+= $(call cc-option,-march=c3-2,-march=i686)
 cflags-$(CONFIG_MVIAC7)		+= -march=i686
 cflags-$(CONFIG_MCORE2)		+= -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE)		+= -march=i686 $(call tune,core-avx-i)
 cflags-$(CONFIG_MATOM)		+= $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \
 	$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
 
arch/x86/include/asm/module.h +2 -0
index 9eae775..758a438 100644
@@ -17,6 +17,8 @@
 #define MODULE_PROC_FAMILY "586MMX "
 #elif defined CONFIG_MCORE2
 #define MODULE_PROC_FAMILY "CORE2 "
+#elif defined CONFIG_MIVYBRIDGE
+#define MODULE_PROC_FAMILY "IVYBRIDGE"
 #elif defined CONFIG_MATOM
 #define MODULE_PROC_FAMILY "ATOM "
 #elif defined CONFIG_M686
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 8 lines · Alec Bickerton

Hi,

I'd like to submit the attached patch to add Ivy Bridge processor support to the processor type menu in menuconfig. Setting this configures the appropriate CFLAGS (core-avx-i) for ivy bridge.

As this is my first kbuild patch, could somebody review it and let me know what I've done wrong. ;-)

You sent it to linux-kbuild instead of [email protected]. The kbuild maintainer is not really knowledgeable about gcc optimisation options ;). Nevertheless, some random comments are below. Note that I am not saying if the config option is useful or not.

Quoted 21 lines

Thanks
Alec.

From 2eaf7717da5b7f753c66e2158d29744aafbc2a0c Mon Sep 17 00:00:00 2001
From: Alec Bickerton <[email protected]>
Date: Mon, 1 Oct 2012 21:12:55 +0200
Subject: [PATCH] Added Ivy bridge to menu

---
 arch/x86/Kconfig.cpu          |    5 +++++
 arch/x86/Makefile             |    5 ++++-
 arch/x86/Makefile_32.cpu      |    1 +
 arch/x86/include/asm/module.h |    2 ++
 4 files changed, 12 insertions(+), 1 deletion(-)
arch/x86/Kconfig.cpu +0 -0
index f3b86d0..e7834c0 100644

arch/x86/Kconfig.cpu config MCORE2 · line 270

Quoted 4 lines
arch/x86/Kconfig.cpu +1 -0
@@ -267,6 +267,11 @@ config MCORE2
 	  53xx) CPUs. You can distinguish newer from older Xeons by the CPU
 	  family in /proc/cpuinfo. Newer ones have 6 and older ones 15
 	  (not a typo)
+config MIVYBRIDGE

Keep the options separate by blank lines.

Quoted 12 lines
arch/x86/Kconfig.cpu +4 -0
+    bool "Intel Ivy Bridge"
+    --help--
+    
+      Select this foe Intel 3770K family processors.
 
 config MATOM
 	bool "Intel Atom"
arch/x86/Makefile +0 -0
index 474ca35..e945e58 100644

arch/x86/Makefile else · line 65

Quoted 6 lines
arch/x86/Makefile +2 -1
@@ -61,7 +61,10 @@ else
         cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
 
         cflags-$(CONFIG_MCORE2) += \
-                $(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
+                $(call cc-option,-march=core2,$(call cc-option,-mtune=generic)
+		)

No need to touch this?

Quoted 22 lines
arch/x86/Makefile +2 -0
+        cflags-$(CONFIG_MIVYBRIDGE) += \
+                $(call cc-option,-march=core-avx-i,$(call cc-option,-mtune=generic))
 	cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
 		$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
         cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
arch/x86/Makefile_32.cpu +1 -0
index 86cee7b..f5194ff 100644
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)	+= $(call cc-option,-march=c3,-march=i486) $(align)-f
 cflags-$(CONFIG_MVIAC3_2)	+= $(call cc-option,-march=c3-2,-march=i686)
 cflags-$(CONFIG_MVIAC7)		+= -march=i686
 cflags-$(CONFIG_MCORE2)		+= -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE)		+= -march=i686 $(call tune,core-avx-i)
 cflags-$(CONFIG_MATOM)		+= $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \
 	$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
 
arch/x86/include/asm/module.h +0 -0
index 9eae775..758a438 100644

arch/x86/include/asm/module.h line 21

Quoted 5 lines
arch/x86/include/asm/module.h +2 -0
@@ -17,6 +17,8 @@
 #define MODULE_PROC_FAMILY "586MMX "
 #elif defined CONFIG_MCORE2
 #define MODULE_PROC_FAMILY "CORE2 "
+#elif defined CONFIG_MIVYBRIDGE
+#define MODULE_PROC_FAMILY "IVYBRIDGE"

Missing trailing space.

Quoted 6 lines
arch/x86/include/asm/module.h +0 -0
 #elif defined CONFIG_MATOM
 #define MODULE_PROC_FAMILY "ATOM "
 #elif defined CONFIG_M686
Signature · 1 line
1.7.10.4

Michal

#2 lore raw
Quoted 7 lines · Michal Marek
Quoted 6 lines · Alec Bickerton

Hi,

I'd like to submit the attached patch to add Ivy Bridge processor support to the processor type menu in menuconfig. Setting this configures the appropriate CFLAGS (core-avx-i) for ivy bridge.

Quoted 7 lines
Quoted 2 lines

As this is my first kbuild patch, could somebody review it and let me know what I've done wrong. ;-)

You sent it to linux-kbuild instead of [email protected]. The kbuild maintainer is not really knowledgeable about gcc optimisation options ;). Nevertheless, some random comments are below. Note that I am not saying if the config option is useful or not.

Normally, such optimizations have a little effect on the kernel because it doesn't normally use fpu stuff and the rest of the instructions we need, we add ourselves (see arch/x86/include/asm/archrandom.h for RDRAND, for example).

So, first we'd need persuasive benchmark numbers which show that a kernel built with core-avx-i is faster at some representative workload than mtune=generic one...

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#3 lore raw
In reply to Alec Bickerton
Quoted 8 lines · Alec Bickerton

Hi,

I'd like to submit the attached patch to add Ivy Bridge processor support to the processor type menu in menuconfig. Setting this configures the appropriate CFLAGS (core-avx-i) for ivy bridge.

As this is my first kbuild patch, could somebody review it and let me know what I've done wrong. ;-)

Like Michal I do not know about x86 - but a few things I noticed.

Quoted 9 lines

Thanks
Alec.

Quoted 1 line

From 2eaf7717da5b7f753c66e2158d29744aafbc2a0c Mon Sep 17 00:00:00 2001

From: Alec Bickerton <[email protected]>
Date: Mon, 1 Oct 2012 21:12:55 +0200
Subject: [PATCH] Added Ivy bridge to menu

Signed-off-by: ... missing.
See Documentation/SubmittingPatches (somethign like that)

arch/x86/Kconfig.cpu config MCORE2 · line 274

Quoted 5 lines
arch/x86/Kconfig.cpu +5 -0
+config MIVYBRIDGE
+    bool "Intel Ivy Bridge"
+    --help--
+    
+      Select this foe Intel 3770K family processors.

Use " help" - in new stuff we try to avoid --help-- Drop empty line between help and help text. Fix your spelling foe => for

arch/x86/Makefile_32.cpu cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align)-f · line 38

Quoted 9 lines
arch/x86/Makefile_32.cpu +1 -0
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)	+= $(call cc-option,-march=c3,-march=i486) $(align)-f
 cflags-$(CONFIG_MVIAC3_2)	+= $(call cc-option,-march=c3-2,-march=i686)
 cflags-$(CONFIG_MVIAC7)		+= -march=i686
 cflags-$(CONFIG_MCORE2)		+= -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE)		+= -march=i686 $(call tune,core-avx-i)
 cflags-$(CONFIG_MATOM)		+= $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \
 	$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))

Not a fault in your patch - but the x86 guys should learn to use the X86_ prefix on x86 specific config symbols :-(
For consistency do not add it.

Sam

#4 lore raw
Quoted 15 lines · Sam Ravnborg

arch/x86/Makefile_32.cpu cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align)-f · line 38

Quoted 10 lines
arch/x86/Makefile_32.cpu +1 -0
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)	+= $(call cc-option,-march=c3,-march=i486) $(align)-f
  cflags-$(CONFIG_MVIAC3_2)	+= $(call cc-option,-march=c3-2,-march=i686)
  cflags-$(CONFIG_MVIAC7)		+= -march=i686
  cflags-$(CONFIG_MCORE2)		+= -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE)		+= -march=i686 $(call tune,core-avx-i)
  cflags-$(CONFIG_MATOM)		+= $(call cc-option,-march=atom,$(call cc-option,-march=core2,-march=i686)) \
  	$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))

Not a fault in your patch - but the x86 guys should learn to use the X86_ prefix on x86 specific config symbols :-(
For consistency do not add it.

These are some of the oldest config symbols in the entire kernel.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#5 lore raw

on 30/01/13 04:34 H. Peter Anvin gazed into the seeing stone and said...:

Quoted 19 lines · Sam Ravnborg
Quoted 17 lines
Quoted 10 lines
arch/x86/Makefile_32.cpu +0 -0
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)    += $(call

cc-option,-march=c3,-march=i486) $(align)-f
cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
cflags-$(CONFIG_MVIAC7) += -march=i686
cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE) += -march=i686 $(call tune,core-avx-i)
cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom,$(call

Quoted 2 lines
cc-option,-march=core2,-march=i686)) \
      $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))

Not a fault in your patch - but the x86 guys should learn to use the X86_ prefix on x86 specific config symbols :-(
For consistency do not add it.

Quoted 4 lines

These are some of the oldest config symbols in the entire kernel.

-hpa

That maybe so, I just want to be able to build an ivy bridge optimised kernel without having to think about it too much. While I don't know how much it'd bring, this is more of a convenience than anything else.

Alec

#6 lore raw
Quoted 20 lines · Alec Bickerton

on 30/01/13 04:34 H. Peter Anvin gazed into the seeing stone and said...:

Quoted 19 lines · Sam Ravnborg
Quoted 17 lines
Quoted 10 lines
arch/x86/Makefile_32.cpu +0 -0
@@ -33,6 +33,7 @@ cflags-$(CONFIG_MCYRIXIII)    += $(call

cc-option,-march=c3,-march=i486) $(align)-f
cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
cflags-$(CONFIG_MVIAC7) += -march=i686
cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)
+cflags-$(CONFIG_MIVYBRIDGE) += -march=i686 $(call tune,core-avx-i)
cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom,$(call

Quoted 2 lines
cc-option,-march=core2,-march=i686)) \
       $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))

Not a fault in your patch - but the x86 guys should learn to use the X86_ prefix on x86 specific config symbols :-(
For consistency do not add it.

Quoted 9 lines
Quoted 4 lines

These are some of the oldest config symbols in the entire kernel.

-hpa

That maybe so, I just want to be able to build an ivy bridge optimised kernel without having to think about it too much. While I don't know how much it'd bring, this is more of a convenience than anything else.

I was referring to the lack of the X86_ prefix on the CONFIG_M* symbols.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.