build: change flag variable type to boolean
Subsystems (2)
PATCH v3 1/2 build: change flag variable type to boolean
The has_libnuma flag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.
--- config/arm/meson.build | 2 +- config/meson.build | 4 ++-- lib/eal/linux/meson.build | 2 +- lib/vhost/meson.build | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
config/arm/meson.build +1 -1
@@ -592,7 +592,7 @@ if update_flags part_number = soc_config['part_number'] soc_flags = soc_config.get('flags', []) if not soc_config.get('numa', true) - has_libnuma = 0 + has_libnuma = false endif disable_drivers += ',' + soc_config.get('disable_drivers', '')
config/meson.build +2 -2
@@ -174,7 +174,7 @@ if link_lib != '' endif # check for libraries used in multiple places in DPDK -has_libnuma = 0 +has_libnuma = false find_libnuma = true if meson.is_cross_build() and not meson.get_cross_property('numa', true) # don't look for libnuma if explicitly disabled in cross build
@@ -184,7 +184,7 @@ if find_libnuma numa_dep = cc.find_library('numa', required: false) if numa_dep.found() and cc.has_header('numaif.h') dpdk_conf.set10('RTE_HAS_LIBNUMA', true) - has_libnuma = 1 + has_libnuma = true add_project_link_arguments('-lnuma', language: 'c') dpdk_extra_ldflags += '-lnuma' endif
lib/eal/linux/meson.build +1 -1
@@ -20,6 +20,6 @@ sources += files( ) deps += ['kvargs', 'telemetry'] -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true) endif
lib/vhost/meson.build +1 -1
@@ -5,7 +5,7 @@ if not is_linux build = false reason = 'only supported on Linux' endif -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
Signature · 1 line
2.39.2
PATCH v3 2/2 build: prevent accidentally building without NUMA support
When libnuma development package is missing on a system, DPDK can still be built but will be missing much-needed support for NUMA memory management. This may later cause issues at runtime if the resulting binary is run on a NUMA system.
We can reduce the incidence of such runtime error by ensuring that, for native builds*, libnuma is present - unless the user actually specifies via "max_numa_nodes" that they don't require NUMA support. Having this as an error condition is also in keeping with what is documented in the Linux GSG doc, where libnuma is listed as a requirement for building DPDK [1].
* NOTE: cross-compilation builds have a different logic set, with a separate "numa" value indicating if numa support is necessary.
[1] https://doc.dpdk.org/guides-23.03/linux_gsg/sys_reqs.html
--- config/meson.build | 6 ++++++ 1 file changed, 6 insertions(+)
config/meson.build +6 -0
@@ -381,6 +381,12 @@ endif if not dpdk_conf.has('RTE_MAX_NUMA_NODES') error('Number of NUMA nodes not specified.') endif +if not meson.is_cross_build() and dpdk_conf.get('RTE_MAX_NUMA_NODES') > 1 and not has_libnuma + error(''' +No NUMA library (development package) found, yet DPDK configured for multiple NUMA nodes. +Please install libnuma, or set 'max_numa_nodes' option to '1' to build without NUMA support. +''') +endif # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
Signature · 1 line
2.39.2
PATCH v2 1/2 build: change flag variable type to boolean
In reply to Bruce RichardsonThe has_libnuma flag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.
--- config/arm/meson.build | 2 +- config/meson.build | 4 ++-- lib/eal/linux/meson.build | 2 +- lib/vhost/meson.build | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
config/arm/meson.build +1 -1
@@ -592,7 +592,7 @@ if update_flags part_number = soc_config['part_number'] soc_flags = soc_config.get('flags', []) if not soc_config.get('numa', true) - has_libnuma = 0 + has_libnuma = false endif disable_drivers += ',' + soc_config.get('disable_drivers', '')
config/meson.build +2 -2
@@ -174,7 +174,7 @@ if link_lib != '' endif # check for libraries used in multiple places in DPDK -has_libnuma = 0 +has_libnuma = false find_libnuma = true if meson.is_cross_build() and not meson.get_cross_property('numa', true) # don't look for libnuma if explicitly disabled in cross build
@@ -184,7 +184,7 @@ if find_libnuma numa_dep = cc.find_library('numa', required: false) if numa_dep.found() and cc.has_header('numaif.h') dpdk_conf.set10('RTE_HAS_LIBNUMA', true) - has_libnuma = 1 + has_libnuma = true add_project_link_arguments('-lnuma', language: 'c') dpdk_extra_ldflags += '-lnuma' endif
lib/eal/linux/meson.build +1 -1
@@ -20,6 +20,6 @@ sources += files( ) deps += ['kvargs', 'telemetry'] -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true) endif
lib/vhost/meson.build +1 -1
@@ -5,7 +5,7 @@ if not is_linux build = false reason = 'only supported on Linux' endif -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
Signature · 1 line
2.39.2
PATCH v2 2/2 build: prevent accidentally building without NUMA support
When libnuma development package is missing on a system, DPDK can still be built but will be missing much-needed support for NUMA memory management. This may later cause issues at runtime if the resulting binary is run on a NUMA system.
We can reduce the incidence of such runtime error by ensuring that, for native builds*, libnuma is present - unless the user actually specifies via "max_numa_nodes" that they don't require NUMA support. Having this as an error condition is also in keeping with what is documented in the Linux GSG doc, where libnuma is listed as a requirement for building DPDK [1].
* NOTE: cross-compilation builds have a different logic set, with a separate "numa" value indicating if numa support is necessary.
[1] https://doc.dpdk.org/guides-23.03/linux_gsg/sys_reqs.html
---
V2: Limit check to linux only
--- config/meson.build | 9 +++++++++ 1 file changed, 9 insertions(+)
config/meson.build +9 -0
@@ -381,6 +381,15 @@ endif if not dpdk_conf.has('RTE_MAX_NUMA_NODES') error('Number of NUMA nodes not specified.') endif +if (is_linux and + dpdk_conf.get('RTE_MAX_NUMA_NODES') > 1 and + not meson.is_cross_build() and + not has_libnuma) + error(''' +No NUMA library (development package) found, yet DPDK configured for multiple NUMA nodes. +Please install libnuma, or set 'max_numa_nodes' option to '1' to build without NUMA support. +''') +endif # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
Signature · 1 line
2.39.2
Re: [PATCH v2 2/2] build: prevent accidentally building without NUMA support
Quoted 17 lines · Bruce Richardson
When libnuma development package is missing on a system, DPDK can still be built but will be missing much-needed support for NUMA memory management. This may later cause issues at runtime if the resulting binary is run on a NUMA system.
We can reduce the incidence of such runtime error by ensuring that, for native builds*, libnuma is present - unless the user actually specifies via "
max_numa_nodes" that they don't require NUMA support. Having this as an error condition is also in keeping with what is documented in the Linux GSG doc, where libnuma is listed as a requirement for building DPDK [1].* NOTE: cross-compilation builds have a different logic set, with a separate "numa" value indicating if numa support is necessary.
[1] https://doc.dpdk.org/guides-23.03/linux_gsg/sys_reqs.html
Quoted 8 lines
Signed-off-by Bruce Richardson <[email protected]>---
V2: Limit check to linux only--- config/meson.build | 9 +++++++++ 1 file changed, 9 insertions(+)
I see this patch has failures reported in the CI, due to some of the systems not having libnuma installed. I'd view that as a false positive, since libnuma is effectively a mandatory requirement for building DPDK to run on most systems. [And this patch still provides a way to build without it - that way just has to be selected deliberately, rather than it being chosen by default, without the user being aware of the omission.]
Regards,
/Bruce
Re: [PATCH v2 2/2] build: prevent accidentally building without NUMA support
Quoted 27 lines · Bruce Richardson
Quoted 17 lines · Bruce Richardson
When libnuma development package is missing on a system, DPDK can still be built but will be missing much-needed support for NUMA memory management. This may later cause issues at runtime if the resulting binary is run on a NUMA system.
We can reduce the incidence of such runtime error by ensuring that, for native builds*, libnuma is present - unless the user actually specifies via "
max_numa_nodes" that they don't require NUMA support. Having this as an error condition is also in keeping with what is documented in the Linux GSG doc, where libnuma is listed as a requirement for building DPDK [1].* NOTE: cross-compilation builds have a different logic set, with a separate "numa" value indicating if numa support is necessary.
[1] https://doc.dpdk.org/guides-23.03/linux_gsg/sys_reqs.html
Quoted 8 lines
Signed-off-by Bruce Richardson <[email protected]>---
V2: Limit check to linux only--- config/meson.build | 9 +++++++++ 1 file changed, 9 insertions(+)
Quoted 6 lines
I see this patch has failures reported in the CI, due to some of the systems not having libnuma installed. I'd view that as a false positive, since libnuma is effectively a mandatory requirement for building DPDK to run on most systems. [And this patch still provides a way to build without it - that way just has to be selected deliberately, rather than it being chosen by default, without the user being aware of the omission.]
The Intel CI lab job failing seems to be an issue in their RHEL 8.7 environment. Can you ping them to figure it out?
For the i386 job in GHA.. either we install a 32bits numa library, or we can silence this by setting max_numa_nodes to 1.
Signature · 1 line
David Marchand
Quoted 5 lines · Bruce Richardson
The
has_libnumaflag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.Signed-off-by Bruce Richardson <[email protected]>
This patch lgtm (with or without the suggestion on config/arm below).
[snip]
config/arm/meson.build if update_flags · line 596
Quoted 11 lines
config/arm/meson.build +1
-1@@ -592,7 +592,7 @@ if update_flags part_number = soc_config['part_number'] soc_flags = soc_config.get('flags', []) if not soc_config.get('numa', true) - has_libnuma = 0 + has_libnuma = false endif
Maybe has_libnuma = soc_config.get('numa', true) ?
config/arm/meson.build if update_flags · line 598
Quoted 2 lines
config/arm/meson.build +0
-0disable_drivers += ',' + soc_config.get('disable_drivers', '')
The same cleanup could be done to has_libfdt. Additionnally, I wonder if we could remove those "== true" or "== false" checks here and there in meson.build files.
Signature · 1 line
David Marchand
Quoted 29 lines · David Marchand
Quoted 5 lines · Bruce Richardson
The
has_libnumaflag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.Signed-off-by Bruce Richardson <[email protected]>This patch lgtm (with or without the suggestion on config/arm below).
Reviewed-by David Marchand <[email protected]>[snip]
config/arm/meson.build if update_flags · line 596
Quoted 11 lines
config/arm/meson.build +1
-1@@ -592,7 +592,7 @@ if update_flags part_number = soc_config['part_number'] soc_flags = soc_config.get('flags', []) if not soc_config.get('numa', true) - has_libnuma = 0 + has_libnuma = false endifMaybe
has_libnuma=soc_config.get('numa', true)?Quoted 1 line
Quoted 8 lines
Quoted 1 line
disable_drivers += ',' + soc_config.get('disable_drivers', '')The same cleanup could be done to
has_libfdt. Additionnally, I wonder if we could remove those "== true" or "== false" checks here and there in meson.build files.
I will take a look, and I think I'll also split this patch off from the patch 2, to add an error for libnuma, since the two aren't really linked, and this patch should probably be the simpler merge. I'll see about doing a set for just int to boolean cleanups if I get the chance.
/Bruce
v3 cover replace int flags with booleans
In reply to Bruce Richardsonin meson.build files, some flags were being treated as integers rather than using the more logical option of booleans. Fix this.
V3: drop the patch requiring libnuma from this set, to make this only
a simple set changing the types of the flag. The other patch will be submitted separately for better tracking.
Bruce Richardson (2):
build: change NUMA flag variable type to boolean
build: change libfdt flag variable type to boolean
config/arm/meson.build | 2 +- config/meson.build | 8 ++++---- drivers/net/ipn3ke/meson.build | 2 +- drivers/raw/ifpga/meson.build | 2 +- lib/eal/linux/meson.build | 2 +- lib/vhost/meson.build | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-)
--
2.39.2
PATCH v3 1/2 build: change NUMA flag variable type to boolean
The has_libnuma flag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.
--- config/arm/meson.build | 2 +- config/meson.build | 4 ++-- lib/eal/linux/meson.build | 2 +- lib/vhost/meson.build | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
config/arm/meson.build +1 -1
@@ -592,7 +592,7 @@ if update_flags part_number = soc_config['part_number'] soc_flags = soc_config.get('flags', []) if not soc_config.get('numa', true) - has_libnuma = 0 + has_libnuma = false endif disable_drivers += ',' + soc_config.get('disable_drivers', '')
config/meson.build +2 -2
@@ -174,7 +174,7 @@ if link_lib != '' endif # check for libraries used in multiple places in DPDK -has_libnuma = 0 +has_libnuma = false find_libnuma = true if meson.is_cross_build() and not meson.get_cross_property('numa', true) # don't look for libnuma if explicitly disabled in cross build
@@ -184,7 +184,7 @@ if find_libnuma numa_dep = cc.find_library('numa', required: false) if numa_dep.found() and cc.has_header('numaif.h') dpdk_conf.set10('RTE_HAS_LIBNUMA', true) - has_libnuma = 1 + has_libnuma = true add_project_link_arguments('-lnuma', language: 'c') dpdk_extra_ldflags += '-lnuma' endif
lib/eal/linux/meson.build +1 -1
@@ -20,6 +20,6 @@ sources += files( ) deps += ['kvargs', 'telemetry'] -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true) endif
lib/vhost/meson.build +1 -1
@@ -5,7 +5,7 @@ if not is_linux build = false reason = 'only supported on Linux' endif -if has_libnuma == 1 +if has_libnuma dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) endif if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0'))
Signature · 1 line
2.39.2
PATCH v3 2/2 build: change libfdt flag variable type to boolean
In reply to Bruce RichardsonThe has_libfdt flag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.
--- config/meson.build | 4 ++-- drivers/net/ipn3ke/meson.build | 2 +- drivers/raw/ifpga/meson.build | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
config/meson.build +2 -2
@@ -190,11 +190,11 @@ if find_libnuma endif endif -has_libfdt = 0 +has_libfdt = false fdt_dep = cc.find_library('fdt', required: false) if fdt_dep.found() and cc.has_header('fdt.h') dpdk_conf.set10('RTE_HAS_LIBFDT', true) - has_libfdt = 1 + has_libfdt = true add_project_link_arguments('-lfdt', language: 'c') dpdk_extra_ldflags += '-lfdt' endif
drivers/net/ipn3ke/meson.build +1 -1
@@ -15,7 +15,7 @@ endif # rte_eth_switch_domain_free() # -if has_libfdt == 0 +if not has_libfdt build = false reason = 'missing dependency, "libfdt"' subdir_done()
drivers/raw/ifpga/meson.build +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -if has_libfdt == 0 +if not has_libfdt build = false reason = 'missing dependency, "libfdt"' subdir_done()
Signature · 1 line
2.39.2
Re: [PATCH v3 2/2] build: change libfdt flag variable type to boolean
Quoted 5 lines · Bruce Richardson
The
has_libfdtflag was using 0 and 1 integer values, instead of the more appropriate boolean type. Change to use true/false instead.Signed-off-by Bruce Richardson <[email protected]>
Signature · 1 line
David Marchand
Re: [PATCH v3 0/2] replace int flags with booleans
In reply to Bruce RichardsonQuoted 11 lines · Bruce Richardson
in meson.build files, some flags were being treated as integers rather than using the more logical option of booleans. Fix this.
V3: drop the patch requiring libnuma from this set, to make this only
a simple set changing the types of the flag. The other patch will be submitted separately for better tracking.Bruce Richardson (2):
build: change NUMA flag variable type to boolean
build: change libfdt flag variable type to boolean
Series applied, thanks Bruce.
Signature · 1 line
David Marchand