[meta-dpdk] dpdk: Fix do_compile failure for qemux86 and qemux86-64

Submitted by zhe.he@windriver.com on June 11, 2019, 3:06 a.m. | Patch ID: 162091

Details

Message ID 1560222410-414851-2-git-send-email-zhe.he@windriver.com
State New
Headers show

Commit Message

zhe.he@windriver.com June 11, 2019, 3:06 a.m.
From: He Zhe <zhe.he@windriver.com>

DPDK_TARGET_MACHINE in bbappend in other layers forms the dpdk-internal variable
MACHINE_CFLAGS which is passed to dpdk compilation command line containing the
first -march parameter. And EXTRA_CFLAGS in dpdk.inc is passed to dpdk command
line containing the second -march parameter. By mistake, the first -march had
always overwritten the second one until the following commit of GCC v9.1.0
8c0f695d83d1 ("driver: Also prune joined switches with negation").

Since it was fixed, the second -march, which was core2 for qemux86-64 or
core2-32 for qemux86, began to take effect. But core2* does not have SSE4.2
feature which is required by some dpdk instruction optimization and thus cause
the following compilation failure.

9.1.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline
'_mm_blendv_epi8': target specific option mismatch
  179 | _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
      | ^~~~~~~~~~~~~~~

This patch adds DPDK_EXTRA_CFLAGS to append appropriate -march, corei7 which is
minimum and clear and independent of host machine, to dpdk compilation command
line to overwrite all previous ones, without having to change dpdk source code.

Note that as we do not want to change the default tune core2* for qemux86*, this
patch just fixes the compilation error. It would probably not be able to run on
qemux86* with corei7 tune.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 recipes-extended/dpdk/dpdk.inc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-extended/dpdk/dpdk.inc
index a0e081a..0275e0c 100644
--- a/recipes-extended/dpdk/dpdk.inc
+++ b/recipes-extended/dpdk/dpdk.inc
@@ -61,6 +61,9 @@  DPDK_RTE_TARGET_x86-64 = "x86_64-native-linuxapp-gcc"
 DPDK_RTE_TARGET_x86 = "i686-native-linuxapp-gcc"
 DPDK_RTE_TARGET_aarch64 = "arm64-${DPDK_TARGET_MACH}-linuxapp-gcc"
 export RTE_TARGET = "${DPDK_RTE_TARGET}"
+DPDK_EXTRA_CFLAGS = ""
+DPDK_EXTRA_CFLAGS_qemux86 ?= "-march=corei7"
+DPDK_EXTRA_CFLAGS_qemux86-64 ?= "-march=corei7"
 
 # The list of intel Comms platforms and their target machine
 # process mapping. The supported target machine is listed under
@@ -100,18 +103,18 @@  do_compile () {
 
 	cd ${S}/${RTE_TARGET}
 	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu" \
-		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
+		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
 		   CROSS="${TARGET_PREFIX}" \
 		   prefix=""  LDFLAGS="${TUNE_LDARGS}"  WERROR_FLAGS="-w" V=1
 
 	cd ${S}/examples/
 	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
-		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
+		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
 		   CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/"
 
 	cd ${S}/test/
 	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
-		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
+		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
 		   CROSS="${TARGET_PREFIX}" O="${S}/test/$@/"
 }
 

Comments

Anuj Mittal June 11, 2019, 6:31 a.m.
On Tue, 2019-06-11 at 11:06 +0800, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
> 
> DPDK_TARGET_MACHINE in bbappend in other layers forms the dpdk-
> internal variable
> MACHINE_CFLAGS which is passed to dpdk compilation command line
> containing the
> first -march parameter. And EXTRA_CFLAGS in dpdk.inc is passed to
> dpdk command
> line containing the second -march parameter. By mistake, the first
> -march had
> always overwritten the second one until the following commit of GCC
> v9.1.0
> 8c0f695d83d1 ("driver: Also prune joined switches with negation").
> 
> Since it was fixed, the second -march, which was core2 for qemux86-64 
> or
> core2-32 for qemux86, began to take effect. But core2* does not have
> SSE4.2
> feature which is required by some dpdk instruction optimization and
> thus cause
> the following compilation failure.
> 
> 9.1.0/include/smmintrin.h:179:1: error: inlining failed in call to
> always_inline
> '_mm_blendv_epi8': target specific option mismatch
>   179 | _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
>       | ^~~~~~~~~~~~~~~
> 
> This patch adds DPDK_EXTRA_CFLAGS to append appropriate -march,
> corei7 which is
> minimum and clear and independent of host machine, to dpdk
> compilation command
> line to overwrite all previous ones, without having to change dpdk
> source code.
> 
> Note that as we do not want to change the default tune core2* for
> qemux86*, this
> patch just fixes the compilation error. It would probably not be able
> to run on
> qemux86* with corei7 tune.

I don't think overriding arch values in recipe is appropriate. Also the
recipe is setting COMPATIBLE_MACHINE to be null because of this reason.
If the MACHINE that we're building for doesn't support the features
required, then we shouldn't be building dpdk for it in my opinion.

Thanks,

Anuj

> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  recipes-extended/dpdk/dpdk.inc | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-
> extended/dpdk/dpdk.inc
> index a0e081a..0275e0c 100644
> --- a/recipes-extended/dpdk/dpdk.inc
> +++ b/recipes-extended/dpdk/dpdk.inc
> @@ -61,6 +61,9 @@ DPDK_RTE_TARGET_x86-64 = "x86_64-native-linuxapp-
> gcc"
>  DPDK_RTE_TARGET_x86 = "i686-native-linuxapp-gcc"
>  DPDK_RTE_TARGET_aarch64 = "arm64-${DPDK_TARGET_MACH}-linuxapp-gcc"
>  export RTE_TARGET = "${DPDK_RTE_TARGET}"
> +DPDK_EXTRA_CFLAGS = ""
> +DPDK_EXTRA_CFLAGS_qemux86 ?= "-march=corei7"
> +DPDK_EXTRA_CFLAGS_qemux86-64 ?= "-march=corei7"
>  
>  # The list of intel Comms platforms and their target machine
>  # process mapping. The supported target machine is listed under
> @@ -100,18 +103,18 @@ do_compile () {
>  
>  	cd ${S}/${RTE_TARGET}
>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu" 
> \
> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> -I${STAGING_INCDIR}" \
> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>  		   CROSS="${TARGET_PREFIX}" \
>  		   prefix=""  LDFLAGS="${TUNE_LDARGS}"  WERROR_FLAGS="-
> w" V=1
>  
>  	cd ${S}/examples/
>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu
> -fuse-ld=bfd" \
> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> -I${STAGING_INCDIR}" \
> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>  		   CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/"
>  
>  	cd ${S}/test/
>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu
> -fuse-ld=bfd" \
> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> -I${STAGING_INCDIR}" \
> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>  		   CROSS="${TARGET_PREFIX}" O="${S}/test/$@/"
>  }
>
zhe.he@windriver.com June 11, 2019, 7 a.m.
On 6/11/19 2:31 PM, Mittal, Anuj wrote:
> On Tue, 2019-06-11 at 11:06 +0800, zhe.he@windriver.com wrote:
>> From: He Zhe <zhe.he@windriver.com>
>>
>> DPDK_TARGET_MACHINE in bbappend in other layers forms the dpdk-
>> internal variable
>> MACHINE_CFLAGS which is passed to dpdk compilation command line
>> containing the
>> first -march parameter. And EXTRA_CFLAGS in dpdk.inc is passed to
>> dpdk command
>> line containing the second -march parameter. By mistake, the first
>> -march had
>> always overwritten the second one until the following commit of GCC
>> v9.1.0
>> 8c0f695d83d1 ("driver: Also prune joined switches with negation").
>>
>> Since it was fixed, the second -march, which was core2 for qemux86-64 
>> or
>> core2-32 for qemux86, began to take effect. But core2* does not have
>> SSE4.2
>> feature which is required by some dpdk instruction optimization and
>> thus cause
>> the following compilation failure.
>>
>> 9.1.0/include/smmintrin.h:179:1: error: inlining failed in call to
>> always_inline
>> '_mm_blendv_epi8': target specific option mismatch
>>   179 | _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
>>       | ^~~~~~~~~~~~~~~
>>
>> This patch adds DPDK_EXTRA_CFLAGS to append appropriate -march,
>> corei7 which is
>> minimum and clear and independent of host machine, to dpdk
>> compilation command
>> line to overwrite all previous ones, without having to change dpdk
>> source code.
>>
>> Note that as we do not want to change the default tune core2* for
>> qemux86*, this
>> patch just fixes the compilation error. It would probably not be able
>> to run on
>> qemux86* with corei7 tune.
> I don't think overriding arch values in recipe is appropriate. Also the
> recipe is setting COMPATIBLE_MACHINE to be null because of this reason.
> If the MACHINE that we're building for doesn't support the features
> required, then we shouldn't be building dpdk for it in my opinion.

This is largely a fix for those who want to test building qemux86* with dpdk.
It does no harm to the rest of the configuration, and can be use as a way to
append potential flags to dpdk building command line.

But it's fine to me to drop it if it does not make much sense to you.

Thanks,
Zhe

>
> Thanks,
>
> Anuj
>
>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>> ---
>>  recipes-extended/dpdk/dpdk.inc | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-
>> extended/dpdk/dpdk.inc
>> index a0e081a..0275e0c 100644
>> --- a/recipes-extended/dpdk/dpdk.inc
>> +++ b/recipes-extended/dpdk/dpdk.inc
>> @@ -61,6 +61,9 @@ DPDK_RTE_TARGET_x86-64 = "x86_64-native-linuxapp-
>> gcc"
>>  DPDK_RTE_TARGET_x86 = "i686-native-linuxapp-gcc"
>>  DPDK_RTE_TARGET_aarch64 = "arm64-${DPDK_TARGET_MACH}-linuxapp-gcc"
>>  export RTE_TARGET = "${DPDK_RTE_TARGET}"
>> +DPDK_EXTRA_CFLAGS = ""
>> +DPDK_EXTRA_CFLAGS_qemux86 ?= "-march=corei7"
>> +DPDK_EXTRA_CFLAGS_qemux86-64 ?= "-march=corei7"
>>  
>>  # The list of intel Comms platforms and their target machine
>>  # process mapping. The supported target machine is listed under
>> @@ -100,18 +103,18 @@ do_compile () {
>>  
>>  	cd ${S}/${RTE_TARGET}
>>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu" 
>> \
>> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> -I${STAGING_INCDIR}" \
>> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>>  		   CROSS="${TARGET_PREFIX}" \
>>  		   prefix=""  LDFLAGS="${TUNE_LDARGS}"  WERROR_FLAGS="-
>> w" V=1
>>  
>>  	cd ${S}/examples/
>>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu
>> -fuse-ld=bfd" \
>> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> -I${STAGING_INCDIR}" \
>> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>>  		   CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/"
>>  
>>  	cd ${S}/test/
>>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu
>> -fuse-ld=bfd" \
>> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> -I${STAGING_INCDIR}" \
>> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}
>> ${DPDK_EXTRA_CFLAGS} -I${STAGING_INCDIR}" \
>>  		   CROSS="${TARGET_PREFIX}" O="${S}/test/$@/"
>>  }
>>