Skip to contentSkip to conversation

Add developer mode to DPDK build

PATCH In review Bruce Richardson 2 participants 6 messages Feb 25, 2021 – Apr 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add developer mode to DPDK build

To allow more flexibility in enabling additional build checks to DPDK build process, we can add a developer mode option to the build. With this option enabled, extra checks of interest to DPDK developers rather than users can be done on the code, without having to worry about possible user impacts. The new option can be manually enabled or disabled by using meson configure, but by default is set to "auto" which means it is enabled if building from a git repo.

Once the developer mode is added in the first patch, the other patches of this series turn off a number of previous features for non-developer builds, since those features would only be of interest to DPDK devs.

Bruce Richardson (3):
build: enable a developer mode setting
build: hide debug messages in non-developer mode
build: limit symbol checks to developer mode

 doc/guides/contributing/coding_style.rst |  8 ++++++++
 drivers/meson.build                      | 26 ++++++++++++++----------
 lib/meson.build                          | 12 ++++++-----
 meson.build                              | 14 +++++++++++++
 meson_options.txt                        |  2 ++
 5 files changed, 46 insertions(+), 16 deletions(-)

--
2.27.0

#1 lore raw

PATCH 1/3 build: enable a developer mode setting

To allow support for additional build checks and tests only really relevant for developers, we add support for a developer mode option to DPDK. The default, "auto", value for this enables developer mode if a ".git" folder is found at the root of the source tree - as was the case with the previous "make" build system. There is also support for explicitly enabling or disabling this option using "meson configure" if so desired.

---
 doc/guides/contributing/coding_style.rst |  8 ++++++++
 meson.build                              | 14 ++++++++++++++
 meson_options.txt                        |  2 ++
 3 files changed, 24 insertions(+)
doc/guides/contributing/coding_style.rst +8 -0
index 734d1901b2..fdcd21861d 100644
@@ -798,6 +798,14 @@ Integrating with the Build System
 
 DPDK is built using the tools ``meson`` and ``ninja``.
 
+.. note::
+
+   In order to catch possible issues as soon as possible,
+   it is recommended that developers build DPDK in "developer mode" to enable additional checks.
+   By default, this mode is enabled if the build is being done from a git checkout,
+   but the mode can be manually enabled/disabled using the
+   ``developer_mode`` meson configuration option.
+
 Therefore all new component additions should include a ``meson.build`` file,
 and should be added to the component lists in the ``meson.build`` files in the
 relevant top-level directory:
meson.build +14 -0
index fcc4d4c900..8906b5e0b5 100644
@@ -11,6 +11,20 @@ project('DPDK', 'C',
 	meson_version: '>= 0.47.1'
 )
 
+# check for developer mode
+developer_mode = false
+if get_option('developer_mode').auto()
+	if meson.version().version_compare('>=0.53') # fs module available
+		fs = import('fs')
+		developer_mode = fs.is_dir('.git')
+	endif
+else
+	developer_mode = get_option('developer_mode').enabled()
+endif
+if developer_mode
+	message('## Building in Developer Mode ##')
+endif
+
 # set up some global vars for compiler, platform, configuration, etc.
 cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
meson_options.txt +2 -0
index 6eff62e47d..fe0f9ed501 100644
@@ -2,6 +2,8 @@
 
 option('check_includes', type: 'boolean', value: false,
 	description: 'build "chkincs" to verify each header file can compile alone')
+option('developer_mode', type: 'feature',
+	description: 'turn on additional build checks relevant for DPDK developers')
 option('disable_drivers', type: 'string', value: '',
 	description: 'Comma-separated list of drivers to explicitly disable.')
 option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>',
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/3 build: hide debug messages in non-developer mode

In reply to Bruce Richardson

The messages about what components have what dependency names, and information about function versioning not being supported on windows are only of interest to developers, so hide them when building in non-developer mode.

---
 drivers/meson.build |  6 ++++--
 lib/meson.build     | 10 ++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/meson.build +4 -2
index fdf76120ac..b26051c21c 100644
@@ -208,8 +208,10 @@ foreach subpath:subdirs
 			set_variable('shared_@0@'.format(lib_name), shared_dep)
 			set_variable('static_@0@'.format(lib_name), static_dep)
 			dependency_name = ''.join(lib_name.split('rte_'))
-			message('drivers/@0@: Defining dependency "@1@"'.format(
-					drv_path, dependency_name))
+			if developer_mode
+				message('drivers/@0@: Defining dependency "@1@"'.format(
+						drv_path, dependency_name))
+			endif
 		endif # build
 	endforeach
 
