Gentoo Archives: gentoo-dev

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