* [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT
@ 2021-04-29 11:44 mpagano
2021-04-29 12:59 ` Ulrich Mueller
0 siblings, 1 reply; 4+ messages in thread
From: mpagano @ 2021-04-29 11:44 UTC (permalink / raw
To: gentoo-dev; +Cc: Mike Pagano
From: Mike Pagano <mpagano@gentoo.org>
The CPU OPT patch now contains gcc ver checks within
the patch itself. This transitional change is to start supporting
just that patch while trying not to break the older versions.
The target state eclass code will *only* need the three line
gcc version check. We should be able to slowly remove the
legacy code as we stabilize kernels and remove old ones from the tree.
This will put cpu opt patch support in a much more maintainable state.
---
eclass/kernel-2.eclass | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 67ad4acc1..f676e8421 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1241,8 +1241,32 @@ unipatch() {
local GCC_MAJOR_VER=$(gcc-major-version)
local GCC_MINOR_VER=$(gcc-minor-version)
- # optimization patch for gcc < 8.X and kernel > 4.13
- if kernel_is ge 4 13 ; then
+ # this section should be the target state to handle the cpu opt
+ # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
+ # 5.12.0 and gcc >= 9 The patch now handles the
+ # gcc version enabled on the system through the Kconfig file as
+ # 'depends'. The legacy section can hopefully be retired in the future
+ # Note the patch for 4.19-5.8 version are the same and the patch for
+ # 5.8+ version is the same
+ # eventually we can remove everything except the gcc ver <9 check
+ # based on stablization, time, kernel removals or a combo of all three
+ if ((kernel_is eq 4 19 && kernel_is gt 4 19 189) ||
+ (kernel_is eq 5 4 && kernel_is gt 5 4 115) ||
+ (kernel_is eq 5 10 && kernel_is gt 5 10 33) ||
+ (kernel_is eq 5 11 && kernel_is gt 5 11 17) ||
+ (kernel_is eq 5 12 && kernel_is gt 5 12 0)); then
+ UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
+ UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
+ UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
+ UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
+ UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
+ if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
+ fi
+ # this legacy section should be targeted for removal
+ # optimization patch for gcc < 8.X and kernel > 4.13 and < 4.19
+ elif kernel_is ge 4 13; then
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
@@ -1272,6 +1296,7 @@ unipatch() {
UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
fi
else
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
--
2.26.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT
2021-04-29 11:44 [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT mpagano
@ 2021-04-29 12:59 ` Ulrich Mueller
2021-04-29 13:48 ` [gentoo-dev] [PATCH v2] " mpagano
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Mueller @ 2021-04-29 12:59 UTC (permalink / raw
To: mpagano; +Cc: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]
>>>>> On Thu, 29 Apr 2021, mpagano wrote:
> --- a/eclass/kernel-2.eclass
> +++ b/eclass/kernel-2.eclass
> @@ -1241,8 +1241,32 @@ unipatch() {
> local GCC_MAJOR_VER=$(gcc-major-version)
> local GCC_MINOR_VER=$(gcc-minor-version)
>
> - # optimization patch for gcc < 8.X and kernel > 4.13
> - if kernel_is ge 4 13 ; then
> + # this section should be the target state to handle the cpu opt
> + # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
> + # 5.12.0 and gcc >= 9 The patch now handles the
> + # gcc version enabled on the system through the Kconfig file as
> + # 'depends'. The legacy section can hopefully be retired in the future
> + # Note the patch for 4.19-5.8 version are the same and the patch for
> + # 5.8+ version is the same
> + # eventually we can remove everything except the gcc ver <9 check
> + # based on stablization, time, kernel removals or a combo of all three
> + if ((kernel_is eq 4 19 && kernel_is gt 4 19 189) ||
> + (kernel_is eq 5 4 && kernel_is gt 5 4 115) ||
> + (kernel_is eq 5 10 && kernel_is gt 5 10 33) ||
> + (kernel_is eq 5 11 && kernel_is gt 5 11 17) ||
> + (kernel_is eq 5 12 && kernel_is gt 5 12 0)); then
Looks like the outermost pair of parentheses ( ) isn't needed here.
Also, when writing nested parentheses without a space, bash may
sometimes (but not always!) interpret them as an arithmetic expression.
This can cause unexpected results:
$ ((true) && (true)); echo $?
0
$ ( (true && true) ); echo $?
0
$ ((true && true)); echo $?
1
$ true=42
$ ((true && true)); echo $?
0
> [...]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-dev] [PATCH v2] Transitional changes to the kernel-2 eclass to support future CPU OPT
2021-04-29 12:59 ` Ulrich Mueller
@ 2021-04-29 13:48 ` mpagano
2021-04-30 18:21 ` Mike Pagano
0 siblings, 1 reply; 4+ messages in thread
From: mpagano @ 2021-04-29 13:48 UTC (permalink / raw
To: gentoo-dev; +Cc: Mike Pagano
From: Mike Pagano <mpagano@gentoo.org>
Thanks, Ulm, for the review. I have modified the code as suggested.
The CPU OPT patch now contains gcc ver checks within
the patch itself. This transitional change is to start supporting
just that patch while trying not to break the older versions.
The target state eclass code will *only* need the three line
gcc version check. We should be able to slowly remove the
legacy code as we stabilize kernels and remove old ones from the tree.
This will put cpu opt patch support in a much more maintainable state.
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
eclass/kernel-2.eclass | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 67ad4acc1..f1f23f6a0 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1241,8 +1241,32 @@ unipatch() {
local GCC_MAJOR_VER=$(gcc-major-version)
local GCC_MINOR_VER=$(gcc-minor-version)
- # optimization patch for gcc < 8.X and kernel > 4.13
- if kernel_is ge 4 13 ; then
+ # this section should be the target state to handle the cpu opt
+ # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
+ # 5.12.0 and gcc >= 9 The patch now handles the
+ # gcc version enabled on the system through the Kconfig file as
+ # 'depends'. The legacy section can hopefully be retired in the future
+ # Note the patch for 4.19-5.8 version are the same and the patch for
+ # 5.8+ version is the same
+ # eventually we can remove everything except the gcc ver <9 check
+ # based on stablization, time, kernel removals or a combo of all three
+ if ( kernel_is eq 4 19 && kernel_is gt 4 19 189 ) ||
+ ( kernel_is eq 5 4 && kernel_is gt 5 4 115 ) ||
+ ( kernel_is eq 5 10 && kernel_is gt 5 10 33 ) ||
+ ( kernel_is eq 5 11 && kernel_is gt 5 11 17 ) ||
+ ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ); then
+ UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
+ UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
+ UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
+ UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
+ UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
+ if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
+ fi
+ # this legacy section should be targeted for removal
+ # optimization patch for gcc < 8.X and kernel > 4.13 and < 4.19
+ elif kernel_is ge 4 13; then
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
@@ -1272,6 +1296,7 @@ unipatch() {
UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
fi
else
+ UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
--
2.26.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-dev] [PATCH v2] Transitional changes to the kernel-2 eclass to support future CPU OPT
2021-04-29 13:48 ` [gentoo-dev] [PATCH v2] " mpagano
@ 2021-04-30 18:21 ` Mike Pagano
0 siblings, 0 replies; 4+ messages in thread
From: Mike Pagano @ 2021-04-30 18:21 UTC (permalink / raw
To: gentoo-dev
On 4/29/21 9:48 AM, mpagano@gentoo.org wrote:
> From: Mike Pagano <mpagano@gentoo.org>
>
> Thanks, Ulm, for the review. I have modified the code as suggested.
>
> The CPU OPT patch now contains gcc ver checks within
> the patch itself. This transitional change is to start supporting
> just that patch while trying not to break the older versions.
>
> The target state eclass code will *only* need the three line
> gcc version check. We should be able to slowly remove the
> legacy code as we stabilize kernels and remove old ones from the tree.
>
> This will put cpu opt patch support in a much more maintainable state.
>
>
> Signed-off-by: Mike Pagano <mpagano@gentoo.org>
> ---
> eclass/kernel-2.eclass | 29 +++++++++++++++++++++++++++--
> 1 file changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
> index 67ad4acc1..f1f23f6a0 100644
> --- a/eclass/kernel-2.eclass
> +++ b/eclass/kernel-2.eclass
> @@ -1241,8 +1241,32 @@ unipatch() {
> local GCC_MAJOR_VER=$(gcc-major-version)
> local GCC_MINOR_VER=$(gcc-minor-version)
>
> - # optimization patch for gcc < 8.X and kernel > 4.13
> - if kernel_is ge 4 13 ; then
> + # this section should be the target state to handle the cpu opt
> + # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 5.11.17,
> + # 5.12.0 and gcc >= 9 The patch now handles the
> + # gcc version enabled on the system through the Kconfig file as
> + # 'depends'. The legacy section can hopefully be retired in the future
> + # Note the patch for 4.19-5.8 version are the same and the patch for
> + # 5.8+ version is the same
> + # eventually we can remove everything except the gcc ver <9 check
> + # based on stablization, time, kernel removals or a combo of all three
> + if ( kernel_is eq 4 19 && kernel_is gt 4 19 189 ) ||
> + ( kernel_is eq 5 4 && kernel_is gt 5 4 115 ) ||
> + ( kernel_is eq 5 10 && kernel_is gt 5 10 33 ) ||
> + ( kernel_is eq 5 11 && kernel_is gt 5 11 17 ) ||
> + ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ); then
> + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
> + UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
> + UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
> + UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
> + UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
> + if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then
> + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
> + fi
> + # this legacy section should be targeted for removal
> + # optimization patch for gcc < 8.X and kernel > 4.13 and < 4.19
> + elif kernel_is ge 4 13; then
> + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
> if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ ${GCC_MAJOR_VER} -gt 4 ]]; then
> UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
> UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
> @@ -1272,6 +1296,7 @@ unipatch() {
> UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch"
> fi
> else
> + UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
> UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc.patch"
> UNIPATCH_DROP+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
> UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
>
This has been committed
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-30 18:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-29 11:44 [gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT mpagano
2021-04-29 12:59 ` Ulrich Mueller
2021-04-29 13:48 ` [gentoo-dev] [PATCH v2] " mpagano
2021-04-30 18:21 ` Mike Pagano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox