View previous topic :: View next topic |
Author |
Message |
emc Guru
Joined: 02 Jul 2004 Posts: 564 Location: Cracow, Poland
|
Posted: Tue Jun 11, 2013 2:51 pm Post subject: Kernel patch for additional CPU for GCC optimizations |
|
|
Really nice patch:
https://github.com/graysky2/kernel_gcc_patch
Kernel patch adds additional CPU options to the Linux kernel accessible under: Processor type and features ---> Processor family --->
Why a specific patch? The kernel uses its own set of CFLAGS, KCFLAGS. For exmaple, see:
arch/x86/Makefile
arch/x86/Makefile_32.cpu
arch/x86/Kconfig.cpu
CPU Family/GCC Optimization:
Native optimizations autodetected by GCC
-march=native
AMD K10-family
-march=amdfam10
AMD Family 10h (Barcelona)
-march=barcelona
AMD Family 14h (Bobcat)
-march=brver1
AMD Family 15h (Bulldozer)
-march=bdver1
Piledriver Family 15h (Piledriver)
-march=bdver2
Intel 1st Gen Core i3/i5/i7-family (Nehalem)
-march=corei7
Intel 2nd Gen Core i3/i5/i7-family (Sandybridge)
-march=corei7-avx
Intel 3rd Gen Core i3/i5/i7-family (Ivybridge)
-march=core-avx-i
Intel 4th Gen Core i3/i5/i7-family (Haswell)
-march=core-avx2 |
|
Back to top |
|
|
trippels Tux's lil' helper
Joined: 24 Nov 2010 Posts: 137 Location: Berlin
|
Posted: Fri Jun 14, 2013 9:31 am Post subject: |
|
|
Yeah. I've been using the following on my k10 for ages:
Code: |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5c47726..748e5c8 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -61,7 +61,7 @@ else
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)
# FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
- cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
+ cflags-$(CONFIG_MK8) += $(call cc-option,-march=native)
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
cflags-$(CONFIG_MCORE2) += \
|
|
|
Back to top |
|
|
vexatious Tux's lil' helper
Joined: 24 Aug 2010 Posts: 85
|
Posted: Wed Jun 19, 2013 12:00 am Post subject: |
|
|
Do you know how to contact the maintainer (graysky2)? Wondering if a custom cpu option could be added (use custom cflags). This would be beneficial for modules that require msseregparm (it is recommended to compile all libraries and modules with msseregparm if anything uses msseregparm); mfpmath might improve speed too. _________________ Gentoo
Slackware |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Thu Jun 20, 2013 10:15 am Post subject: |
|
|
vexatious wrote: | Do you know how to contact the maintainer (graysky2)? |
Look at the Arch Linux forums. |
|
Back to top |
|
|
olutyo n00b
Joined: 20 Jun 2013 Posts: 2
|
Posted: Tue Jul 02, 2013 12:06 am Post subject: |
|
|
Thank you very much
Finally you can configure the kernel characteristics |
|
Back to top |
|
|
GFCCAE6xF Apprentice
Joined: 06 Aug 2012 Posts: 295
|
Posted: Tue Jul 30, 2013 1:40 pm Post subject: |
|
|
Just got round to trying this, certainly works (and is worth it) even if the returns are so small. Only bad thing is now I shall have to move pf-sources back in to my local and keep things going in there rather then clutter up and forget /etc/portage/patches/* since that's somewhat an obscure place for package patches imo.
This patch(es) would be extra nice as an, even masked, custom-optimizations flag or similar.
Edit: Loosing my mind, corrections ahoy |
|
Back to top |
|
|
smartass Apprentice
Joined: 04 Jul 2011 Posts: 189 Location: right behind you ... (you did turn around, didn't you?)
|
Posted: Tue Jul 30, 2013 4:01 pm Post subject: |
|
|
Sounds like ricing, if it was safe, wouldn't it be the standard procedure? I can easily imagine a poorly written driver to fail with some optimizations. |
|
Back to top |
|
|
broken_chaos Guru
Joined: 18 Jan 2006 Posts: 370 Location: Ontario, Canada
|
Posted: Wed Jul 31, 2013 12:19 am Post subject: |
|
|
smartass wrote: | Sounds like ricing, if it was safe, wouldn't it be the standard procedure? I can easily imagine a poorly written driver to fail with some optimizations. |
All it changes is the march option. It's completely safe, as it only adjusts the features GCC compiles for compatibility with (sse, avx, and similar), so barring some hardware problem with those features (i.e., a processor reporting it supports AVX when it doesn't, which happens under xen sometimes -- and is just as much of a problem for the march in make.conf which is considered safe), there's no danger at all.
The kernel developers are just a bit weird about what gcc optimizations they've set to be configured. (Partly because a lot of the 'major' CPU features are detected and enabled in the kernel code itself, rather than via GCC.) |
|
Back to top |
|
|
smartass Apprentice
Joined: 04 Jul 2011 Posts: 189 Location: right behind you ... (you did turn around, didn't you?)
|
Posted: Thu Aug 01, 2013 7:45 am Post subject: |
|
|
broken_chaos, your arguments do make sense, but I'd still like to see some real evidence or an opinion of a kernel developer. |
|
Back to top |
|
|
okias n00b
Joined: 03 Jul 2007 Posts: 17 Location: Czech Republic
|
Posted: Sun Dec 08, 2013 3:23 am Post subject: |
|
|
I plan include this patch in mptcp-sources, because it seems totally safe.
Maybe it could be added to gentoo-sources with experimental USE flag enabled? |
|
Back to top |
|
|
BartNL n00b
Joined: 29 Aug 2004 Posts: 65
|
Posted: Wed Mar 05, 2014 12:16 pm Post subject: |
|
|
Sorry for bumping up an old topic. How do i install the patch? Can i only apply it to gentoo-sources? |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Wed Mar 05, 2014 2:42 pm Post subject: |
|
|
add:
Code: | sys-kernel/gentoo-sources experimental |
In your use flags files. |
|
Back to top |
|
|
BartNL n00b
Joined: 29 Aug 2004 Posts: 65
|
Posted: Wed Mar 05, 2014 5:53 pm Post subject: |
|
|
SirRobin2318 wrote: | add:
Code: | sys-kernel/gentoo-sources experimental |
In your use flags files. |
Thank you. I added that to package.use, re-emerged gentoo-sources and did a make oldconfig. The only thing that came up was BFQ-scheduler. I also tried make distclean but no extra processor types showed up. |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Wed Mar 05, 2014 8:21 pm Post subject: |
|
|
in make menuconfig
Code: | Processor type and features --->
Processor family (...) ---> |
you don't see Native optimizations autodetected by GCC?
https://wiki.gentoo.org/wiki/Project:Kernel/Experimental
The patch is listed, and I'm using it. What version are you using?
Have you selected the latest installed kernel in:
Code: | eselect kernel list |
|
|
Back to top |
|
|
BartNL n00b
Joined: 29 Aug 2004 Posts: 65
|
Posted: Wed Mar 05, 2014 9:16 pm Post subject: |
|
|
SirRobin2318 wrote: | in make menuconfig
Code: | Processor type and features --->
Processor family (...) ---> |
you don't see Native optimizations autodetected by GCC?
https://wiki.gentoo.org/wiki/Project:Kernel/Experimental
The patch is listed, and I'm using it. What version are you using?
Have you selected the latest installed kernel in:
Code: | eselect kernel list |
|
My kernel :
Code: |
gbox ~ # eselect kernel list
Available kernel symlink targets:
[1] linux-3.10.25-gentoo
|
I see only: generic, intel atom, core2, intel p4 and opteron. Very strange. |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Wed Mar 05, 2014 10:32 pm Post subject: |
|
|
Check if the experimental flags are enabled using emerge -1av gentoo-sources.
If that's the case maybe it's available for newer kernels only, I'm using 3.13.5. But I find this strange, I thought I used this with 3.10. |
|
Back to top |
|
|
BartNL n00b
Joined: 29 Aug 2004 Posts: 65
|
Posted: Wed Mar 05, 2014 10:53 pm Post subject: |
|
|
SirRobin2318 wrote: | Check if the experimental flags are enabled using emerge -1av gentoo-sources.
If that's the case maybe it's available for newer kernels only, I'm using 3.13.5. But I find this strange, I thought I used this with 3.10. |
Confirm. Are you using gentoo-sources unstable? I did ab emerge --sync before i installed experimental. |
|
Back to top |
|
|
SirRobin2318 Apprentice
Joined: 24 Apr 2004 Posts: 241 Location: Strasbourg, france.
|
Posted: Wed Mar 05, 2014 11:02 pm Post subject: |
|
|
Yes, I am. Does emerge -1av gentoo-sources not mention the experimental flag? If it does, you should consider using 3.13.x. |
|
Back to top |
|
|
|