Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.7 commit in: /
Date: Mon, 29 Jun 2020 17:32:27
Message-Id: 1593451914.d4662d3ac3d6470f051a0923b24deeced928878a.mpagano@gentoo
1 commit: d4662d3ac3d6470f051a0923b24deeced928878a
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jun 29 17:31:54 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 29 17:31:54 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=d4662d3a
7
8 Update CPU optimization patch for gcc 9.1+
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 5012_enable-cpu-optimizations-for-gcc91.patch | 51 ++++++++++++++++-----------
13 1 file changed, 30 insertions(+), 21 deletions(-)
14
15 diff --git a/5012_enable-cpu-optimizations-for-gcc91.patch b/5012_enable-cpu-optimizations-for-gcc91.patch
16 index 049ec12..2f16153 100644
17 --- a/5012_enable-cpu-optimizations-for-gcc91.patch
18 +++ b/5012_enable-cpu-optimizations-for-gcc91.patch
19 @@ -42,14 +42,18 @@ It also offers to compile passing the 'native' option which, "selects the CPU
20 to generate code for at compilation time by determining the processor type of
21 the compiling machine. Using -march=native enables all instruction subsets
22 supported by the local machine and will produce code optimized for the local
23 -machine under the constraints of the selected instruction set."[3]
24 +machine under the constraints of the selected instruction set."[2]
25 +
26 +Do NOT try using the 'native' option on AMD Piledriver, Steamroller, or
27 +Excavator CPUs (-march=bdver{2,3,4} flag). The build will error out due the
28 +kernel's objtool issue with these.[3a,b]
29
30 MINOR NOTES
31 This patch also changes 'atom' to 'bonnell' in accordance with the gcc v4.9
32 changes. Note that upstream is using the deprecated 'match=atom' flags when I
33 -believe it should use the newer 'march=bonnell' flag for atom processors.[2]
34 +believe it should use the newer 'march=bonnell' flag for atom processors.[4]
35
36 -It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The
37 +It is not recommended to compile on Atom-CPUs with the 'native' option.[5] The
38 recommendation is to use the 'atom' option instead.
39
40 BENEFITS
41 @@ -61,21 +65,23 @@ https://github.com/graysky2/kernel_gcc_patch
42
43 REQUIREMENTS
44 linux version >=5.7
45 -gcc version >=9.1
46 +gcc version >=9.1 and <10
47
48 ACKNOWLEDGMENTS
49 -This patch builds on the seminal work by Jeroen.[5]
50 +This patch builds on the seminal work by Jeroen.[6]
51
52 REFERENCES
53 -1. https://gcc.gnu.org/gcc-4.9/changes.html
54 -2. https://bugzilla.kernel.org/show_bug.cgi?id=77461
55 -3. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
56 -4. https://github.com/graysky2/kernel_gcc_patch/issues/15
57 -5. http://www.linuxforge.net/docs/linux/linux-gcc.php
58 +1. https://gcc.gnu.org/gcc-4.9/changes.html
59 +2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
60 +3a. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c11
61 +3b. https://github.com/graysky2/kernel_gcc_patch/issues/55
62 +4. https://bugzilla.kernel.org/show_bug.cgi?id=77461
63 +5. https://github.com/graysky2/kernel_gcc_patch/issues/15
64 +6. http://www.linuxforge.net/docs/linux/linux-gcc.php
65
66 ---- a/arch/x86/include/asm/vermagic.h 2019-12-15 18:16:08.000000000 -0500
67 -+++ b/arch/x86/include/asm/vermagic.h 2019-12-17 14:03:55.968871551 -0500
68 -@@ -27,6 +27,36 @@ struct mod_arch_specific {
69 +--- a/arch/x86/include/asm/vermagic.h 2020-06-10 14:21:45.000000000 -0400
70 ++++ b/arch/x86/include/asm/vermagic.h 2020-06-15 10:44:10.437477053 -0400
71 +@@ -17,6 +17,36 @@
72 #define MODULE_PROC_FAMILY "586MMX "
73 #elif defined CONFIG_MCORE2
74 #define MODULE_PROC_FAMILY "CORE2 "
75 @@ -112,7 +118,7 @@ REFERENCES
76 #elif defined CONFIG_MATOM
77 #define MODULE_PROC_FAMILY "ATOM "
78 #elif defined CONFIG_M686
79 -@@ -45,6 +75,28 @@ struct mod_arch_specific {
80 +@@ -35,6 +65,28 @@
81 #define MODULE_PROC_FAMILY "K7 "
82 #elif defined CONFIG_MK8
83 #define MODULE_PROC_FAMILY "K8 "
84 @@ -141,8 +147,8 @@ REFERENCES
85 #elif defined CONFIG_MELAN
86 #define MODULE_PROC_FAMILY "ELAN "
87 #elif defined CONFIG_MCRUSOE
88 ---- a/arch/x86/Kconfig.cpu 2019-12-15 18:16:08.000000000 -0500
89 -+++ b/arch/x86/Kconfig.cpu 2019-12-17 14:09:03.805642284 -0500
90 +--- a/arch/x86/Kconfig.cpu 2020-06-10 14:21:45.000000000 -0400
91 ++++ b/arch/x86/Kconfig.cpu 2020-06-15 10:44:10.437477053 -0400
92 @@ -123,6 +123,7 @@ config MPENTIUMM
93 config MPENTIUM4
94 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"
95 @@ -524,9 +530,9 @@ REFERENCES
96
97 config X86_MINIMUM_CPU_FAMILY
98 int
99 ---- a/arch/x86/Makefile 2019-12-15 18:16:08.000000000 -0500
100 -+++ b/arch/x86/Makefile 2019-12-17 14:03:55.972204960 -0500
101 -@@ -119,13 +119,53 @@ else
102 +--- a/arch/x86/Makefile 2020-06-10 14:21:45.000000000 -0400
103 ++++ b/arch/x86/Makefile 2020-06-15 10:44:35.608035680 -0400
104 +@@ -119,13 +119,56 @@ else
105 KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
106
107 # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
108 @@ -539,8 +545,11 @@ REFERENCES
109 + cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2)
110 + cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1)
111 + cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2)
112 ++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-mno-tbm)
113 + cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3)
114 ++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-mno-tbm)
115 + cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4)
116 ++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-mno-tbm)
117 + cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1)
118 + cflags-$(CONFIG_MZEN2) += $(call cc-option,-march=znver2)
119 cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
120 @@ -583,8 +592,8 @@ REFERENCES
121 cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
122 KBUILD_CFLAGS += $(cflags-y)
123
124 ---- a/arch/x86/Makefile_32.cpu 2019-12-15 18:16:08.000000000 -0500
125 -+++ b/arch/x86/Makefile_32.cpu 2019-12-17 14:03:55.972204960 -0500
126 +--- a/arch/x86/Makefile_32.cpu 2020-06-10 14:21:45.000000000 -0400
127 ++++ b/arch/x86/Makefile_32.cpu 2020-06-15 10:44:10.437477053 -0400
128 @@ -24,7 +24,19 @@ cflags-$(CONFIG_MK6) += -march=k6
129 # Please note, that patches that add -march=athlon-xp and friends are pointless.
130 # They make zero difference whatsosever to performance at this time.