From patchwork Wed Oct 23 01:07:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61713 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E72001BFFB; Wed, 23 Oct 2019 11:25:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D60871BFEE for ; Wed, 23 Oct 2019 11:25:49 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983767" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:47 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com Date: Wed, 23 Oct 2019 01:07:49 +0000 Message-Id: <20191023010754.65172-2-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 1/6] build: enable debug info by default in meson builds X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Bruce Richardson We can turn on debug info by default in meson builds, since it has no performance penalty. This is done by changing the default build type from "release" to "debugoptimized". Since the latter using O2, we can using extra cflags to override that back to O3, which will make little real difference for actual debugging. For real debug builds, the user can still do "meson --buildtype=debug ..." and to remove the debug info "meson --buildtype=release ..." can be used. These are all standard meson options. The advantage of having debug builds by default using meson settings is that we can then add checks for ABI compatibility into each build, and disable them if we detect that the user has turned off the debug info. Signed-off-by: Bruce Richardson --- meson.build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index c5a3dda26..b77ccd6ef 100644 --- a/meson.build +++ b/meson.build @@ -7,10 +7,16 @@ project('DPDK', 'C', version: run_command(find_program('cat', 'more'), files('VERSION')).stdout().strip(), license: 'BSD', - default_options: ['buildtype=release', 'default_library=static'], + default_options: ['buildtype=debugoptimized', + 'default_library=static'], meson_version: '>= 0.47.1' ) +# for default "debugoptimized" builds override optimization level 2 with 3 +if get_option('buildtype') == 'debugoptimized' + add_project_arguments('-O3', language: 'c') +endif + # set up some global vars for compiler, platform, configuration, etc. cc = meson.get_compiler('c') dpdk_conf = configuration_data() From patchwork Wed Oct 23 01:07:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61715 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C23A21C00D; Wed, 23 Oct 2019 11:25:56 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 724D01BFEE for ; Wed, 23 Oct 2019 11:25:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983771" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:48 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com Date: Wed, 23 Oct 2019 01:07:50 +0000 Message-Id: <20191023010754.65172-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 2/6] build: use meson warning levels X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Bruce Richardson Rather than trying to manage all the cflags ourselves, we can use meson warning levels to give the user more control. We remove the Wextra flag and rely on meson to add it, by bumping up our default warning level. Signed-off-by: Bruce Richardson --- config/meson.build | 40 +++++++++++++++++++++------------------- meson.build | 3 ++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/config/meson.build b/config/meson.build index b383e79c0..3bcfe0668 100644 --- a/config/meson.build +++ b/config/meson.build @@ -141,31 +141,33 @@ endif # add -include rte_config to cflags add_project_arguments('-include', 'rte_config.h', language: 'c') -# enable extra warnings and disable any unwanted warnings +# enable extra warnings and disable any unwanted warnings. "-Wall" is added +# by meson at warning level 1, and "-Wextra" at level 2, so we can omit +# those. Add extra warnings at level 2 or above. (2 is default level). warning_flags = [ - # -Wall is added by meson by default, so add -Wextra only - '-Wextra', - - # additional warnings in alphabetical order - '-Wcast-qual', - '-Wdeprecated', - '-Wformat-nonliteral', - '-Wformat-security', - '-Wmissing-declarations', - '-Wmissing-prototypes', - '-Wnested-externs', - '-Wold-style-definition', - '-Wpointer-arith', - '-Wsign-compare', - '-Wstrict-prototypes', - '-Wundef', - '-Wwrite-strings', - # globally disabled warnings '-Wno-address-of-packed-member', '-Wno-packed-not-aligned', '-Wno-missing-field-initializers' ] +if get_option('warning_level').to_int() >= 2 + warning_flags += [ + # additional warnings in alphabetical order + '-Wcast-qual', + '-Wdeprecated', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wmissing-declarations', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wpointer-arith', + '-Wsign-compare', + '-Wstrict-prototypes', + '-Wundef', + '-Wwrite-strings', + ] +endif if not dpdk_conf.get('RTE_ARCH_64') # for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!! warning_flags += '-Wno-pointer-to-int-cast' diff --git a/meson.build b/meson.build index b77ccd6ef..dd83b0bcb 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,8 @@ project('DPDK', 'C', files('VERSION')).stdout().strip(), license: 'BSD', default_options: ['buildtype=debugoptimized', - 'default_library=static'], + 'default_library=static', + 'warning_level=2'], meson_version: '>= 0.47.1' ) From patchwork Wed Oct 23 01:07:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61716 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 188331C01E; Wed, 23 Oct 2019 11:26:00 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2F6041BFF5 for ; Wed, 23 Oct 2019 11:25:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983780" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:49 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 23 Oct 2019 01:07:51 +0000 Message-Id: <20191023010754.65172-4-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 3/6] devtools: add abi dump generation script X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a script to generate ABI dump files. These files will be required to perform ABI compatibility checks during the build later in the patchset. This script should be run on a DPDK version with a stable ABI. Since this is a tool designed for human use, we simplify it to just work off a whole build directory, taking the parameter of the builddir and generating the lib|drivers/abi dir. This is hardcoded into the script since the meson build expects the .dump files in these directories. Signed-off-by: Kevin Laatz Signed-off-by: Bruce Richardson --- devtools/gen-abi-dump.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 devtools/gen-abi-dump.sh diff --git a/devtools/gen-abi-dump.sh b/devtools/gen-abi-dump.sh new file mode 100755 index 000000000..ffedef10c --- /dev/null +++ b/devtools/gen-abi-dump.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +builddir=$1 + +if [ -z "$builddir" ] ; then + echo "Usage: $(basename $0) build_dir" + exit 1 +fi + +if [ ! -d "$builddir" ] ; then + echo "Error: build directory, '$builddir', doesn't exist" + exit 1 +fi + +for d in lib drivers ; do + mkdir -p $d/abi + + for f in $builddir/$d/*.so* ; do + test -L "$f" && continue + + libname=$(basename $f) + abidw --out-file $d/abi/${libname%.so*}.dump $f || exit 1 + done +done From patchwork Wed Oct 23 01:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61717 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 537781C029; Wed, 23 Oct 2019 11:26:04 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id AAC151BFF7 for ; Wed, 23 Oct 2019 11:25:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983784" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:50 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 23 Oct 2019 01:07:52 +0000 Message-Id: <20191023010754.65172-5-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 4/6] build: add meson option for abi related checks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a new meson option for running ABI compatibility checks during the build. If enabled, the lib and drivers .so files will be compared against any existing ABI dump files in lib|drivers/abi of the source directory. If there are any incompatibilities, the build will fail and display the incompatibility. Signed-off-by: Kevin Laatz --- meson_options.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson_options.txt b/meson_options.txt index 000e38fd9..aefab391a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ # Please keep these options sorted alphabetically. +option('abi_compat_checks', type: 'boolean', value: true, + description: 'enable abi compatibility checks to run during the build') option('allow_invalid_socket_id', type: 'boolean', value: false, description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly') option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-', From patchwork Wed Oct 23 01:07:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61718 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8A4391C031; Wed, 23 Oct 2019 11:26:07 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 233B61BFF2 for ; Wed, 23 Oct 2019 11:25:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983790" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:52 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 23 Oct 2019 01:07:53 +0000 Message-Id: <20191023010754.65172-6-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 5/6] build: add lib abi checks to meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds the ABI compatibility check for the lib directory to the meson build. If enabled, the ABI compatibility checks will run for all .so's in the lib directory (provided a matching dump file exists). The build will fail if an ABI incompatibility is detected. Signed-off-by: Kevin Laatz Signed-off-by: Bruce Richardson --- buildtools/meson.build | 4 ++++ lib/meson.build | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/buildtools/meson.build b/buildtools/meson.build index 1ec2c2f95..a895c791c 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -7,6 +7,10 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh') check_experimental_syms = find_program('check-experimental-syms.sh') +if get_option('abi_compat_checks') + abidiff = find_program('abidiff') +endif + # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found() diff --git a/lib/meson.build b/lib/meson.build index 7849ac9f7..da180fb37 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -146,7 +146,9 @@ foreach l:libraries version_map, '@INPUT@'], capture: true, input: static_lib, - output: name + '.exp_chk') + output: name + '.exp_chk', + install: false, + build_by_default: get_option('abi_compat_checks')) endif shared_lib = shared_library(libname, @@ -164,6 +166,19 @@ foreach l:libraries include_directories: includes, dependencies: shared_deps) + if is_experimental == 0 + custom_target(dir_name + '.abi_chk', + command: [abidiff, + meson.source_root() + '/lib/abi/' + + dir_name + '.dump', + '@INPUT@'], + input: shared_lib, + output: dir_name + '.abi_chk', + capture: true, + install: false, + build_by_default: get_option('abi_compat_checks')) + endif + dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries endif # sources.length() > 0 From patchwork Wed Oct 23 01:07:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 61719 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 466AF1C038; Wed, 23 Oct 2019 11:26:09 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8133F1BFFD for ; Wed, 23 Oct 2019 11:25:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:25:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="397983794" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.140]) by fmsmga005.fm.intel.com with ESMTP; 23 Oct 2019 02:25:53 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, ray.kinsella@intel.com, Kevin Laatz Date: Wed, 23 Oct 2019 01:07:54 +0000 Message-Id: <20191023010754.65172-7-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023010754.65172-1-kevin.laatz@intel.com> References: <20191023010754.65172-1-kevin.laatz@intel.com> Subject: [dpdk-dev] [RFC 6/6] build: add drivers abi checks to meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds the ABI compatibility check for the drivers directory to the meson build. If enabled, the ABI compatibility checks will run for all .so's in the lib directory (provided a matching dump file exists). The build will fail if an ABI incompatibility is detected. Signed-off-by: Kevin Laatz --- drivers/meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/meson.build b/drivers/meson.build index 3202ba00d..0fda5a9e0 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -158,7 +158,9 @@ foreach class:dpdk_driver_classes version_map, '@INPUT@'], capture: true, input: static_lib, - output: lib_name + '.exp_chk') + output: lib_name + '.exp_chk' + install: false, + build_by_default: get_option('abi_compat_checks')) endif shared_lib = shared_library(lib_name, @@ -183,6 +185,19 @@ foreach class:dpdk_driver_classes include_directories: includes, dependencies: static_objs) + if is_experimental == 0 + custom_target('lib' + lib_name + '.abi_chk', + command: [abidiff, + meson.source_root() + '/drivers/abi/lib' + + lib_name + '.dump', + '@INPUT@'], + input: shared_lib, + output: 'lib' + lib_name + '.abi_chk', + capture: true, + install: false, + build_by_default: get_option('abi_compat_checks')) + endif + dpdk_drivers += static_lib set_variable('shared_@0@'.format(lib_name), shared_dep)