diff mbox series

[ovs-dev,v2,3/3] configure: explicitly disable avx512 if bintuils check fails

Message ID 20200729105934.32606-3-harry.van.haaren@intel.com
State Accepted
Delegated to: Ian Stokes
Headers show
Series [ovs-dev,v2,1/3] dpif-netdev/avx512: avoid compiling avx512 code if binutils check fails | expand

Commit Message

Van Haaren, Harry July 29, 2020, 10:59 a.m. UTC
This commit explicitly disables avx512f if the binutils assembler
check fails to correctly assemble its input.

Without this fix, there is a possibility that users can see undefined
behaviour when compiling with -march=native on a CPU which supports
avx512 and with a buggy binutils version (v2.30 and 2.31), without a
backported fix, if the compiler's vectorizing optimizations convert
scalar code to avx512 instructions.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Note that the compiler autovectorization with binutils bug could be
present in previous releases, and was not introduced with the 2.14
dpcls avx512 optimizations. The explict adding of dpcls avx512 opts
added the binutils checks to easily modify CFLAGS to fix the issue.

---
 m4/openvswitch.m4 | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 7c9a507e5..6fe79297e 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -426,8 +426,12 @@  AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
          CFLAGS="$CFLAGS -DHAVE_LD_AVX512_GOOD"
        else
          ovs_cv_binutils_avx512_good=no
+         dnl Explicitly disallow avx512f to stop compiler auto-vectorizing
+         dnl and causing zmm usage with buggy binutils versions.
+         CFLAGS="$CFLAGS -mno-avx512f"
        fi
      else
+       dnl non x86_64 architectures don't have avx512, so not affected
        ovs_cv_binutils_avx512_good=no
      fi])
      rm $OBJFILE