Gentoo Archives: gentoo-dev

From: mpagano@g.o
To: gentoo-dev@l.g.o
Cc: Mike Pagano <mpagano@g.o>
Subject: [gentoo-dev] [PATCH v2] Transitional changes to the kernel-2 eclass to support future CPU OPT
Date: Thu, 29 Apr 2021 13:48:32
Message-Id: 20210429134822.41061-1-mpagano@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT by Ulrich Mueller
1 From: Mike Pagano <mpagano@g.o>
2
3 Thanks, Ulm, for the review. I have modified the code as suggested.
4
5 The CPU OPT patch now contains gcc ver checks within
6 the patch itself. This transitional change is to start supporting
7 just that patch while trying not to break the older versions.
8
9 The target state eclass code will *only* need the three line
10 gcc version check. We should be able to slowly remove the
11 legacy code as we stabilize kernels and remove old ones from the tree.
12
13 This will put cpu opt patch support in a much more maintainable state.
14
15
16 Signed-off-by: Mike Pagano <mpagano@g.o>
17 ---
18 eclass/kernel-2.eclass | 29 +++++++++++++++++++++++++++--
19 1 file changed, 27 insertions(+), 2 deletions(-)
20
21 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
22 index 67ad4acc1..f1f23f6a0 100644
23 --- a/eclass/kernel-2.eclass
24 +++ b/eclass/kernel-2.eclass
25 @@ -1241,8 +1241,32 @@ unipatch() {
26 local GCC_MAJOR_VER=$(gcc-major-version)
27 local GCC_MINOR_VER=$(gcc-minor-version)
28
29 - # optimization patch for gcc < 8.X and kernel > 4.13
30 - if kernel_is ge 4 13 ; then
31 + # this section should be the target state to handle the cpu opt
32 + # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
33 + # 5.12.0 and gcc >= 9 The patch now handles the
34 + # gcc version enabled on the system through the Kconfig file as
35 + # 'depends'. The legacy section can hopefully be retired in the future
36 + # Note the patch for 4.19-5.8 version are the same and the patch for
37 + # 5.8+ version is the same
38 + # eventually we can remove everything except the gcc ver <9 check
39 + # based on stablization, time, kernel removals or a combo of all three
40 + if ( kernel_is eq 4 19 && kernel_is gt 4 19 189 ) ||
41 + ( kernel_is eq 5 4 && kernel_is gt 5 4 115 ) ||
42 + ( kernel_is eq 5 10 && kernel_is gt 5 10 33 ) ||
43 + ( kernel_is eq 5 11 && kernel_is gt 5 11 17 ) ||
44 + ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ); then
45 + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
46 + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
47 + UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
48 + UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
49 + UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
50 + if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then
51 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
52 + fi
53 + # this legacy section should be targeted for removal
54 + # optimization patch for gcc < 8.X and kernel > 4.13 and < 4.19
55 + elif kernel_is ge 4 13; then
56 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
57 if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
58 UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
59 UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
60 @@ -1272,6 +1296,7 @@ unipatch() {
61 UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
62 fi
63 else
64 + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
65 UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
66 UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
67 UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
68 --
69 2.26.3

Replies