Skip to contentSkip to conversation

build/pkg-config: remove machine arch flag

RFC PATCH In review Bruce Richardson 5 participants 9 messages Dec 11, 2020 – Jun 15, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 build/pkg-config: remove machine arch flag

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]>
Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

---
 buildtools/pkg-config/meson.build | 2 +-
 config/meson.build                | 1 +
 config/x86/meson.build            | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
buildtools/pkg-config/meson.build +1 -1
index 5f1930428..8e2e24681 100644
@@ -2,7 +2,7 @@
 # Copyright(c) 2020 Intel Corporation
 
 pkg = import('pkgconfig')
-pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+pkg_extra_cflags = ['-include', 'rte_config.h'] + pkg_config_machine_args
 if is_freebsd
 	pkg_extra_cflags += ['-D__BSD_VISIBLE']
 endif
config/meson.build +1 -0
index 3ddcc3539..d58ff781d 100644
@@ -100,6 +100,7 @@ if host_machine.cpu_family().startswith('ppc')
 else
 	machine_args += '-march=' + machine
 endif
+pkg_config_machine_args = machine_args # may be overriden late per arch
 
 toolchain = cc.get_id()
 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
config/x86/meson.build +3 -0
index 31bfa63b1..fcd75502e 100644
@@ -16,6 +16,9 @@ if cc.get_define('__SSE4_2__', args: machine_args) == ''
 	machine_args += '-msse4'
 endif
 
+# require SSE4.2 in pkg-config file - don't use -march
+pkg_config_machine_args = ['-msse4']
+
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
 foreach f:base_flags
 	compile_time_cpuflags += ['RTE_CPUFLAG_' + f]

--
2.27.0

#1 lore raw
Quoted 24 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

Quoted 8 lines

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]>
Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

Support for Altivec would be the equivalent here for PPC and I'm not aware of any additional flags required for supported POWER CPUs on DPDK.
I can't speak to P10 requirements yet but the proposed change is a
don't care for me.

Dave

#2 lore raw
In reply to Bruce Richardson
Quoted 24 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

Quoted 9 lines

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]>
Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

Ping for further thoughts or input on this patch.

/Bruce

Quoted 48 lines
---
 buildtools/pkg-config/meson.build | 2 +-
 config/meson.build                | 1 +
 config/x86/meson.build            | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
buildtools/pkg-config/meson.build +1 -1
index 5f1930428..8e2e24681 100644
@@ -2,7 +2,7 @@
 # Copyright(c) 2020 Intel Corporation
 
 pkg = import('pkgconfig')
-pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+pkg_extra_cflags = ['-include', 'rte_config.h'] + pkg_config_machine_args
 if is_freebsd
 	pkg_extra_cflags += ['-D__BSD_VISIBLE']
 endif
config/meson.build +1 -0
index 3ddcc3539..d58ff781d 100644
@@ -100,6 +100,7 @@ if host_machine.cpu_family().startswith('ppc')
 else
 	machine_args += '-march=' + machine
 endif
+pkg_config_machine_args = machine_args # may be overriden late per arch
 
 toolchain = cc.get_id()
 dpdk_conf.set_quoted('RTE_TOOLCHAIN', toolchain)
config/x86/meson.build +3 -1
index 31bfa63b1..fcd75502e 100644
@@ -16,6 +16,9 @@ if cc.get_define('__SSE4_2__', args: machine_args) == ''
 	machine_args += '-msse4'
 endif
 
+# require SSE4.2 in pkg-config file - don't use -march
+pkg_config_machine_args = ['-msse4']
+
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
 foreach f:base_flags
 	compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
--

2.27.0

#3 lore raw
Quoted 34 lines · Bruce Richardson
Quoted 24 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

Quoted 8 lines

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]> for Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such
platforms. For example - is setting 'pkg_config_machine_args' to
'machine_args' by default necessary behaviour?

Quoted 1 line

Ping for further thoughts or input on this patch.

On initial inspection I don't see any additional value for PPC systems.
Selection of a CPU through -mcpu implies a full ISA for that CPU,
including things like vector extensions, at least with respect to the minimum supported POWER8 CPU (ISA 2.07) and later ISAs. The values of machine_args and pkg_config_machine_args should be identical in all cases I can think of.

If a third party OpenPOWER CPU comes along some time in the future then the requirements may change.

Dave

#4 lore raw
Quoted 39 lines · David Christensen
Quoted 35 lines · Bruce Richardson
Quoted 33 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]> for Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

Quoted 1 line
Quoted 1 line

Ping for further thoughts or input on this patch.

Armv8 has dedicated config(taken least cpu flags which supports all armv8) for this purpose config/arm/arm64_armv8_linux_gcc. So this change looks good to me. @Ruifeng Wang (Arm Technology China) Any comments?

Quoted 16 lines

On initial inspection I don't see any additional value for PPC systems.
Selection of a CPU through -mcpu implies a full ISA for that CPU,
including things like vector extensions, at least with respect to the minimum supported POWER8 CPU (ISA 2.07) and later ISAs. The values of machine_args and pkg_config_machine_args should be identical in all cases I can think of.

If a third party OpenPOWER CPU comes along some time in the future then the requirements may change.

Dave

#5 lore raw
Quoted 56 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Thursday, September 16, 2021 11:43 AM
To: David Christensen <[email protected]>
Cc: Bruce Richardson <[email protected]>; dpdk-dev <[email protected]>; Luca Boccassi <[email protected]>; David Marchand <[email protected]>; [email protected]; Ilya Maximets <[email protected]>; [email protected]; Ruifeng Wang <[email protected]>; Honnappa Nagarahalli <[email protected]>; Ananyev, Konstantin <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag

Quoted 20 lines · David Christensen
Quoted 16 lines · Bruce Richardson
Quoted 15 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-

msse4"

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]> for Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Ping for further thoughts or input on this patch.

Armv8 has dedicated config(taken least cpu flags which supports all armv8) for this purpose config/arm/arm64_armv8_linux_gcc. So this change looks good to me. @Ruifeng Wang (Arm Technology China) Any comments?

Agree. For distro build, only armv8-a is requested. The change looks fine.

Thanks,
Ruifeng

Quoted 17 lines
Quoted 17 lines

On initial inspection I don't see any additional value for PPC systems.
Selection of a CPU through -mcpu implies a full ISA for that CPU,
including things like vector extensions, at least with respect to the minimum supported POWER8 CPU (ISA 2.07) and later ISAs. The values of machine_args and pkg_config_machine_args should be identical in all cases I can think of.

If a third party OpenPOWER CPU comes along some time in the future then the requirements may change.

Dave