lib/meson.build +6 -4
index 7712aa4977..b378050299 100644
@@ -115,9 +115,9 @@ foreach l:libraries
 			shared_dep = declare_dependency(include_directories: includes)
 			static_dep = shared_dep
 		else
-			if is_windows and use_function_versioning
+			if is_windows and use_function_versioning and developer_mode
 				message('@0@: Function versioning is not supported by Windows.'
-				.format(name))
+						.format(name))
 			endif
 
 			if use_function_versioning
@@ -206,7 +206,9 @@ foreach l:libraries
 
 		set_variable('shared_rte_' + name, shared_dep)
 		set_variable('static_rte_' + name, static_dep)
-		message('lib/@0@: Defining dependency "@1@"'.format(
-				dir_name, name))
+		if developer_mode
+			message('lib/@0@: Defining dependency "@1@"'.format(
+					dir_name, name))
+		endif
 	endif # if build
 endforeach
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/3 build: limit symbol checks to developer mode

In reply to Bruce Richardson

The checking of symbols within each library and driver is only of interest to developers, so limit to developer mode only.

---
 drivers/meson.build | 20 +++++++++++---------
 lib/meson.build     |  2 +-
 2 files changed, 12 insertions(+), 10 deletions(-)
drivers/meson.build +11 -9
index b26051c21c..54af1f132f 100644
@@ -170,15 +170,17 @@ foreach subpath:subdirs
 				endif
 			else
 				lk_args = ['-Wl,--version-script=' + version_map]
-				# on unix systems check the output of the
-				# check-symbols.sh script, using it as a
-				# dependency of the .so build
-				lk_deps += custom_target(lib_name + '.sym_chk',
-					command: [check_symbols,
-						version_map, '@INPUT@'],
-					capture: true,
-					input: static_lib,
-					output: lib_name + '.sym_chk')
+				if developer_mode
+					# on unix systems check the output of the
+					# check-symbols.sh script, using it as a
+					# dependency of the .so build
+					lk_deps += custom_target(lib_name + '.sym_chk',
+						command: [check_symbols,
+							version_map, '@INPUT@'],
+						capture: true,
+						input: static_lib,
+						output: lib_name + '.sym_chk')
+				endif
 			endif
 
 			shared_lib = shared_library(lib_name,
lib/meson.build +1 -1
index b378050299..d003ad3dfe 100644
@@ -173,7 +173,7 @@ foreach l:libraries
 			endif
 
 			lk_deps = [version_map, def_file, mingw_map]
-			if not is_windows
+			if developer_mode and not is_windows
 				# on unix systems check the output of the
 				# check-symbols.sh script, using it as a
 				# dependency of the .so build
Signature · 1 line
2.27.0
#4 lore raw
In reply to Bruce Richardson

25/02/2021 16:29, Bruce Richardson:

Quoted 7 lines

To allow more flexibility in enabling additional build checks to DPDK build process, we can add a developer mode option to the build. With this option enabled, extra checks of interest to DPDK developers rather than users can be done on the code, without having to worry about possible user impacts. The new option can be manually enabled or disabled by using meson configure, but by default is set to "auto" which means it is enabled if building from a git repo.

Quoted 8 lines

Once the developer mode is added in the first patch, the other patches of this series turn off a number of previous features for non-developer builds, since those features would only be of interest to DPDK devs.

Bruce Richardson (3):
build: enable a developer mode setting
build: hide debug messages in non-developer mode
build: limit symbol checks to developer mode

Thanks for the quick patches.
I like the idea.

#5 lore raw

25/02/2021 20:50, Thomas Monjalon:

Quoted 12 lines

25/02/2021 16:29, Bruce Richardson:

Quoted 11 lines

To allow more flexibility in enabling additional build checks to DPDK build process, we can add a developer mode option to the build. With this option enabled, extra checks of interest to DPDK developers rather than users can be done on the code, without having to worry about possible user impacts. The new option can be manually enabled or disabled by using meson configure, but by default is set to "auto" which means it is enabled if building from a git repo.

Once the developer mode is added in the first patch, the other patches of this series turn off a number of previous features for non-developer builds, since those features would only be of interest to DPDK devs.

Quoted 7 lines
Quoted 4 lines

Bruce Richardson (3):
build: enable a developer mode setting
build: hide debug messages in non-developer mode
build: limit symbol checks to developer mode

Thanks for the quick patches.
I like the idea.

There was no comment and I found no issue.
Applied, thanks