build: fix meson binutils workaround
PATCH 1/2 build: fix meson binutils workaround
The '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim 'march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'
---
Cc: [email protected]
--- config/x86/meson.build | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
config/x86/meson.build +7 -10
@@ -1,15 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -# for checking defines we need to use the correct compiler flags -march_opt = ['-march=@0@'.format(machine)] - # get binutils version for the workaround of Bug 97 if host_machine.system() != 'windows' ldver = run_command('ld', '-v').stdout().strip() if ldver.contains('2.30') if cc.has_argument('-mno-avx512f') - march_opt += '-mno-avx512f' + machine_args += '-mno-avx512f' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif
@@ -19,7 +16,7 @@ endif sse_errormsg = '''SSE4.2 instruction set is required for DPDK. Please set the machine type to "nehalem" or "corei7" or higher value''' -if cc.get_define('__SSE4_2__', args: march_opt) == '' +if cc.get_define('__SSE4_2__', args: machine_args) == '' error(sse_errormsg) endif
@@ -38,23 +35,23 @@ else dpdk_conf.set('RTE_ARCH', 'i686') endif -if cc.get_define('__AES__', args: march_opt) != '' +if cc.get_define('__AES__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AES'] endif -if cc.get_define('__PCLMUL__', args: march_opt) != '' +if cc.get_define('__PCLMUL__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1) compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ'] endif -if cc.get_define('__AVX__', args: march_opt) != '' +if cc.get_define('__AVX__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX'] endif -if cc.get_define('__AVX2__', args: march_opt) != '' +if cc.get_define('__AVX2__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX2'] endif -if cc.get_define('__AVX512F__', args: march_opt) != '' +if cc.get_define('__AVX512F__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX512F'] endif
Signature · 1 line
2.20.1
PATCH 2/2 build: fix crash by disabling AVX512 with binutils 2.31
On Skylake platform, with native build, KNI kernel module crashes because of the corrupted values passed to kernel module.
The corruption occurs because the userspace kni library works unexpectedly. Compiler [1] is using AVX512 instructions and generated binary is wrong [2].
It turned around gcc does its job correct, but gas is generating binary wrong. And expected binutils 2.30, 2.31 & 2.31.1 are affected. Issue has been fixed in binutils 2.32 with:
Commit x86: don't mistakenly scale non-8-bit displacements
AVX512 was already disabled with bintuils 2.30 [3], extending it to 2.31 & 2.31.1 too.
[1] gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
[2] gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
[3] Bugzilla ID 97 has the details.
Bugzilla ID: 249
Cc: [email protected]
--- config/x86/meson.build | 6 ++++++ mk/toolchain/gcc/rte.toolchain-compat.mk | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
config/x86/meson.build +6 -0
@@ -10,6 +10,12 @@ if host_machine.system() != 'windows' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif + if ldver.contains('2.31') + if cc.has_argument('-mno-avx512f') + machine_args += '-mno-avx512f' + message('Binutils 2.31 detected, disabling AVX512 support as workaround for bug #249') + endif + endif endif # we require SSE4.2 for DPDK
mk/toolchain/gcc/rte.toolchain-compat.mk +8 -1
@@ -27,7 +27,14 @@ ifneq ($(filter 2.30%,$(LD_VERSION)),) FORCE_DISABLE_AVX512 := y # print warning only once for librte_eal ifneq ($(filter %librte_eal,$(CURDIR)),) -$(warning AVX512 support disabled because of ld 2.30. See Bug 97) +$(warning AVX512 support disabled because of binutils 2.30. See Bug 97) +endif +endif +ifneq ($(filter 2.31%,$(LD_VERSION)),) +FORCE_DISABLE_AVX512 := y +# print warning only once for librte_eal +ifneq ($(filter %librte_eal,$(CURDIR)),) +$(warning AVX512 support disabled because of binutils 2.31. See Bug 249) endif endif endif
Signature · 1 line
2.20.1
PATCH v2 1/2 build: fix meson binutils workaround
In reply to Ferruh YigitThe '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim 'march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'
---
Cc: [email protected]
--- config/x86/meson.build | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
config/x86/meson.build +7 -10
@@ -1,15 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -# for checking defines we need to use the correct compiler flags -march_opt = ['-march=@0@'.format(machine)] - # get binutils version for the workaround of Bug 97 if host_machine.system() != 'windows' ldver = run_command('ld', '-v').stdout().strip() if ldver.contains('2.30') if cc.has_argument('-mno-avx512f') - march_opt += '-mno-avx512f' + machine_args += '-mno-avx512f' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif
@@ -19,7 +16,7 @@ endif sse_errormsg = '''SSE4.2 instruction set is required for DPDK. Please set the machine type to "nehalem" or "corei7" or higher value''' -if cc.get_define('__SSE4_2__', args: march_opt) == '' +if cc.get_define('__SSE4_2__', args: machine_args) == '' error(sse_errormsg) endif
@@ -38,23 +35,23 @@ else dpdk_conf.set('RTE_ARCH', 'i686') endif -if cc.get_define('__AES__', args: march_opt) != '' +if cc.get_define('__AES__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AES'] endif -if cc.get_define('__PCLMUL__', args: march_opt) != '' +if cc.get_define('__PCLMUL__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1) compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ'] endif -if cc.get_define('__AVX__', args: march_opt) != '' +if cc.get_define('__AVX__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX'] endif -if cc.get_define('__AVX2__', args: march_opt) != '' +if cc.get_define('__AVX2__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX2'] endif -if cc.get_define('__AVX512F__', args: march_opt) != '' +if cc.get_define('__AVX512F__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX512F'] endif
Signature · 1 line
2.20.1
PATCH v2 2/2 build: fix crash by disabling AVX512 with binutils 2.31
On Skylake platform, with native build, KNI kernel module crashes because of the corrupted values passed to kernel module.
The corruption occurs because the userspace kni library works unexpectedly. Compiler [1] is using AVX512 instructions and generated binary is wrong [2].
It turned around gcc does its job correct, but gas is generating binary wrong. And expected binutils 2.30, 2.31 & 2.31.1 are affected. Issue has been fixed in binutils 2.32 with:
Commit x86: don't mistakenly scale non-8-bit displacements
AVX512 was already disabled with bintuils 2.30 [3], extending it to 2.31 & 2.31.1 too.
[1] gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
[2] gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
[3] Bugzilla ID 97 has the details.
Bugzilla ID: 249
Cc: [email protected]
---
v2:
* Release notes "Known Issues" section updated
--- config/x86/meson.build | 6 ++++++ doc/guides/rel_notes/release_19_05.rst | 6 ++++++ mk/toolchain/gcc/rte.toolchain-compat.mk | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-)
config/x86/meson.build +6 -0
@@ -10,6 +10,12 @@ if host_machine.system() != 'windows' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif + if ldver.contains('2.31') + if cc.has_argument('-mno-avx512f') + machine_args += '-mno-avx512f' + message('Binutils 2.31 detected, disabling AVX512 support as workaround for bug #249') + endif + endif endif # we require SSE4.2 for DPDK
doc/guides/rel_notes/release_19_05.rst +6 -0
@@ -338,6 +338,12 @@ Known Issues Also, make sure to start the actual text at the margin. ========================================================= +* **On x86 platforms, AVX512 support is disabled with binutils 2.31** + + Because a defect in binutils 2.31 AVX512 support is disabled. + DPDK defect: https://bugs.dpdk.org/show_bug.cgi?id=249 + GCC defect: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028 + * **No software AES-XTS implementation.** There are currently no cryptodev software PMDs available which implement
mk/toolchain/gcc/rte.toolchain-compat.mk +8 -1
@@ -27,7 +27,14 @@ ifneq ($(filter 2.30%,$(LD_VERSION)),) FORCE_DISABLE_AVX512 := y # print warning only once for librte_eal ifneq ($(filter %librte_eal,$(CURDIR)),) -$(warning AVX512 support disabled because of ld 2.30. See Bug 97) +$(warning AVX512 support disabled because of binutils 2.30. See Bug 97) +endif +endif +ifneq ($(filter 2.31%,$(LD_VERSION)),) +FORCE_DISABLE_AVX512 := y +# print warning only once for librte_eal +ifneq ($(filter %librte_eal,$(CURDIR)),) +$(warning AVX512 support disabled because of binutils 2.31. See Bug 249) endif endif endif
Signature · 1 line
2.20.1
Re: [dpdk-dev] [PATCH v2 2/2] build: fix crash by disabling AVX512 with binutils 2.31
Quoted 39 lines · Ferruh Yigit
On Skylake platform, with native build, KNI kernel module crashes because of the corrupted values passed to kernel module.
The corruption occurs because the userspace kni library works unexpectedly. Compiler [1] is using AVX512 instructions and generated binary is wrong [2].
It turned around gcc does its job correct, but gas is generating binary wrong. And expected binutils 2.30, 2.31 & 2.31.1 are affected. Issue has been fixed in binutils 2.32 with:
Commit x86: don't mistakenly scale non-8-bit displacementsAVX512 was already disabled with bintuils 2.30 [3], extending it to 2.31 & 2.31.1 too.
[1] gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
[2] gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
[3] Bugzilla ID 97 has the details.
Bugzilla ID: 249
Cc: [email protected]Signed-off-by Ferruh Yigit <[email protected]>---
v2:
* Release notes "Known Issues" section updated--- config/x86/meson.build | 6 ++++++ doc/guides/rel_notes/release_19_05.rst | 6 ++++++ mk/toolchain/gcc/rte.toolchain-compat.mk | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-)config/x86/meson.build +0
-0
config/x86/meson.build if host_machine.system() != 'windows' · line 18
Quoted 9 lines
config/x86/meson.build +6
-0@@ -10,6 +10,12 @@ if host_machine.system() != 'windows' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif + if ldver.contains('2.31') + if cc.has_argument('-mno-avx512f') + machine_args += '-mno-avx512f' + message('Binutils 2.31 detected, disabling AVX512 support as workaround for bug #249') + endif + endif
Is this not the same as the previous block just with a slightly different error message? Should we merge the two, and print out both bug numbers?
If not merging, we can reduce the indentation by putting the second cc.has_argument() condition on the same line as the previous check, i.e.
"if ldver.contains(...) and cc.has_argument(...)"
Apart from this nit:
Quoted 7 lines · Ferruh Yigit
The '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim '
march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'
Quoted 7 lines
Fixes 566b4d7a968f ("build: fix meson check for binutils 2.30")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: [email protected]
---
PATCH v3 1/3 build: fix meson binutils workaround
In reply to Ferruh YigitThe '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim 'march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'
---
Cc: [email protected]
--- config/x86/meson.build | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
config/x86/meson.build +7 -10
@@ -1,15 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -# for checking defines we need to use the correct compiler flags -march_opt = ['-march=@0@'.format(machine)] - # get binutils version for the workaround of Bug 97 if not is_windows ldver = run_command('ld', '-v').stdout().strip() if ldver.contains('2.30') if cc.has_argument('-mno-avx512f') - march_opt += '-mno-avx512f' + machine_args += '-mno-avx512f' message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif
@@ -19,7 +16,7 @@ endif sse_errormsg = '''SSE4.2 instruction set is required for DPDK. Please set the machine type to "nehalem" or "corei7" or higher value''' -if cc.get_define('__SSE4_2__', args: march_opt) == '' +if cc.get_define('__SSE4_2__', args: machine_args) == '' error(sse_errormsg) endif
@@ -38,23 +35,23 @@ else dpdk_conf.set('RTE_ARCH', 'i686') endif -if cc.get_define('__AES__', args: march_opt) != '' +if cc.get_define('__AES__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AES', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AES'] endif -if cc.get_define('__PCLMUL__', args: march_opt) != '' +if cc.get_define('__PCLMUL__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_PCLMULQDQ', 1) compile_time_cpuflags += ['RTE_CPUFLAG_PCLMULQDQ'] endif -if cc.get_define('__AVX__', args: march_opt) != '' +if cc.get_define('__AVX__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX'] endif -if cc.get_define('__AVX2__', args: march_opt) != '' +if cc.get_define('__AVX2__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX2'] endif -if cc.get_define('__AVX512F__', args: march_opt) != '' +if cc.get_define('__AVX512F__', args: machine_args) != '' dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX512F', 1) compile_time_cpuflags += ['RTE_CPUFLAG_AVX512F'] endif
Signature · 1 line
2.20.1
PATCH v3 2/3 build: fix crash by disabling AVX512 with binutils 2.31
On Skylake platform, with native build, KNI kernel module crashes because of the corrupted values passed to kernel module.
The corruption occurs because the userspace kni library works unexpectedly. Compiler [1] is using AVX512 instructions and generated binary is wrong [2].
It turned around gcc does its job correct, but gas is generating binary wrong. And expected binutils 2.30, 2.31 & 2.31.1 are affected. Issue has been fixed in binutils 2.32 with:
Commit x86: don't mistakenly scale non-8-bit displacements
AVX512 was already disabled with bintuils 2.30 [3], extending it to 2.31 & 2.31.1 too.
[1] gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
[2] gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
[3] Bugzilla ID 97 has the details.
Bugzilla ID: 249
Cc: [email protected]
---
v3:
* merge if conditions in meson
v2:
* Release notes "Known Issues" section updated
--- config/x86/meson.build | 4 ++++ doc/guides/rel_notes/release_19_05.rst | 6 ++++++ mk/toolchain/gcc/rte.toolchain-compat.mk | 9 ++++++++- 3 files changed, 18 insertions(+), 1 deletion(-)
config/x86/meson.build +4 -0
@@ -10,6 +10,10 @@ if not is_windows message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif endif + if ldver.contains('2.31') and cc.has_argument('-mno-avx512f') + machine_args += '-mno-avx512f' + message('Binutils 2.31 detected, disabling AVX512 support as workaround for bug #249') + endif endif # we require SSE4.2 for DPDK
doc/guides/rel_notes/release_19_05.rst +6 -0
@@ -368,6 +368,12 @@ Known Issues Also, make sure to start the actual text at the margin. ========================================================= +* **On x86 platforms, AVX512 support is disabled with binutils 2.31** + + Because a defect in binutils 2.31 AVX512 support is disabled. + DPDK defect: https://bugs.dpdk.org/show_bug.cgi?id=249 + GCC defect: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028 + * **No software AES-XTS implementation.** There are currently no cryptodev software PMDs available which implement
mk/toolchain/gcc/rte.toolchain-compat.mk +8 -1
@@ -27,7 +27,14 @@ ifneq ($(filter 2.30%,$(LD_VERSION)),) FORCE_DISABLE_AVX512 := y # print warning only once for librte_eal ifneq ($(filter %librte_eal,$(CURDIR)),) -$(warning AVX512 support disabled because of ld 2.30. See Bug 97) +$(warning AVX512 support disabled because of binutils 2.30. See Bug 97) +endif +endif +ifneq ($(filter 2.31%,$(LD_VERSION)),) +FORCE_DISABLE_AVX512 := y +# print warning only once for librte_eal +ifneq ($(filter %librte_eal,$(CURDIR)),) +$(warning AVX512 support disabled because of binutils 2.31. See Bug 249) endif endif endif
Signature · 1 line
2.20.1
PATCH v3 3/3 build: reduce indentation in meson check
In reply to Ferruh YigitJust syntax change to reduce indentation, no functional change.
--- config/x86/meson.build | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
config/x86/meson.build +3 -5
@@ -4,11 +4,9 @@ # get binutils version for the workaround of Bug 97 if not is_windows ldver = run_command('ld', '-v').stdout().strip() - if ldver.contains('2.30') - if cc.has_argument('-mno-avx512f') - machine_args += '-mno-avx512f' - message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') - endif + if ldver.contains('2.30') and cc.has_argument('-mno-avx512f') + machine_args += '-mno-avx512f' + message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97') endif if ldver.contains('2.31') and cc.has_argument('-mno-avx512f') machine_args += '-mno-avx512f'
Signature · 1 line
2.20.1
Quoted 11 lines · Ferruh Yigit
The '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim '
march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'Fixes 566b4d7a968f ("build: fix meson check for binutils 2.30")Signed-off-by Ferruh Yigit <[email protected]>
I forgot to carry over the ack from previous version, here it is:
02/05/2019 15:44, Ferruh Yigit:
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines
The '-mno-avx512f' compiler flag is not passed to the compiler, detection of the binutils and setting flags works fine, but the flag itself not used by compiler.
Removing the interim '
march_opt' variable and using directly 'machine_args' and setting '-mno-avx512f' to 'machine_args'
Quoted 8 lines
Quoted 4 lines
Fixes 566b4d7a968f ("build: fix meson check for binutils 2.30")Signed-off-by Ferruh Yigit <[email protected]>I forgot to carry over the ack from previous version, here it is:
Acked-by Bruce Richardson <[email protected]>
Series applied, thanks