#6 lore raw
Quoted 78 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ruifeng Wang
Sent: Thursday, September 16, 2021 6:17 PM
To: Jerin Jacob <[email protected]>; David Christensen <[email protected]>
Cc: Bruce Richardson <[email protected]>; dpdk-dev <[email protected]>; Luca Boccassi <[email protected]>; David Marchand <[email protected]>; [email protected]; Ilya Maximets <[email protected]>; [email protected]; Honnappa Nagarahalli <[email protected]>; Ananyev, Konstantin <[email protected]>; Ferruh Yigit <[email protected]>; nd <[email protected]>
Subject: Re: [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag

Quoted 14 lines

-----Original Message-----
From: Jerin Jacob <[email protected]>
Sent: Thursday, September 16, 2021 11:43 AM
To: David Christensen <[email protected]>
Cc: Bruce Richardson <[email protected]>; dpdk-dev <[email protected]>; Luca Boccassi <[email protected]>; David Marchand <[email protected]>; [email protected]; Ilya Maximets <[email protected]>; [email protected]; Ruifeng Wang <[email protected]>; Honnappa Nagarahalli <[email protected]>; Ananyev, Konstantin <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [dpdk-dev] [RFC PATCH] build/pkg-config: remove machine arch flag

Quoted 13 lines
Quoted 10 lines · David Christensen
Quoted 6 lines · Bruce Richardson
Quoted 5 lines · Bruce Richardson

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via
RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over

to

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures
- x86, arm and ppc - can choose if and how to override this value

themselves.

Quoted 24 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-

msse4"

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

---

Quoted 9 lines

CC: Jerin Jacob <[email protected]>
CC: Ruifeng Wang <[email protected]>
CC: Honnappa Nagarahalli <[email protected]>
CC: David Christensen <[email protected]> for Feedback requested from ARM and PPC maintainers as to this change and what flags, if any, need to be in the .pc file for DPDK on such platforms. For example - is setting 'pkg_config_machine_args' to 'machine_args' by default necessary behaviour?

Ping for further thoughts or input on this patch.

Quoted 7 lines
Quoted 5 lines

Armv8 has dedicated config(taken least cpu flags which supports all armv8) for this purpose config/arm/arm64_armv8_linux_gcc. So this change looks good to me. @Ruifeng Wang (Arm Technology China) Any comments?

Agree. For distro build, only armv8-a is requested. The change looks fine.

This is fine if "cross-file" is provided when doing distro build.
However, when "-Dmachine=default"/"-Dplatform=default" is used instead of "cross-file" to do distro build, current change in config/meson.build will lead to " pkg_config_machine_args = -march=generic". This is because generic build is handled by subsequent arch specific config on Arm.

I think moving the change in config/meson.build down below line #307 subdir(arch_subdir) will address aforementioned issue. As by the time, machine_args has been updated with proper value.

Quoted 20 lines

Thanks,
Ruifeng

Quoted 17 lines
Quoted 17 lines

On initial inspection I don't see any additional value for PPC systems.
Selection of a CPU through -mcpu implies a full ISA for that CPU,
including things like vector extensions, at least with respect to the minimum supported POWER8 CPU (ISA 2.07) and later ISAs. The values of machine_args and pkg_config_machine_args should be identical in all cases I can think of.

If a third party OpenPOWER CPU comes along some time in the future then the requirements may change.

Dave

#7 lore raw
In reply to Bruce Richardson
Quoted 15 lines · On Fri, 11 Dec 2020 15:51:11 +0000 Bruce Richardson…

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

Quoted 7 lines

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

This looks fine, and can see no negatives in the comments. Could you rebase and resubmit a new version if still relevant?

#8 lore raw
Quoted 24 lines · Stephen Hemminger
Quoted 21 lines · On Fri, 11 Dec 2020 15:51:11 +0000 Bruce Richardson…

Traditionally any apps built using DPDK had to support the same instruction sets as supported when the DPDK SDK itself was built, since that was "leaked" through to the end-app and DPDK headers via RTE_MACHINE_CPUFLAG_* values. Therefore, when converting over to meson for app build correctness the "-march=" flag was included in the pkg-config cflags output.

However, since the DPDK-specific CPU flags are now obsolete, and we instead check directly for compiler-defined flags, we should no longer need to force the exact same architecture match in all cases. To faciliate such flexibility, a new pkg_config_machine_args array - which defaults to the existing machine_args array has been defined. The individual architectures - x86, arm and ppc - can choose if and how to override this value themselves.

For x86, since SSE4.2 is the minimum instruction-set level needed to run DPDK, and since some header files assume that minimum level of instruction set support, we override the "-march=" value with "-msse4" for the pkg-config file. This allows end applications to set their own "march" value while still ensuring valid DPDK compilation.

Quoted 5 lines
Quoted 1 line

This looks fine, and can see no negatives in the comments. Could you rebase and resubmit a new version if still relevant?

There seemed to be a general lack of interest in it, sadly, so not sure I'll resubmit.