[v2,2/2] build: prevent accidentally building without NUMA support

Message ID 20230612171456.173378-2-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] build: change flag variable type to boolean |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build fail github build: failed
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson June 12, 2023, 5:14 p.m. UTC
  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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

---
V2: Limit check to linux only
---
 config/meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Bruce Richardson June 12, 2023, 5:59 p.m. UTC | #1
On Mon, Jun 12, 2023 at 06:14:56PM +0100, Bruce Richardson wrote:
> 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
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> ---
> 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
  
David Marchand June 13, 2023, 1:50 p.m. UTC | #2
On Mon, Jun 12, 2023 at 7:59 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Mon, Jun 12, 2023 at 06:14:56PM +0100, Bruce Richardson wrote:
> > 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
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >
> > ---
> > 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.]

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.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index 8aebccbbdc..00812976ba 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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)