[3/3] dma/idxd: fix non-AVX builds with older compilers

Message ID 20220623134933.469240-4-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series fix misc dma driver build errors |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing warning Testing issues

Commit Message

Bruce Richardson June 23, 2022, 1:49 p.m. UTC
  When building without AVX2 support using an older compiler e.g. gcc 4.8
on Centos/RHEL 7, we get build errors due to the use of AVX2 intrinsics.
This is because the compiler does not support
"__attribute__((target(AVX2)))" function attribute. Disable build of
this driver such edge cases.

Generic builds using recent compilers, and all builds with a minimum
baseline of AVX2 are unaffected by this change.

Fixes: aa802b10237c ("dma/idxd: fix AVX2 in non-datapath functions")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/dma/idxd/meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)

--
2.34.1
  

Comments

Yu Jiang June 24, 2022, 8:24 a.m. UTC | #1
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Thursday, June 23, 2022 9:50 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH 3/3] dma/idxd: fix non-AVX builds with older compilers
> 
> When building without AVX2 support using an older compiler e.g. gcc 4.8 on
> Centos/RHEL 7, we get build errors due to the use of AVX2 intrinsics.
> This is because the compiler does not support
> "__attribute__((target(AVX2)))" function attribute. Disable build of this
> driver such edge cases.
> 
> Generic builds using recent compilers, and all builds with a minimum baseline
> of AVX2 are unaffected by this change.
> 
> Fixes: aa802b10237c ("dma/idxd: fix AVX2 in non-datapath functions")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Tested-by: Yu Jiang <YuX.Jiang@intel.com>

Tested env as below:
OS: CentOS7.9/kernel: 3.10.0-1160.62.1.el7.x86_64
Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

Best regards,
Yu Jiang
  
Thomas Monjalon June 26, 2022, 8:29 a.m. UTC | #2
> > When building without AVX2 support using an older compiler e.g. gcc 4.8 on
> > Centos/RHEL 7, we get build errors due to the use of AVX2 intrinsics.
> > This is because the compiler does not support
> > "__attribute__((target(AVX2)))" function attribute. Disable build of this
> > driver such edge cases.
> > 
> > Generic builds using recent compilers, and all builds with a minimum baseline
> > of AVX2 are unaffected by this change.
> > 
> > Fixes: aa802b10237c ("dma/idxd: fix AVX2 in non-datapath functions")
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> Tested-by: Yu Jiang <YuX.Jiang@intel.com>
> 
> Tested env as below:
> OS: CentOS7.9/kernel: 3.10.0-1160.62.1.el7.x86_64
> Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

Series applied, thanks.
  

Patch

diff --git a/drivers/dma/idxd/meson.build b/drivers/dma/idxd/meson.build
index dcc0a297d7..c5403b431c 100644
--- a/drivers/dma/idxd/meson.build
+++ b/drivers/dma/idxd/meson.build
@@ -4,6 +4,17 @@ 
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'

+test_avx2_code = '''
+#include <x86intrin.h>
+__attribute__((target("avx2")))
+__m256i fn(void *x) { return _mm256_loadu_si256(x); }
+'''
+if build and not cc.compiles(test_avx2_code, args:machine_args)
+    build = false
+    reason = 'missing support for AVX2 function attribute'
+    subdir_done()
+endif
+
 deps += ['bus_pci']
 sources = files(
         'idxd_common.c',