tuning options for PPC64
cover tuning options for PPC64
Hi,
this is my second attempt to introduce some tuning options for PPC64. These patches are much less invasive as the previous patchset.
Because the power cpus seem to have various features I don't know/understand I didn't touch any feature flags/config options this time, but focused only on the compiler flags.
Nevertheless feature flags and cleanups can be added later based on the cpu selection as Milton suggested. I will try this if these patches receive a "GO!".
Also, as Arndt suggested, I used separate mcpu and mtune options but didn't force the user to use it.
As always, comments are welcome.
Greetings
Marvin
PATCH 1/2 add tuning options to Kconfig.cputype
This patch adds CPU selection to Kconfig.cputype. I did my best to make oldconfig happy, but some things just don't work ;-) Maybe more CPUs and help texts can be added, but it should be enough for now.
Subject: [PATCH 1/2] [PPC64] add tuning options to Kconfig.cputype
--- arch/powerpc/platforms/Kconfig.cputype | 133 ++++++++++++++++++++++++++++--- 1 files changed, 120 insertions(+), 13 deletions(-)
arch/powerpc/platforms/Kconfig.cputype +120 -13
@@ -56,8 +56,127 @@ config E200 endchoice +config TUNE_OPT_CPU + depends on PPC64 + def_bool n + prompt "Tune/optimize for a specific CPU" + help + This option enables a sub-menu where you can choose a certain + CPU to tune (via -mtune) or optimize (via -mcpu) for. + +choice + depends on TUNE_OPT_CPU + prompt "Choose the CPU to tune for" + default TUNE_POWER4 + help + Choosing this will make the code run faster on the selected CPU, + but somehow slower on others. + + This option only changes the scheduling of instructions, not the + selection of instructions itself, so the resulting kernel will keep + running on all other machines. + + The default is to tune for power4. + +config TUNE_RS64 + bool "RS64" + +config TUNE_POWER3 + bool "POWER3" + +config TUNE_POWER4 + bool "POWER4/G5/970" + help + Cause the compiler to tune for the POWER4 and derivates CPUS, like + G5 and other PPC970 variants. + +config TUNE_POWER5 + bool "POWER5" + +config TUNE_POWER6 + bool "POWER6" + +config TUNE_CELL + bool "Cell Broadband Engine" + help + Cause the compiler to optimize for the PPE of the Cell Broadband + Engine. This will make the code run considerably faster on Cell + but somewhat slower on other machines. This option only changes + the scheduling of instructions, not the selection of instructions + itself, so the resulting kernel will keep running on all other + machines. + +endchoice + +choice + depends on TUNE_OPT_CPU + default OPT_NONE + prompt "Choose the CPU to optimize for" + help + Choosing this will make the code run significant faster on the + selected CPU by selecting the scheduling and the instruction set + for the specific CPU. It will propably not run on earlier gernerations + but should run on newer ones. + + The default is not to optimize for a specific CPU. + +config OPT_NONE + bool "none" + +config OPT_RS64 + bool "RS64" + +config OPT_POWER3 + bool "POWER3" + select POWER3 + +config OPT_POWER4 + bool "POWER4" + select POWER4_ONLY + ---help--- + Cause the compiler to optimize for POWER4 processors. The resulting + binary will not work on POWER3 or RS64 processors when compiled + with binutils 2.15 or later. + +config OPT_PPC970 + bool "G5/PPC970" + select POWER4_ONLY + +config OPT_POWER5 + bool "POWER5" + select POWER4_ONLY + +config OPT_POWER6 + bool "POWER6" + select POWER4_ONLY + +endchoice + +config OPT_CPU + depends on PPC64 + string + default "rs64" if OPT_RS64 + default "power3" if OPT_POWER3 + default "power4" if OPT_POWER4 + default "970" if OPT_PPC970 + default "power5" if OPT_POWER5 + default "power6" if OPT_POWER6 + default "cell" if OPT_CELL + default "" + +config TUNE_CPU + depends on PPC64 + string + default "rs64" if TUNE_RS64 + default "power3" if TUNE_POWER3 + default "power5" if TUNE_POWER5 + default "power6" if TUNE_POWER6 + default "cell" if TUNE_CELL + default "power4" + config POWER4_ONLY - bool "Optimize for POWER4" + bool + prompt "Optimize for POWER4" if !TUNE_OPT_CPU depends on PPC64 default n ---help---
@@ -74,18 +193,6 @@ config POWER4 depends on PPC64 def_bool y -config TUNE_CELL - bool "Optimize for Cell Broadband Engine" - depends on PPC64 - help - Cause the compiler to optimize for the PPE of the Cell Broadband - Engine. This will make the code run considerably faster on Cell - but somewhat slower on other machines. This option only changes - the scheduling of instructions, not the selection of instructions - itself, so the resulting kernel will keep running on all other - machines. When building a kernel that is supposed to run only - on Cell, you should also select the POWER4_ONLY option. - # this is temp to handle compat with arch=ppc config 8xx bool
Signature · 1 line
1.5.6.2
PATCH 2/2 change powerpc Makefile to use the new tuning options
In reply to MarvinThis patch modifies the Makefile to use the new tuning options. Most of the work
is done in Kconfig now, so this looks a little bit more clearly (except the broken altivec hack).
Subject: [PATCH 2/2] [PPC64] change powerpc Makefile to use the new tuning options
--- arch/powerpc/Makefile | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-)
arch/powerpc/Makefile +1 -1
@@ -75,29 +75,15 @@ CPP = $(CC) -E $(KBUILD_CFLAGS) CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ ifeq ($(CONFIG_PPC64),y) -GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y";
fi)
-
-ifeq ($(CONFIG_POWER4_ONLY),y)
-ifeq ($(CONFIG_ALTIVEC),y)
-ifeq ($(GCC_BROKEN_VEC),y)
- KBUILD_CFLAGS += $(call cc-option,-mcpu=970)
-else
- KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-endif
-else
- KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-endif
-else
- KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
-endif
+KBUILD_CFLAGS += $(call cc-option, -mcpu=$(CONFIG_OPT_CPU) ) +KBUILD_CFLAGS += $(call cc-option, -mtune=$(CONFIG_TUNE_CPU) ) +ifeq ($(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi),y)
+ KBUILD_CFLAGS := $(subst mcpu=970,mcpu=power4,$(KBUILD_CFLAGS))
+endif
else
LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
endif
-ifeq ($(CONFIG_TUNE_CELL),y)
- KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
-endif
-
# No AltiVec instruction when building kernel
KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
Signature · 1 line
1.5.6.2