build: remove obsolete compiler checks
Subsystems (3)
PATCH 1/1 build: remove obsolete compiler checks
DPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
--- config/meson.build | 5 ---- drivers/event/meson.build | 5 +--- drivers/meson.build | 2 +- drivers/net/virtio/meson.build | 2 +- lib/eal/arm/include/rte_memcpy_64.h | 8 ------- lib/eal/arm/include/rte_vect.h | 37 ++--------------------------- lib/eal/ppc/include/rte_altivec.h | 1 - lib/meson.build | 2 +- lib/vhost/meson.build | 4 ++-- lib/vhost/vhost.c | 16 ------------- 10 files changed, 8 insertions(+), 74 deletions(-)
config/meson.build +0 -5
@@ -492,11 +492,6 @@ if get_option('b_lto') else error('compiler does not support fat LTO objects - please turn LTO off') endif - # workaround for gcc bug 81440 - if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0') - add_project_arguments('-Wno-lto-type-mismatch', language: 'c') - add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c') - endif endif if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address,undefined'
drivers/event/meson.build +1 -4
@@ -14,9 +14,6 @@ drivers = [ 'opdl', 'skeleton', 'sw', + 'octeontx', ] -if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and - dpdk_conf.has('RTE_ARCH_ARM64')) - drivers += 'octeontx' -endif std_deps = ['eventdev', 'kvargs']
drivers/meson.build +1 -1
@@ -237,7 +237,7 @@ foreach subpath:subdirs enabled_drivers += name lib_name = '_'.join(['rte', class, name]) cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name]) - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
drivers/net/virtio/meson.build +1 -1
@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif
lib/eal/arm/include/rte_memcpy_64.h +0 -8
@@ -89,14 +89,6 @@ n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD)**************************************/ -#if RTE_CC_IS_GNU && !definedRTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK -#if (GCC_VERSION <50400 ) -#warning "The GCC version is quite old, which may result in sub-optimal \ -performance of the compiled code. It is suggested that at least GCC 5.4.0 \ -be used." -#endif -#endif -static __rte_always_inline void rte_mov16(uint8_t *dst, const uint8_t *src) {
lib/eal/arm/include/rte_vect.h +2 -35
@@ -67,11 +67,8 @@ vaddvq_u16(uint16x8_t a)#endif -#if (defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 )) || \ -(defined(RTE_ARCH_ARM64 ) &&RTE_CC_IS_GNU && (GCC_VERSION <70000 )) -/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) -* On AArch64, this intrinsic is supported since GCC version 7. -*/ +#if defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 ) +/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) */ static inline uint32x4_t vcopyq_laneq_u32 (uint32x4_t a,const int lane_a,uint32x4_t b,const int lane_b)
@@ -80,36 +77,6 @@ vcopyq_laneq_u32(uint32x4_t a, const int lane_a, }#endif -#if defined(RTE_ARCH_ARM64 ) -#if RTE_CC_IS_GNU && (GCC_VERSION <70000 ) - -/* NEON intrinsic vreinterpretq_u64_p128() is supported since GCC version 7 */ -static inline uint64x2_t -vreinterpretq_u64_p128 (poly128_t x) -{ -return (uint64x2_t )x; -} - -/* NEON intrinsic vreinterpretq_p64_u64() is supported since GCC version 7 */ -static inline poly64x2_t -vreinterpretq_p64_u64 (uint64x2_t x) -{ -return (poly64x2_t )x; -} - -/* NEON intrinsic vgetq_lane_p64() is supported since GCC version 7 */ -static inline poly64_t -vgetq_lane_p64 (poly64x2_t x,const int lane) -{ -RTE_ASSERT (lane >=0 && lane <=1 ); - -poly64_t *p = (poly64_t *)&x; - -return p[lane]; -} -#endif -#endif -/* * If (0 <= index <= 15), then call the ASIMD ext instruction on the * 128 bit regs v0 and v1 with the appropriate index.
lib/eal/ppc/include/rte_altivec.h +0 -1
@@ -6,7 +6,6 @@#ifndef _RTE_ALTIVEC_H_#define _RTE_ALTIVEC_H_ -/* To include altivec.h, GCC version must be >= 4.8 */ #include <altivec.h> /*
lib/meson.build +1 -1
@@ -244,7 +244,7 @@ foreach l:libraries cflags += '-DRTE_USE_FUNCTION_VERSIONING' endif cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
lib/vhost/meson.build +2 -2
@@ -8,9 +8,9 @@ endif if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if (toolchain == 'gcc') cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif (toolchain == 'clang') cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))
lib/vhost/vhost.c +0 -16
@@ -128,16 +128,8 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, static __rte_always_inline voidvhost_set_bit (unsigned int nr,volatile uint8_t *addr) { -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* __sync_ built-ins are deprecated, but rte_atomic_ ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or_1 (addr, (1U << nr)); -#else rte_atomic_fetch_or_explicit((volatile uint8_t __rte_atomic *)addr, (1U << nr), rte_memory_order_relaxed); -#endif }static __rte_always_inline void
@@ -207,17 +199,9 @@ __vhost_log_cache_sync(struct virtio_net *dev, struct vhost_virtqueue *vq)for (i =0 ; i < vq->log_cache_nb_elem; i++) {struct log_cache_entry *elem = vq->log_cache + i; -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* '__sync' builtins are deprecated, but 'rte_atomic' ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or (log_base + elem->offset, elem->val); -#else rte_atomic_fetch_or_explicit ( (unsigned long __rte_atomic *)(log_base + elem->offset), elem->val, rte_memory_order_relaxed); -#endif }rte_atomic_thread_fence (rte_memory_order_release);
Signature · 1 line
2.48.1
Quoted 5 lines · Bruce Richardson
DPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
Signed-off-by Bruce Richardson <[email protected]>
Quoted 12 lines
--- config/meson.build | 5 ---- drivers/event/meson.build | 5 +--- drivers/meson.build | 2 +- drivers/net/virtio/meson.build | 2 +- lib/eal/arm/include/rte_memcpy_64.h | 8 ------- lib/eal/arm/include/rte_vect.h | 37 ++--------------------------- lib/eal/ppc/include/rte_altivec.h | 1 - lib/meson.build | 2 +- lib/vhost/meson.build | 4 ++-- lib/vhost/vhost.c | 16 ------------- 10 files changed, 8 insertions(+), 74 deletions(-)
Two nits:
[snip]
drivers/event/meson.build drivers = [ · line 18
Quoted 10 lines
drivers/event/meson.build +1
-0@@ -14,9 +14,6 @@ drivers = [ 'opdl', 'skeleton', 'sw', + 'octeontx', ]
Sort alphabetically?
Quoted 5 lines
drivers/event/meson.build +0
-4-if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and - dpdk_conf.has('RTE_ARCH_ARM64')) - drivers += 'octeontx' -endif std_deps = ['eventdev', 'kvargs']
[snip]
Quoted 6 lines
lib/eal/arm/include/rte_memcpy_64.h +0
-0@@ -89,14 +89,6 @@ n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD)**************************************/
lib/eal/arm/include/rte_memcpy_64.h n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD) · line 99
Quoted 10 lines
lib/eal/arm/include/rte_memcpy_64.h +0
-8-#if RTE_CC_IS_GNU && !definedRTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK -#if (GCC_VERSION <50400 ) -#warning "The GCC version is quite old, which may result in sub-optimal \ -performance of the compiled code. It is suggested that at least GCC 5.4.0 \ -be used." -#endif -#endif -
This flag can be removed from meson too.
config/arm/meson.build: #
['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
Quoted 3 lines
lib/eal/arm/include/rte_memcpy_64.h +0
-0static __rte_always_inline void rte_mov16(uint8_t *dst, const uint8_t *src) {
Signature · 1 line
David Marchand
Quoted 24 lines · David Marchand
Quoted 5 lines · Bruce Richardson
DPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
Signed-off-by Bruce Richardson <[email protected]>Quoted 12 lines
--- config/meson.build | 5 ---- drivers/event/meson.build | 5 +--- drivers/meson.build | 2 +- drivers/net/virtio/meson.build | 2 +- lib/eal/arm/include/rte_memcpy_64.h | 8 ------- lib/eal/arm/include/rte_vect.h | 37 ++--------------------------- lib/eal/ppc/include/rte_altivec.h | 1 - lib/meson.build | 2 +- lib/vhost/meson.build | 4 ++-- lib/vhost/vhost.c | 16 ------------- 10 files changed, 8 insertions(+), 74 deletions(-)Two nits:
[snip]
Quoted 13 lines
drivers/event/meson.build drivers = [ · line 18
Quoted 10 lines
drivers/event/meson.build +1
-0@@ -14,9 +14,6 @@ drivers = [ 'opdl', 'skeleton', 'sw', + 'octeontx', ]Sort alphabetically?
Absolutely, yes.
Quoted 17 lines
Quoted 6 lines
drivers/event/meson.build +0
-4-if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and - dpdk_conf.has('RTE_ARCH_ARM64')) - drivers += 'octeontx' -endif std_deps = ['eventdev', 'kvargs'][snip]
Quoted 8 lines
lib/eal/arm/include/rte_memcpy_64.h +0
-0@@ -89,14 +89,6 @@ n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD)**************************************/
Quoted 13 lines
lib/eal/arm/include/rte_memcpy_64.h n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD) · line 99
Quoted 8 lines
lib/eal/arm/include/rte_memcpy_64.h +0
-8-#if RTE_CC_IS_GNU && !definedRTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK -#if (GCC_VERSION <50400 ) -#warning "The GCC version is quite old, which may result in sub-optimal \ -performance of the compiled code. It is suggested that at least GCC 5.4.0 \ -be used." -#endif -#endif -This flag can be removed from meson too.
config/arm/meson.build: #
['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false],
Yep, seems there are no more references to it in the code.
Will fix in V2, after all CI's have had their chance to have their say.
/Bruce
drivers/net/virtio/meson.build if arch_subdir == 'x86' · line 37
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif
One other nit, not blocking.
There should be no need for special casing clang vs gcc, since clang supports gcc syntax in general.
https://clang.llvm.org/docs/AttributeReference.html#pragma-unroll-pragma-nounroll
The code could check for RTE_TOOLCHAIN_GCC/CLANG directly, and we don't need a separate define passed from cmdline.
(idem in lib/vhost)
Signature · 1 line
David Marchand
Quoted 18 lines · David Marchand
drivers/net/virtio/meson.build if arch_subdir == 'x86' · line 37
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endifOne other nit, not blocking.
Quoted 4 lines
There should be no need for special casing clang vs gcc, since clang supports gcc syntax in general.
https://clang.llvm.org/docs/AttributeReference.html#pragma-unroll-pragma-nounroll
I was actually thinking of doing a follow-up patch to remove the "if" and instead do:
cflags += '-DVIRTIO_' + toolchain.to_upper() + "_UNROLL_PRAGMA"
on the basis that having a define for any other unknown compilers would be harmless. However, you are right that there seems to be little reason to do this in meson.build, and the code can do it directly itself. I'll leave this part as it is in the patch for now.
/Bruce
Quoted 27 lines · Bruce Richardson
Quoted 18 lines · David Marchand
drivers/net/virtio/meson.build if arch_subdir == 'x86' · line 37
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endifOne other nit, not blocking.
Quoted 4 lines
There should be no need for special casing clang vs gcc, since clang supports gcc syntax in general.
https://clang.llvm.org/docs/AttributeReference.html#pragma-unroll-pragma-nounrollI was actually thinking of doing a follow-up patch to remove the "if" and instead do:
Quoted 6 lines
cflags += '-DVIRTIO_' + toolchain.to_upper() + "_UNROLL_PRAGMA"on the basis that having a define for any other unknown compilers would be harmless. However, you are right that there seems to be little reason to do this in meson.build, and the code can do it directly itself. I'll leave this part as it is in the patch for now.
I wonder if this pragma stuff really helps..
One quick test on the loop in vhost_flush_enqueue_batch_packed() shows the same generated code with gcc 10 and gcc 15 when compiling with -O3 (thanks to godbolt.org).
Let's leave it as is for now, but I would be for dropping this strange construct, only used with the virtio ring packed layout iirc.
Signature · 1 line
David Marchand
PATCH v2 1/1 build: remove obsolete compiler checks
In reply to Bruce RichardsonDPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
---
V2: Fix feedback from V1.
* remove obsolete comment from arm/meson.build
* sort octeontx alphabetically in driver list
--- config/arm/meson.build | 1 - config/meson.build | 5 ---- drivers/event/meson.build | 5 +--- drivers/meson.build | 2 +- drivers/net/virtio/meson.build | 2 +- lib/eal/arm/include/rte_memcpy_64.h | 8 ------- lib/eal/arm/include/rte_vect.h | 37 ++--------------------------- lib/eal/ppc/include/rte_altivec.h | 1 - lib/meson.build | 2 +- lib/vhost/meson.build | 4 ++-- lib/vhost/vhost.c | 16 ------------- 11 files changed, 8 insertions(+), 75 deletions(-)
config/arm/meson.build +0 -1
@@ -13,7 +13,6 @@ flags_common = [ # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512], # Leave below RTE_ARM64_MEMCPY_xxx options commented out, # unless there are strong reasons. - # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false], # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF], # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
config/meson.build +0 -5
@@ -492,11 +492,6 @@ if get_option('b_lto') else error('compiler does not support fat LTO objects - please turn LTO off') endif - # workaround for gcc bug 81440 - if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0') - add_project_arguments('-Wno-lto-type-mismatch', language: 'c') - add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c') - endif endif if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address,undefined'
drivers/event/meson.build +1 -4
@@ -11,12 +11,9 @@ drivers = [ 'dpaa', 'dpaa2', 'dsw', + 'octeontx', 'opdl', 'skeleton', 'sw', ] -if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and - dpdk_conf.has('RTE_ARCH_ARM64')) - drivers += 'octeontx' -endif std_deps = ['eventdev', 'kvargs']
drivers/meson.build +1 -1
@@ -237,7 +237,7 @@ foreach subpath:subdirs enabled_drivers += name lib_name = '_'.join(['rte', class, name]) cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name]) - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
drivers/net/virtio/meson.build +1 -1
@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif
lib/eal/arm/include/rte_memcpy_64.h +0 -8
@@ -89,14 +89,6 @@ n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD)**************************************/ -#if RTE_CC_IS_GNU && !definedRTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK -#if (GCC_VERSION <50400 ) -#warning "The GCC version is quite old, which may result in sub-optimal \ -performance of the compiled code. It is suggested that at least GCC 5.4.0 \ -be used." -#endif -#endif -static __rte_always_inline void rte_mov16(uint8_t *dst, const uint8_t *src) {
lib/eal/arm/include/rte_vect.h +2 -35
@@ -67,11 +67,8 @@ vaddvq_u16(uint16x8_t a)#endif -#if (defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 )) || \ -(defined(RTE_ARCH_ARM64 ) &&RTE_CC_IS_GNU && (GCC_VERSION <70000 )) -/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) -* On AArch64, this intrinsic is supported since GCC version 7. -*/ +#if defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 ) +/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) */ static inline uint32x4_t vcopyq_laneq_u32 (uint32x4_t a,const int lane_a,uint32x4_t b,const int lane_b)
@@ -80,36 +77,6 @@ vcopyq_laneq_u32(uint32x4_t a, const int lane_a, }#endif -#if defined(RTE_ARCH_ARM64 ) -#if RTE_CC_IS_GNU && (GCC_VERSION <70000 ) - -/* NEON intrinsic vreinterpretq_u64_p128() is supported since GCC version 7 */ -static inline uint64x2_t -vreinterpretq_u64_p128 (poly128_t x) -{ -return (uint64x2_t )x; -} - -/* NEON intrinsic vreinterpretq_p64_u64() is supported since GCC version 7 */ -static inline poly64x2_t -vreinterpretq_p64_u64 (uint64x2_t x) -{ -return (poly64x2_t )x; -} - -/* NEON intrinsic vgetq_lane_p64() is supported since GCC version 7 */ -static inline poly64_t -vgetq_lane_p64 (poly64x2_t x,const int lane) -{ -RTE_ASSERT (lane >=0 && lane <=1 ); - -poly64_t *p = (poly64_t *)&x; - -return p[lane]; -} -#endif -#endif -/* * If (0 <= index <= 15), then call the ASIMD ext instruction on the * 128 bit regs v0 and v1 with the appropriate index.
lib/eal/ppc/include/rte_altivec.h +0 -1
@@ -6,7 +6,6 @@#ifndef _RTE_ALTIVEC_H_#define _RTE_ALTIVEC_H_ -/* To include altivec.h, GCC version must be >= 4.8 */ #include <altivec.h> /*
lib/meson.build +1 -1
@@ -244,7 +244,7 @@ foreach l:libraries cflags += '-DRTE_USE_FUNCTION_VERSIONING' endif cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
lib/vhost/meson.build +2 -2
@@ -8,9 +8,9 @@ endif if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if (toolchain == 'gcc') cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif (toolchain == 'clang') cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))
lib/vhost/vhost.c +0 -16
@@ -128,16 +128,8 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, static __rte_always_inline voidvhost_set_bit (unsigned int nr,volatile uint8_t *addr) { -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* __sync_ built-ins are deprecated, but rte_atomic_ ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or_1 (addr, (1U << nr)); -#else rte_atomic_fetch_or_explicit((volatile uint8_t __rte_atomic *)addr, (1U << nr), rte_memory_order_relaxed); -#endif }static __rte_always_inline void
@@ -207,17 +199,9 @@ __vhost_log_cache_sync(struct virtio_net *dev, struct vhost_virtqueue *vq)for (i =0 ; i < vq->log_cache_nb_elem; i++) {struct log_cache_entry *elem = vq->log_cache + i; -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* '__sync' builtins are deprecated, but 'rte_atomic' ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or (log_base + elem->offset, elem->val); -#else rte_atomic_fetch_or_explicit ( (unsigned long __rte_atomic *)(log_base + elem->offset), elem->val, rte_memory_order_relaxed); -#endif }rte_atomic_thread_fence (rte_memory_order_release);
--
2.48.1
Quoted 4 lines · On Fri, 25 Jul 2025 17:06:28 +0100 Bruce Richardson…
DPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
Signed-off-by Bruce Richardson <[email protected]>
Hello Bruce,
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif
[snip]
Quoted 6 lines
lib/vhost/meson.build +0
-0@@ -8,9 +8,9 @@ endif if has_libnuma
lib/vhost/meson.build endif · line 16
Quoted 10 lines
lib/vhost/meson.build +2
-2dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if (toolchain == 'gcc') cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif (toolchain == 'clang') cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))
Sorry, I did not notice in the v1, but lib/vhost and drivers/net/virtio have the same construct, yet only lib/vhost gets updated on the gcc version check in this patch.
Is this intentional?
Since GCC 8.0+ is recommended, I would keep the version check in both vhost and net/virtio.
Other than this, it lgtm.
Signature · 1 line
David Marchand
Quoted 33 lines · David Marchand
Hello Bruce,
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif[snip]
Quoted 13 lines
lib/vhost/meson.build +2
-2@@ -8,9 +8,9 @@ endif if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if (toolchain == 'gcc') cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif (toolchain == 'clang')
Quoted 8 lines
lib/vhost/meson.build endif · line 16
Quoted 3 lines
lib/vhost/meson.build +0
-0cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))Sorry, I did not notice in the v1, but lib/vhost and
drivers/net/virtiohave the same construct, yet only lib/vhost gets updated on the gcc version check in this patch.
Is this intentional?
Not that I remember, I seem to have missed that.
Quoted 3 lines
Since GCC 8.0+ is recommended, I would keep the version check in both vhost and net/virtio.
I think I actually checked this out, and decided that it was ok to drop the check. I will reconfirm that, see how this is used and if it really needs 8.3 GCC.
Quoted 8 lines
Other than this, it lgtm.
Reviewed-by David Marchand <[email protected]>Signature · 1 line
David Marchand
Quoted 42 lines · David Marchand
Hello Bruce,
Quoted 13 lines · Bruce Richardson
drivers/net/virtio/meson.build +1
-1@@ -31,7 +31,7 @@ if arch_subdir == 'x86' sources_avx512 += files('virtio_rxtx_packed.c') if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif (toolchain == 'clang') cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif[snip]
Quoted 6 lines
lib/vhost/meson.build +0
-0@@ -8,9 +8,9 @@ endif if has_libnumalib/vhost/meson.build endif · line 16
Quoted 10 lines
lib/vhost/meson.build +2
-2dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if (toolchain == 'gcc') cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif (toolchain == 'clang') cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))Sorry, I did not notice in the v1, but lib/vhost and
drivers/net/virtiohave the same construct, yet only lib/vhost gets updated on the gcc version check in this patch.
Is this intentional?
Quoted 3 lines
Since GCC 8.0+ is recommended, I would keep the version check in both vhost and net/virtio.
Checking quickly with Godbolt, the pragma seems to be recognised by GCC 8.1 in the same way as with GCC 8.3. Therefore removing the version check looks the correct option to me.
However, a better cleanup is to remove these defines from the meson.build file completely, and instead just check for GCC and clang directly in the header file.
/Bruce
PATCH v3 1/2 build: remove obsolete compiler checks
In reply to Bruce RichardsonDPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
---
V3: fix inconsistency between build files for vhost and net/virtio
V2: Fix feedback from V1.
* remove obsolete comment from arm/meson.build
* sort octeontx alphabetically in driver list
--- config/arm/meson.build | 1 - config/meson.build | 5 ---- drivers/event/meson.build | 5 +--- drivers/meson.build | 2 +- drivers/net/virtio/meson.build | 4 ++-- lib/eal/arm/include/rte_memcpy_64.h | 8 ------- lib/eal/arm/include/rte_vect.h | 37 ++--------------------------- lib/eal/ppc/include/rte_altivec.h | 1 - lib/meson.build | 2 +- lib/vhost/meson.build | 4 ++-- lib/vhost/vhost.c | 16 ------------- 11 files changed, 9 insertions(+), 76 deletions(-)
config/arm/meson.build +0 -1
@@ -13,7 +13,6 @@ flags_common = [ # ['RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD', 512], # Leave below RTE_ARM64_MEMCPY_xxx options commented out, # unless there are strong reasons. - # ['RTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK', false], # ['RTE_ARM64_MEMCPY_ALIGN_MASK', 0xF], # ['RTE_ARM64_MEMCPY_STRICT_ALIGN', false],
config/meson.build +0 -5
@@ -492,11 +492,6 @@ if get_option('b_lto') else error('compiler does not support fat LTO objects - please turn LTO off') endif - # workaround for gcc bug 81440 - if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0') - add_project_arguments('-Wno-lto-type-mismatch', language: 'c') - add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c') - endif endif if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address,undefined'
drivers/event/meson.build +1 -4
@@ -11,12 +11,9 @@ drivers = [ 'dpaa', 'dpaa2', 'dsw', + 'octeontx', 'opdl', 'skeleton', 'sw', ] -if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and - dpdk_conf.has('RTE_ARCH_ARM64')) - drivers += 'octeontx' -endif std_deps = ['eventdev', 'kvargs']
drivers/meson.build +1 -1
@@ -237,7 +237,7 @@ foreach subpath:subdirs enabled_drivers += name lib_name = '_'.join(['rte', class, name]) cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=' + '.'.join([log_prefix, name]) - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
drivers/net/virtio/meson.build +2 -2
@@ -29,9 +29,9 @@ if arch_subdir == 'x86' if cc_has_avx512 cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] sources_avx512 += files('virtio_rxtx_packed.c') - if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) + if toolchain == 'gcc' cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) + elif toolchain == 'clang' cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' endif endif
lib/eal/arm/include/rte_memcpy_64.h +0 -8
@@ -89,14 +89,6 @@ n <= (size_t)RTE_ARM64_MEMCPY_UNALIGNED_THRESHOLD)**************************************/ -#if RTE_CC_IS_GNU && !definedRTE_ARM64_MEMCPY_SKIP_GCC_VER_CHECK -#if (GCC_VERSION <50400 ) -#warning "The GCC version is quite old, which may result in sub-optimal \ -performance of the compiled code. It is suggested that at least GCC 5.4.0 \ -be used." -#endif -#endif -static __rte_always_inline void rte_mov16(uint8_t *dst, const uint8_t *src) {
lib/eal/arm/include/rte_vect.h +2 -35
@@ -67,11 +67,8 @@ vaddvq_u16(uint16x8_t a)#endif -#if (defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 )) || \ -(defined(RTE_ARCH_ARM64 ) &&RTE_CC_IS_GNU && (GCC_VERSION <70000 )) -/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) -* On AArch64, this intrinsic is supported since GCC version 7. -*/ +#if defined(RTE_ARCH_ARM ) && defined(RTE_ARCH_32 ) +/* NEON intrinsic vcopyq_laneq_u32() is not supported in ARMv7-A(AArch32) */ static inline uint32x4_t vcopyq_laneq_u32 (uint32x4_t a,const int lane_a,uint32x4_t b,const int lane_b)
@@ -80,36 +77,6 @@ vcopyq_laneq_u32(uint32x4_t a, const int lane_a, }#endif -#if defined(RTE_ARCH_ARM64 ) -#if RTE_CC_IS_GNU && (GCC_VERSION <70000 ) - -/* NEON intrinsic vreinterpretq_u64_p128() is supported since GCC version 7 */ -static inline uint64x2_t -vreinterpretq_u64_p128 (poly128_t x) -{ -return (uint64x2_t )x; -} - -/* NEON intrinsic vreinterpretq_p64_u64() is supported since GCC version 7 */ -static inline poly64x2_t -vreinterpretq_p64_u64 (uint64x2_t x) -{ -return (poly64x2_t )x; -} - -/* NEON intrinsic vgetq_lane_p64() is supported since GCC version 7 */ -static inline poly64_t -vgetq_lane_p64 (poly64x2_t x,const int lane) -{ -RTE_ASSERT (lane >=0 && lane <=1 ); - -poly64_t *p = (poly64_t *)&x; - -return p[lane]; -} -#endif -#endif -/* * If (0 <= index <= 15), then call the ASIMD ext instruction on the * 128 bit regs v0 and v1 with the appropriate index.
lib/eal/ppc/include/rte_altivec.h +0 -1
@@ -6,7 +6,6 @@#ifndef _RTE_ALTIVEC_H_#define _RTE_ALTIVEC_H_ -/* To include altivec.h, GCC version must be >= 4.8 */ #include <altivec.h> /*
lib/meson.build +1 -1
@@ -244,7 +244,7 @@ foreach l:libraries cflags += '-DRTE_USE_FUNCTION_VERSIONING' endif cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l - if annotate_locks and cc.get_id() == 'clang' and cc.version().version_compare('>=3.5.0') + if annotate_locks and cc.get_id() == 'clang' cflags += '-DRTE_ANNOTATE_LOCKS' cflags += '-Wthread-safety' endif
lib/vhost/meson.build +2 -2
@@ -8,9 +8,9 @@ endif if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) +if toolchain == 'gcc' cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif (toolchain == 'clang' and cc.version().version_compare('>=3.7.0')) +elif toolchain == 'clang' cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h'))
lib/vhost/vhost.c +0 -16
@@ -128,16 +128,8 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, static __rte_always_inline voidvhost_set_bit (unsigned int nr,volatile uint8_t *addr) { -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* __sync_ built-ins are deprecated, but rte_atomic_ ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or_1 (addr, (1U << nr)); -#else rte_atomic_fetch_or_explicit((volatile uint8_t __rte_atomic *)addr, (1U << nr), rte_memory_order_relaxed); -#endif }static __rte_always_inline void
@@ -207,17 +199,9 @@ __vhost_log_cache_sync(struct virtio_net *dev, struct vhost_virtqueue *vq)for (i =0 ; i < vq->log_cache_nb_elem; i++) {struct log_cache_entry *elem = vq->log_cache + i; -#if defined(RTE_TOOLCHAIN_GCC ) && (GCC_VERSION <70100 ) -/* -* '__sync' builtins are deprecated, but 'rte_atomic' ones -* are sub-optimized in older GCC versions. -*/ -__sync_fetch_and_or (log_base + elem->offset, elem->val); -#else rte_atomic_fetch_or_explicit ( (unsigned long __rte_atomic *)(log_base + elem->offset), elem->val, rte_memory_order_relaxed); -#endif }rte_atomic_thread_fence (rte_memory_order_release);
Signature · 1 line
2.48.1
PATCH v3 2/2 virtio: simplify use of pragmas
In virtio/vhost there is use of pragmas to get clang or gcc to unroll loops. This was originally done using compiler version checks in the meson.build file, but with all supported gcc and clang versions now supporting the needed pragmas, we can simplify things by just having the headers check directly for gcc or clang.
--- drivers/net/virtio/meson.build | 5 ----- drivers/net/virtio/virtio_rxtx_packed.h | 16 ++++++---------- lib/vhost/meson.build | 5 ----- lib/vhost/vhost.h | 14 +++++--------- 4 files changed, 11 insertions(+), 29 deletions(-)
drivers/net/virtio/meson.build +0 -5
@@ -29,11 +29,6 @@ if arch_subdir == 'x86' if cc_has_avx512 cflags += ['-DVIRTIO_RXTX_PACKED_VEC'] sources_avx512 += files('virtio_rxtx_packed.c') - if toolchain == 'gcc' - cflags += '-DVIRTIO_GCC_UNROLL_PRAGMA' - elif toolchain == 'clang' - cflags += '-DVIRTIO_CLANG_UNROLL_PRAGMA' - endif endif cflags += ['-DVIRTIO_RXTX_VEC'] sources += files('virtio_rxtx_simple_sse.c')
drivers/net/virtio/virtio_rxtx_packed.h +6 -10
@@ -67,19 +67,15 @@#endif #define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1) -#ifdef VIRTIO_GCC_UNROLL_PRAGMA -#define virtio_for_each_try_unroll (iter, val, size) _Pragma("GCC unroll 4") \ - for (iter = val; iter < size; iter++) -#endif - -#ifdef VIRTIO_CLANG_UNROLL_PRAGMA +#if defined __clang__#define virtio_for_each_try_unroll (iter, val, size) _Pragma("unroll 4") \ for (iter = val; iter < size; iter++) -#endif - -#ifndef virtio_for_each_try_unroll -#define virtio_for_each_try_unroll (iter, val, size) \ +#elif defined __GNUC__ +#define virtio_for_each_try_unroll (iter, val, size) _Pragma("GCC unroll 4") \ for (iter = val; iter < size; iter++) +#else +#define virtio_for_each_try_unroll (iter, val, num) \ + for (iter = val; iter < num; iter++)#endif static inline void
lib/vhost/meson.build +0 -5
@@ -8,11 +8,6 @@ endif if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif -if toolchain == 'gcc' - cflags += '-DVHOST_GCC_UNROLL_PRAGMA' -elif toolchain == 'clang' - cflags += '-DVHOST_CLANG_UNROLL_PRAGMA' -endif dpdk_conf.set('RTE_LIBRTE_VHOST_POSTCOPY', cc.has_header('linux/userfaultfd.h')) cflags += no_wvla_cflag
lib/vhost/vhost.h +5 -9
@@ -69,17 +69,13 @@ sizeof(struct vring_packed_desc))#define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1) -#ifdef VHOST_GCC_UNROLL_PRAGMA -#define vhost_for_each_try_unroll (iter, val, size) _Pragma("GCC unroll 4") \ - for (iter = val; iter < size; iter++) -#endif - -#ifdef VHOST_CLANG_UNROLL_PRAGMA +#if defined __clang__#define vhost_for_each_try_unroll (iter, val, size) _Pragma("unroll 4") \ for (iter = val; iter < size; iter++) -#endif - -#ifndef vhost_for_each_try_unroll +#elif defined __GNUC__ +#define vhost_for_each_try_unroll (iter, val, size) _Pragma("GCC unroll 4") \ + for (iter = val; iter < size; iter++) +#else #define vhost_for_each_try_unroll (iter, val, num) \ for (iter = val; iter < num; iter++)#endif
Signature · 1 line
2.48.1
Quoted 7 lines · Bruce Richardson
DPDK now recommends compiler versions GCC 8+, and Clang 7+, so remove checks and workarounds for versions old than these.
Signed-off-by Bruce Richardson <[email protected]>Reviewed-by David Marchand <[email protected]>
Series applied, thanks Bruce.
Signature · 1 line
David Marchand