Skip to contentSkip to conversation

devtools: test different build types

PATCH Superseded Thomas Monjalon 10 participants 44 messages Apr 12, 2021 – Feb 6

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

PATCH 1/1 devtools: test different build types

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

---
 devtools/test-meson-builds.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
devtools/test-meson-builds.sh +12 -6
index daf817ac3e..37f258bd48 100755
@@ -92,13 +92,16 @@ load_env () # <target compiler>
 	command -v $targetcc >/dev/null 2>&1 || return 1
 }
 
-config () # <dir> <builddir> <meson options>
+config () # <dir> <builddir> <ABI check> <meson options>
 {
 	dir=$1
 	shift
 	builddir=$1
 	shift
+	abicheck=$1
+	shift
 	if [ -f "$builddir/build.ninja" ] ; then
+		[ $abicheck = ABI ] || return 0
 		# for existing environments, switch to debugoptimized if unset
 		# so that ABI checks can run
 		if ! $MESON configure $builddir |
@@ -114,7 +117,9 @@ config () # <dir> <builddir> <meson options>
 	else
 		options="$options -Dexamples=l3fwd" # save disk space
 	fi
-	options="$options --buildtype=debugoptimized"
+	if [ $abicheck = ABI ] ; then
+		options="$options --buildtype=debugoptimized"
+	fi
 	for option in $DPDK_MESON_OPTIONS ; do
 		options="$options -D$option"
 	done
@@ -165,7 +170,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 		cross=
 	fi
 	load_env $targetcc || return 0
-	config $srcdir $builds_dir/$targetdir $cross --werror $*
+	config $srcdir $builds_dir/$targetdir $abicheck $cross --werror $*
 	compile $builds_dir/$targetdir
 	if [ -n "$DPDK_ABI_REF_VERSION" -a "$abicheck" = ABI ] ; then
 		abirefdir=${DPDK_ABI_REF_DIR:-reference}/$DPDK_ABI_REF_VERSION
@@ -179,7 +184,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 			fi
 
 			rm -rf $abirefdir/build
-			config $abirefdir/src $abirefdir/build $cross \
+			config $abirefdir/src $abirefdir/build $abicheck $cross \
 				-Dexamples= $*
 			compile $abirefdir/build
 			install_target $abirefdir/build $abirefdir/$targetdir
@@ -213,9 +218,10 @@ for c in gcc clang ; do
 			abicheck=ABI
 		else
 			abicheck=skipABI # save time and disk space
+			buildtype='--buildtype=minsize'
 		fi
 		export CC="$CCACHE $c"
-		build build-$c-$s $c $abicheck --default-library=$s
+		build build-$c-$s $c $abicheck $buildtype --default-library=$s
 		unset CC
 	done
 done
@@ -227,7 +233,7 @@ generic_machine='nehalem'
 if ! check_cc_flags "-march=$generic_machine" ; then
 	generic_machine='corei7'
 fi
-build build-x86-generic cc skipABI -Dcheck_includes=true \
+build build-x86-generic cc skipABI --buildtype=debug -Dcheck_includes=true \
 	-Dlibdir=lib -Dmachine=$generic_machine $use_shared
 
 # 32-bit with default compiler
Signature · 1 line
2.31.1
#1 lore raw

devtools/test-meson-builds.sh for c in gcc clang ; do · line 218

Quoted 2 lines · Thomas Monjalon
devtools/test-meson-builds.sh +0 -0
@@ -213,9 +218,10 @@ for c in gcc clang ; do
                        abicheck=ABI

init of buildtype var is missing here.

Rest lgtm.

Quoted 10 lines
devtools/test-meson-builds.sh +2 -1
                else
                        abicheck=skipABI # save time and disk space
+                       buildtype='--buildtype=minsize'
                fi
                export CC="$CCACHE $c"
-               build build-$c-$s $c $abicheck --default-library=$s
+               build build-$c-$s $c $abicheck $buildtype --default-library=$s
                unset CC
        done
 done
Signature · 1 line
David Marchand
#2 lore raw
Quoted 5 lines · David Marchand

devtools/test-meson-builds.sh for c in gcc clang ; do · line 218

Quoted 2 lines · Thomas Monjalon
devtools/test-meson-builds.sh +0 -0
@@ -213,9 +218,10 @@ for c in gcc clang ; do
                         abicheck=ABI

init of buildtype var is missing here.

+1

Quoted 14 lines

Rest lgtm.

Quoted 10 lines
devtools/test-meson-builds.sh +2 -1
                 else
                         abicheck=skipABI # save time and disk space
+                       buildtype='--buildtype=minsize'
                 fi
                 export CC="$CCACHE $c"
-               build build-$c-$s $c $abicheck --default-library=$s
+               build build-$c-$s $c $abicheck $buildtype --default-library=$s
                 unset CC
         done
  done

with review notes applied:

#3 lore raw

PATCH v2 1/1 devtools: test different build types

In reply to Thomas Monjalon

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

---
v2: fix init of var buildtype

---
 devtools/test-meson-builds.sh | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
devtools/test-meson-builds.sh +13 -6
index 9ec8e2bc7e..7bd305a669 100755
@@ -92,13 +92,16 @@ load_env () # <target compiler>
 	command -v $targetcc >/dev/null 2>&1 || return 1
 }
 
-config () # <dir> <builddir> <meson options>
+config () # <dir> <builddir> <ABI check> <meson options>
 {
 	dir=$1
 	shift
 	builddir=$1
 	shift
+	abicheck=$1
+	shift
 	if [ -f "$builddir/build.ninja" ] ; then
+		[ $abicheck = ABI ] || return 0
 		# for existing environments, switch to debugoptimized if unset
 		# so that ABI checks can run
 		if ! $MESON configure $builddir |
@@ -114,7 +117,9 @@ config () # <dir> <builddir> <meson options>
 	else
 		options="$options -Dexamples=l3fwd" # save disk space
 	fi
-	options="$options --buildtype=debugoptimized"
+	if [ $abicheck = ABI ] ; then
+		options="$options --buildtype=debugoptimized"
+	fi
 	for option in $DPDK_MESON_OPTIONS ; do
 		options="$options -D$option"
 	done
@@ -165,7 +170,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 		cross=
 	fi
 	load_env $targetcc || return 0
-	config $srcdir $builds_dir/$targetdir $cross --werror $*
+	config $srcdir $builds_dir/$targetdir $abicheck $cross --werror $*
 	compile $builds_dir/$targetdir
 	if [ -n "$DPDK_ABI_REF_VERSION" -a "$abicheck" = ABI ] ; then
 		abirefdir=${DPDK_ABI_REF_DIR:-reference}/$DPDK_ABI_REF_VERSION
@@ -179,7 +184,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 			fi
 
 			rm -rf $abirefdir/build
-			config $abirefdir/src $abirefdir/build $cross \
+			config $abirefdir/src $abirefdir/build $abicheck $cross \
 				-Dexamples= $*
 			compile $abirefdir/build
 			install_target $abirefdir/build $abirefdir/$targetdir
@@ -211,11 +216,13 @@ for c in gcc clang ; do
 	for s in static shared ; do
 		if [ $s = shared ] ; then
 			abicheck=ABI
+			buildtype=
 		else
 			abicheck=skipABI # save time and disk space
+			buildtype='--buildtype=minsize'
 		fi
 		export CC="$CCACHE $c"
-		build build-$c-$s $c $abicheck --default-library=$s
+		build build-$c-$s $c $abicheck $buildtype --default-library=$s
 		unset CC
 	done
 done
@@ -227,7 +234,7 @@ generic_isa='nehalem'
 if ! check_cc_flags "-march=$generic_isa" ; then
 	generic_isa='corei7'
 fi
-build build-x86-generic cc skipABI -Dcheck_includes=true \
+build build-x86-generic cc skipABI --buildtype=debug -Dcheck_includes=true \
 	-Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared
 
 # 32-bit with default compiler
Signature · 1 line
2.31.1
#4 lore raw

v3 cover more build tests

In reply to Thomas Monjalon

While testing more build types, some errors occur.

v3: fix minsize build with GCC
v2: fix init of var buildtype

Thomas Monjalon (5):
net/qede: fix minsize build
regex/mlx5: fix minsize build
vdpa/mlx5: fix minsize build
test/crypto: fix minsize build
devtools: test different build types

 app/test/test_cryptodev_blockcipher.c    |  2 +-
 devtools/test-meson-builds.sh            | 19 +++++++++++++------
 drivers/net/qede/qede_rxtx.c             |  3 ++-
 drivers/regex/mlx5/mlx5_regex_fastpath.c |  3 ++-
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c        |  4 ++--
 5 files changed, 20 insertions(+), 11 deletions(-)
Signature · 1 line
2.31.1
#5 lore raw

PATCH v3 1/5 net/qede: fix minsize build

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

In function ‘__internal_ram_wr_relaxed’,
inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2, inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
drivers/net/qede/base/bcm_osal.h:136:9: error:
‘rx_prods’ is used uninitialized [-Werror=uninitialized]

|         rte_write32_relaxed((_val), (_reg_addr))
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ecore_int_api.h:151:17: note: in expansion of macro ‘DIRECT_REG_WR_RELAXED’
|                 DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i],
|                 ^~~~~~~~~~~~~~~~~~~~~

drivers/net/qede/qede_rxtx.c: In function ‘qede_update_rx_prod.constprop’:
drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
| struct eth_rx_prod_data rx_prods = { 0 };
| ^~~~~~~~

---
 drivers/net/qede/qede_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_rxtx.c +2 -1
index 298f4e3e42..35cde561ba 100644
@@ -721,9 +721,10 @@ qede_update_rx_prod(__rte_unused struct qede_dev *edev,
 {
 	uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
 	uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq->rx_comp_ring);
-	struct eth_rx_prod_data rx_prods = { 0 };
+	struct eth_rx_prod_data rx_prods;
 
 	/* Update producers */
+	memset(&rx_prods, 0, sizeof(rx_prods));
 	rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
 	rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
 
Signature · 1 line
2.31.1
#6 lore raw

Re: [dpdk-dev] [EXT] [PATCH v3 1/5] net/qede: fix minsize build

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, August 8, 2021 6:22 PM
To: [email protected]
Cc: [email protected]; [email protected]; Rasesh Mody <[email protected]>; Devendra Singh Rawat <[email protected]>
Subject: [EXT] [PATCH v3 1/5] net/qede: fix minsize build

External Email

----------------------------------------------------------------------
Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

In function ‘__internal_ram_wr_relaxed’,
inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2, inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
drivers/net/qede/base/bcm_osal.h:136:9: error:
‘rx_prods’ is used uninitialized [-Werror=uninitialized]

|         rte_write32_relaxed((_val), (_reg_addr))
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ecore_int_api.h:151:17: note: in expansion of macro ‘DIRECT_REG_WR_RELAXED’
|                 DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i],
|                 ^~~~~~~~~~~~~~~~~~~~~

drivers/net/qede/qede_rxtx.c: In function ‘qede_update_rx_prod.constprop’:
drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
| struct eth_rx_prod_data rx_prods = { 0 };
| ^~~~~~~~

---
 drivers/net/qede/qede_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_rxtx.c +2 -2
@@ -721,9 +721,10 @@ qede_update_rx_prod(__rte_unused struct qede_dev *edev,  {
 	uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
 	uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq->rx_comp_ring);
-	struct eth_rx_prod_data rx_prods = { 0 };
+	struct eth_rx_prod_data rx_prods;
 
 	/* Update producers */
+	memset(&rx_prods, 0, sizeof(rx_prods));
 	rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
 	rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
 
--

2.31.1

ACKed.

Thanks,
Devendra

Acked-by
#7 lore raw

Re: [dpdk-dev] [EXT] [PATCH v3 1/5] net/qede: fix minsize build

Quoted 40 lines

From: Devendra Singh Rawat <[email protected]>
Sent: Monday, August 9, 2021 10:46 AM

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, August 8, 2021 6:22 PM
To: [email protected]
Cc: [email protected]; [email protected]; Rasesh Mody <[email protected]>; Devendra Singh Rawat <[email protected]>
Subject: [EXT] [PATCH v3 1/5] net/qede: fix minsize build

External Email

----------------------------------------------------------------------
Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

In function ‘__internal_ram_wr_relaxed’,
inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2, inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
drivers/net/qede/base/bcm_osal.h:136:9: error:
‘rx_prods’ is used uninitialized [-Werror=uninitialized]

|         rte_write32_relaxed((_val), (_reg_addr))
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ecore_int_api.h:151:17: note: in expansion of macro ‘DIRECT_REG_WR_RELAXED’
| DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM
*)addr)[i],
| ^~~~~~~~~~~~~~~~~~~~~
drivers/net/qede/qede_rxtx.c: In function ‘qede_update_rx_prod.constprop’:
drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
| struct eth_rx_prod_data rx_prods = { 0 };
| ^~~~~~~~

Quoted 1 line
Quoted 28 lines
---
 drivers/net/qede/qede_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_rxtx.c +2 -2
index 298f4e3e42..35cde561ba 100644
@@ -721,9 +721,10 @@ qede_update_rx_prod(__rte_unused struct
 qede_dev *edev,  {
 	uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
 	uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq-
 >rx_comp_ring);
-	struct eth_rx_prod_data rx_prods = { 0 };
+	struct eth_rx_prod_data rx_prods;
 
 	/* Update producers */
+	memset(&rx_prods, 0, sizeof(rx_prods));
 	rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
 	rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
 
--

2.31.1

ACKed.

Thanks,
Devendra

#8 lore raw

Re: [dpdk-dev] [EXT] [PATCH v3 1/5] net/qede: fix minsize build

In reply to Devendra Singh Rawat
Quoted 25 lines · Devendra Singh Rawat

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, August 8, 2021 6:22 PM
To: [email protected]
Cc: [email protected]; [email protected]; Rasesh Mody <[email protected]>; Devendra Singh Rawat <[email protected]>
Subject: [EXT] [PATCH v3 1/5] net/qede: fix minsize build

External Email

----------------------------------------------------------------------
Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

In function ‘__internal_ram_wr_relaxed’,
inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2, inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
drivers/net/qede/base/bcm_osal.h:136:9: error:
‘rx_prods’ is used uninitialized [-Werror=uninitialized]

|         rte_write32_relaxed((_val), (_reg_addr))
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ecore_int_api.h:151:17: note: in expansion of macro ‘DIRECT_REG_WR_RELAXED’
|                 DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i],
|                 ^~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines

drivers/net/qede/qede_rxtx.c: In function ‘qede_update_rx_prod.constprop’:
drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
| struct eth_rx_prod_data rx_prods = { 0 };
| ^~~~~~~~

Can you configure your mail client so that it quotes the original mail with some '> ' prefix?
Your reply confused patchwork which added back a SoB from Thomas.

Quoted 21 lines
---
 drivers/net/qede/qede_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/qede/qede_rxtx.c +2 -2
@@ -721,9 +721,10 @@ qede_update_rx_prod(__rte_unused struct qede_dev *edev,  {
        uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
        uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq->rx_comp_ring);
-       struct eth_rx_prod_data rx_prods = { 0 };
+       struct eth_rx_prod_data rx_prods;
 
        /* Update producers */
+       memset(&rx_prods, 0, sizeof(rx_prods));
        rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
        rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
 
--

2.31.1

Quoted 1 line

ACKed.

Please reply with a full tag so that patchwork catches it.

It saves me some time/brain cycles when applying patches.

Thanks.

Signature · 1 line
David Marchand
#9 lore raw

PATCH v3 2/5 regex/mlx5: fix minsize build

In reply to Thomas Monjalon

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

drivers/regex/mlx5/mlx5_regex_fastpath.c:398:17: error:
‘len’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

|                 complete_umr_wqe(qp, sq, &qp->jobs[mkey_job_id], sq->pi,
|                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|                                  klm_num, len);
|                                  ~~~~~~~~~~~~~

drivers/regex/mlx5/mlx5_regex_fastpath.c:315:31: note: ‘len’ was declared here
| uint32_t klm_num = 0, len;
| ^~~

---
 drivers/regex/mlx5/mlx5_regex_fastpath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regex/mlx5/mlx5_regex_fastpath.c +2 -1
index 786718af53..c79445ce7d 100644
@@ -312,7 +312,8 @@ prep_regex_umr_wqe_set(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp,
 	struct mlx5_regex_job *job = NULL;
 	size_t sqid = sq->sqn, mkey_job_id = 0;
 	size_t left_ops = nb_ops;
-	uint32_t klm_num = 0, len;
+	uint32_t klm_num = 0;
+	uint32_t len = 0;
 	struct mlx5_klm *mkey_klm = NULL;
 	struct mlx5_klm klm;
 
Signature · 1 line
2.31.1
Reviewed-by on v3 2/5
#10 lore raw

Re: [dpdk-dev] [PATCH v3 2/5] regex/mlx5: fix minsize build

Quoted 45 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Sunday, August 8, 2021 8:52 PM
To: [email protected]
Cc: [email protected]; [email protected]; Ori Kam <[email protected]>
Subject: [dpdk-dev] [PATCH v3 2/5] regex/mlx5: fix minsize build

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

drivers/regex/mlx5/mlx5_regex_fastpath.c:398:17: error:
‘len’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
| complete_umr_wqe(qp, sq, &qp->jobs[mkey_job_id], sq->pi,
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

|                                  klm_num, len);
|                                  ~~~~~~~~~~~~~

drivers/regex/mlx5/mlx5_regex_fastpath.c:315:31: note: ‘len’ was declared here
| uint32_t klm_num = 0, len;
| ^~~

---
 drivers/regex/mlx5/mlx5_regex_fastpath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regex/mlx5/mlx5_regex_fastpath.c +2 -2
index 786718af53..c79445ce7d 100644
@@ -312,7 +312,8 @@ prep_regex_umr_wqe_set(struct mlx5_regex_priv
 *priv, struct mlx5_regex_qp *qp,
 	struct mlx5_regex_job *job = NULL;
 	size_t sqid = sq->sqn, mkey_job_id = 0;
 	size_t left_ops = nb_ops;
-	uint32_t klm_num = 0, len;
+	uint32_t klm_num = 0;
+	uint32_t len = 0;
 	struct mlx5_klm *mkey_klm = NULL;
 	struct mlx5_klm klm;
 
--
Quoted 1 line

2.31.1

#11 lore raw

PATCH v3 3/5 vdpa/mlx5: fix minsize build

In reply to Thomas Monjalon

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

drivers/vdpa/mlx5/mlx5_vdpa_mem.c: In function ‘mlx5_vdpa_mem_register’:
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:183:24: error:
initialization of ‘uint64_t’ {aka ‘long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
| uint64_t gcd = NULL;
| ^~~~
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:244:75: error:
‘mode’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

|                         klm_size = mode == MLX5_MKC_ACCESS_MODE_KLM ?
|                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|                               KLM_SIZE_MAX_ALIGN(empty_region_sz) : gcd;
|                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
---
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/mlx5_vdpa_mem.c +2 -2
index a13bde5a0b..59ce4e891c 100644
@@ -177,10 +177,10 @@ mlx5_vdpa_mem_register(struct mlx5_vdpa_priv *priv)
 	struct mlx5_devx_mkey_attr mkey_attr;
 	struct mlx5_vdpa_query_mr *entry = NULL;
 	struct rte_vhost_mem_region *reg = NULL;
-	uint8_t mode;
+	uint8_t mode = 0;
 	uint32_t entries_num = 0;
 	uint32_t i;
-	uint64_t gcd;
+	uint64_t gcd = 0;
 	uint64_t klm_size;
 	uint64_t mem_size;
 	uint64_t k;
Signature · 1 line
2.31.1
Acked-by on v3 3/5
#12 lore raw

Re: [dpdk-dev] [PATCH v3 3/5] vdpa/mlx5: fix minsize build

From: Thomas Monjalon

Quoted 13 lines

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

drivers/vdpa/mlx5/mlx5_vdpa_mem.c: In function ‘mlx5_vdpa_mem_register’:
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:183:24: error:
initialization of ‘uint64_t’ {aka ‘long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
| uint64_t gcd = NULL;
| ^~~~
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:244:75: error:
‘mode’ may be used uninitialized in this function [-Werror=maybe- uninitialized]

Quoted 7 lines
|                         klm_size = mode == MLX5_MKC_ACCESS_MODE_KLM ?
|                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|                               KLM_SIZE_MAX_ALIGN(empty_region_sz) : gcd;
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

Thanks

Reviewed-by on v3 3/5
#13 lore raw

Re: [dpdk-dev] [PATCH v3 3/5] vdpa/mlx5: fix minsize build

In reply to Thomas Monjalon
Quoted 50 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Sunday, August 8, 2021 8:52 PM
To: [email protected]
Cc: [email protected]; [email protected]; Matan Azrad <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH v3 3/5] vdpa/mlx5: fix minsize build

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

drivers/vdpa/mlx5/mlx5_vdpa_mem.c: In function ‘mlx5_vdpa_mem_register’:
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:183:24: error:
initialization of ‘uint64_t’ {aka ‘long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
| uint64_t gcd = NULL;
| ^~~~
drivers/vdpa/mlx5/mlx5_vdpa_mem.c:244:75: error:
‘mode’ may be used uninitialized in this function [-Werror=maybe- uninitialized]

|                         klm_size = mode == MLX5_MKC_ACCESS_MODE_KLM ?
|                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|                               KLM_SIZE_MAX_ALIGN(empty_region_sz) : gcd;
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
---
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/mlx5_vdpa_mem.c +2 -2
index a13bde5a0b..59ce4e891c 100644
@@ -177,10 +177,10 @@ mlx5_vdpa_mem_register(struct mlx5_vdpa_priv
 *priv)
 	struct mlx5_devx_mkey_attr mkey_attr;
 	struct mlx5_vdpa_query_mr *entry = NULL;
 	struct rte_vhost_mem_region *reg = NULL;
-	uint8_t mode;
+	uint8_t mode = 0;
 	uint32_t entries_num = 0;
 	uint32_t i;
-	uint64_t gcd;
+	uint64_t gcd = 0;
 	uint64_t klm_size;
 	uint64_t mem_size;
Quoted 3 lines

uint64_t k;
--
2.31.1

#14 lore raw

PATCH v3 4/5 test/crypto: fix minsize build

In reply to Thomas Monjalon

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

app/test/test_cryptodev_blockcipher.c:1133:45: error:
‘blk_tcs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
| const struct blockcipher_test_case *blk_tcs;
| ^~~~~~~

---
 app/test/test_cryptodev_blockcipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev_blockcipher.c +1 -1
index 53fd4718af..0d5082887e 100644
@@ -1184,7 +1184,7 @@ build_blockcipher_test_suite(enum blockcipher_test_type test_type)
 		ts_setup = authonly_setup;
 		break;
 	default:
-		break;
+		return NULL;
 	}
 
 	ts = calloc(1, sizeof(struct unit_test_suite) +
Signature · 1 line
2.31.1
Reviewed-by on v3 4/5
#15 lore raw

Re: [dpdk-dev] [PATCH v3 4/5] test/crypto: fix minsize build

Quoted 36 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Sunday, August 8, 2021 8:52 PM
To: [email protected]
Cc: [email protected]; [email protected]; Akhil Goyal <[email protected]>; Declan Doherty <[email protected]>
Subject: [dpdk-dev] [PATCH v3 4/5] test/crypto: fix minsize build

Error occurs when configuring meson with --buildtype=minsize with GCC 11.1.0:

app/test/test_cryptodev_blockcipher.c:1133:45: error:
‘blk_tcs’ may be used uninitialized in this function [-Werror=maybe- uninitialized]
| const struct blockcipher_test_case *blk_tcs;
| ^~~~~~~

---
 app/test/test_cryptodev_blockcipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev_blockcipher.c +1 -1
index 53fd4718af..0d5082887e 100644
@@ -1184,7 +1184,7 @@ build_blockcipher_test_suite(enum
 blockcipher_test_type test_type)
 		ts_setup = authonly_setup;
 		break;
 	default:
-		break;
+		return NULL;
 	}
 
Quoted 3 lines

ts = calloc(1, sizeof(struct unit_test_suite) +
--
2.31.1

#16 lore raw

PATCH v3 5/5 devtools: test different build types

In reply to Thomas Monjalon

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

---

This patch cannot be merged now because it makes clang 11.1.0 crashing.

---
 devtools/test-meson-builds.sh | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
devtools/test-meson-builds.sh +13 -6
index 9ec8e2bc7e..7bd305a669 100755
@@ -92,13 +92,16 @@ load_env () # <target compiler>
 	command -v $targetcc >/dev/null 2>&1 || return 1
 }
 
-config () # <dir> <builddir> <meson options>
+config () # <dir> <builddir> <ABI check> <meson options>
 {
 	dir=$1
 	shift
 	builddir=$1
 	shift
+	abicheck=$1
+	shift
 	if [ -f "$builddir/build.ninja" ] ; then
+		[ $abicheck = ABI ] || return 0
 		# for existing environments, switch to debugoptimized if unset
 		# so that ABI checks can run
 		if ! $MESON configure $builddir |
@@ -114,7 +117,9 @@ config () # <dir> <builddir> <meson options>
 	else
 		options="$options -Dexamples=l3fwd" # save disk space
 	fi
-	options="$options --buildtype=debugoptimized"
+	if [ $abicheck = ABI ] ; then
+		options="$options --buildtype=debugoptimized"
+	fi
 	for option in $DPDK_MESON_OPTIONS ; do
 		options="$options -D$option"
 	done
@@ -165,7 +170,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 		cross=
 	fi
 	load_env $targetcc || return 0
-	config $srcdir $builds_dir/$targetdir $cross --werror $*
+	config $srcdir $builds_dir/$targetdir $abicheck $cross --werror $*
 	compile $builds_dir/$targetdir
 	if [ -n "$DPDK_ABI_REF_VERSION" -a "$abicheck" = ABI ] ; then
 		abirefdir=${DPDK_ABI_REF_DIR:-reference}/$DPDK_ABI_REF_VERSION
@@ -179,7 +184,7 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 			fi
 
 			rm -rf $abirefdir/build
-			config $abirefdir/src $abirefdir/build $cross \
+			config $abirefdir/src $abirefdir/build $abicheck $cross \
 				-Dexamples= $*
 			compile $abirefdir/build
 			install_target $abirefdir/build $abirefdir/$targetdir
@@ -211,11 +216,13 @@ for c in gcc clang ; do
 	for s in static shared ; do
 		if [ $s = shared ] ; then
 			abicheck=ABI
+			buildtype=
 		else
 			abicheck=skipABI # save time and disk space
+			buildtype='--buildtype=minsize'
 		fi
 		export CC="$CCACHE $c"
-		build build-$c-$s $c $abicheck --default-library=$s
+		build build-$c-$s $c $abicheck $buildtype --default-library=$s
 		unset CC
 	done
 done
@@ -227,7 +234,7 @@ generic_isa='nehalem'
 if ! check_cc_flags "-march=$generic_isa" ; then
 	generic_isa='corei7'
 fi
-build build-x86-generic cc skipABI -Dcheck_includes=true \
+build build-x86-generic cc skipABI --buildtype=debug -Dcheck_includes=true \
 	-Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared
 
 # 32-bit with default compiler
Signature · 1 line
2.31.1
#17 lore raw
Quoted 7 lines · On Sun, 8 Aug 2021 14:51:38 +0200 Thomas Monjalon <[email protected]> wrote:

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

Quoted 7 lines

---

This patch cannot be merged now because it makes clang 11.1.0 crashing.
---

Dropping this patch from patchwork because of the clang crash.

Tested-by on the v3 series
#18 lore raw

Re: [dpdk-dev] [PATCH v3 0/5] more build tests

In reply to Thomas Monjalon
Quoted 12 lines · Thomas Monjalon

While testing more build types, some errors occur.

v3: fix minsize build with GCC
v2: fix init of var buildtype

Thomas Monjalon (5):
net/qede: fix minsize build
regex/mlx5: fix minsize build
vdpa/mlx5: fix minsize build
test/crypto: fix minsize build
devtools: test different build types

Quoted 7 lines
 app/test/test_cryptodev_blockcipher.c    |  2 +-
 devtools/test-meson-builds.sh            | 19 +++++++++++++------
 drivers/net/qede/qede_rxtx.c             |  3 ++-
 drivers/regex/mlx5/mlx5_regex_fastpath.c |  3 ++-
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c        |  4 ++--
 5 files changed, 20 insertions(+), 11 deletions(-)

With the 'test-meson-builds.sh' update (patch 5/5) clang crashes for me [1], it can be related to my environment but I can reproduce the issue 100%.

When the patch 5/5 is dropped, I confirm it builds fine with '--buildtype=minsize' meson option.

So _only for first four patches_:

[1]
FAILED: drivers/libtmp_rte_crypto_ccp.a.p/crypto_ccp_ccp_dev.c.o
clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)

#19 lore raw

Re: [dpdk-dev] [PATCH v3 0/5] more build tests

In reply to Thomas Monjalon
Quoted 13 lines · Thomas Monjalon

While testing more build types, some errors occur.

v3: fix minsize build with GCC
v2: fix init of var buildtype

Thomas Monjalon (5):
net/qede: fix minsize build
regex/mlx5: fix minsize build
vdpa/mlx5: fix minsize build
test/crypto: fix minsize build
devtools: test different build types

Quoted 7 lines
 app/test/test_cryptodev_blockcipher.c    |  2 +-
 devtools/test-meson-builds.sh            | 19 +++++++++++++------
 drivers/net/qede/qede_rxtx.c             |  3 ++-
 drivers/regex/mlx5/mlx5_regex_fastpath.c |  3 ++-
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c        |  4 ++--
 5 files changed, 20 insertions(+), 11 deletions(-)

Applied first 4 patches.
Thanks.

Signature · 1 line
David Marchand
#20 lore raw

v4 cover more build tests

In reply to Thomas Monjalon

While testing more build types, some errors occur.

v4: fix new warnings with minsize
v3: fix minsize build with GCC
v2: fix init of var buildtype

Thomas Monjalon (4):
bus/pci: fix unmap on failure in multi-process
argparse: fix minsize build
mldev: fix minsize build
devtools: test different build types

 devtools/test-meson-builds.sh    | 6 ++++--
 drivers/bus/pci/linux/pci_vfio.c | 3 ++-
 lib/argparse/rte_argparse.c      | 2 +-
 lib/mldev/rte_mldev.c            | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.52.0
#21 lore raw

PATCH v4 1/4 bus/pci: fix unmap on failure in multi-process

This error is seen in build of type "minsize":

In function 'pci_vfio_map_resource_secondary':
drivers/bus/pci/linux/pci_vfio.c:1005:28: error:
'maps' may be used uninitialized [-Werror=maybe-uninitialized]
1005 | if (maps[j].addr)

On failure before assigning maps, it was trying to unmap. The fix is changing the goto destination after unmapping.

---
 drivers/bus/pci/linux/pci_vfio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/pci/linux/pci_vfio.c +2 -1
index 242f567ed7..bc5c5c2499 100644
@@ -968,7 +968,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 
 	ret = pci_vfio_fill_regions(dev, vfio_dev_fd, &device_info);
 	if (ret)
-		goto err_vfio_dev_fd;
+		goto err_vfio_dev;
 
 	/* map BARs */
 	maps = vfio_res->maps;
@@ -1005,6 +1005,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 		if (maps[j].addr)
 			pci_unmap_resource(maps[j].addr, maps[j].size);
 	}
+err_vfio_dev:
 	rte_vfio_release_device(rte_pci_get_sysfs_path(),
 			pci_addr, vfio_dev_fd);
 	return -1;
Signature · 1 line
2.52.0
#22 lore raw

Re: [PATCH v4 1/4] bus/pci: fix unmap on failure in multi-process

28/01/2026 12:58, Thomas Monjalon:

Quoted 9 lines

This error is seen in build of type "minsize":

In function 'pci_vfio_map_resource_secondary':
drivers/bus/pci/linux/pci_vfio.c:1005:28: error:
'maps' may be used uninitialized [-Werror=maybe-uninitialized]
1005 | if (maps[j].addr)

On failure before assigning maps, it was trying to unmap. The fix is changing the goto destination after unmapping.

After David had a look, he told me unmap would never happen because the loop range is empty.
So we should change this description with this:
"
On failure before assigning maps, it was trying to unmap. The compiler should have detected that the unmap loop is a nop.

The fix is changing the goto destination after unmapping to allow compiling with "minsize" option.
"

Because it is not fixing anything but minsize build, the title should be "bus/pci: fix minsize build"

#23 lore raw

PATCH v4 2/4 argparse: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'parse_args', lib/argparse/rte_argparse.c:764:31: error:
'arg_idx' may be used uninitialized [-Werror=maybe-uninitialized]
764 | if (arg_parsed[arg_idx] && !arg_attr_flag_multi(arg)) {
| ^

It looks to be a compiler issue because we are not supposed to reach this point in case of find_option_arg() failure.

The variable is initialized to allow compiling with "minsize" option.

---
 lib/argparse/rte_argparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/argparse/rte_argparse.c +1 -1
index 9c3c5e7ae3..88c3e7740c 100644
@@ -702,7 +702,7 @@ parse_args(const struct rte_argparse *obj, bool *arg_parsed,
 	const char *arg_name;
 	size_t n_args_to_move;
 	char **args_to_move;
-	uint32_t arg_idx;
+	uint32_t arg_idx = 0;
 	char *curr_argv;
 	char *value;
 	int ret;
Signature · 1 line
2.52.0
Acked-by on v4 2/4
#24 lore raw

Re: [PATCH v4 2/4] argparse: fix minsize build

Quoted 13 lines · Thomas Monjalon

This error is seen in build of type "minsize":

In function 'parse_args', lib/argparse/rte_argparse.c:764:31: error:
'arg_idx' may be used uninitialized [-Werror=maybe-uninitialized]
764 | if (arg_parsed[arg_idx] && !arg_attr_flag_multi(arg)) {
| ^

It looks to be a compiler issue because we are not supposed to reach this point in case of find_option_arg() failure.

The variable is initialized to allow compiling with "minsize" option.

#25 lore raw

PATCH v4 3/4 mldev: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'rte_ml_dev_pmd_allocate':
lib/mldev/rte_mldev.c:84:16: error:
'dev' may be used uninitialized [-Werror=maybe-uninitialized]

   84 |         if (dev->data == NULL) {
      |             ~~~^~~~~~

It looks to be a compiler issue because we are not supposed to reach this point without finding a device to assign.

The variable is initialized to allow compiling with "minsize" option.

---
 lib/mldev/rte_mldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mldev/rte_mldev.c +1 -1
index f5061f015c..7fae867882 100644
@@ -55,7 +55,7 @@ rte_ml_dev_pmd_allocate(const char *name, uint8_t socket_id)
 {
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz;
-	struct rte_ml_dev *dev;
+	struct rte_ml_dev *dev = NULL;
 	int16_t dev_id;
 
 	/* implicit initialization of library before adding first device */
Signature · 1 line
2.52.0
#26 lore raw

PATCH v4 4/4 devtools: test different build types

In reply to Thomas Monjalon

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

---
 devtools/test-meson-builds.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
devtools/test-meson-builds.sh +4 -2
index 867a0a9c0c..11e4be3f88 100755
@@ -233,13 +233,15 @@ for c in gcc clang ; do
 	for s in static shared ; do
 		if [ $s = shared ] ; then
 			abicheck=ABI
+			buildtype=
 			stdatomic=-Denable_stdatomic=true
 		else
 			abicheck=skipABI # save time and disk space
+			buildtype='--buildtype=minsize'
 			stdatomic=-Denable_stdatomic=false
 		fi
 		export CC="$CCACHE $c"
-		build build-$c-$s $c $abicheck $stdatomic --default-library=$s
+		build build-$c-$s $c $abicheck $buildtype $stdatomic --default-library=$s
 		unset CC
 	done
 done
@@ -254,7 +256,7 @@ generic_isa='nehalem'
 if ! check_cc_flags "-march=$generic_isa" ; then
 	generic_isa='corei7'
 fi
-build build-x86-generic cc skipABI -Dcheck_includes=true \
+build build-x86-generic cc skipABI --buildtype=debug -Dcheck_includes=true \
 	-Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared
 
 # 32-bit with default compiler
Signature · 1 line
2.52.0
#27 lore raw

v4 cover more build tests

In reply to Thomas Monjalon

While testing more build types, some errors occur.

v5: add minsize and fix debug build types in GHA
fix new warnings with minsize and debug builds
v4: fix new warnings with minsize
v3: fix minsize build with GCC
v2: fix init of var buildtype

Thomas Monjalon (11):
mem: check fbarray name truncation in secondary process
mem: avoid hugepage path overflow
argparse: fix minsize build
mldev: fix minsize build
bus/pci: fix minsize build
power/intel_pstate: fix minsize build net/bnxt/tf_ulp: fix minsize build
net/iavf: fix minsize build
ci: fix debug build type
devtools: test different build types
ci: check minsize build type in GHA

 .ci/linux-build.sh                            |  3 ++-
 .github/workflows/build.yml                   |  2 ++
 devtools/test-meson-builds.sh                 |  6 ++++--
 drivers/bus/pci/linux/pci_vfio.c              |  3 ++-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |  2 ++
 drivers/net/intel/iavf/iavf_ipsec_crypto.c    |  2 +-
 .../power/intel_pstate/intel_pstate_cpufreq.c |  2 +-
 lib/argparse/rte_argparse.c                   |  2 +-
 lib/eal/linux/eal_memalloc.c                  |  7 ++++++-
 lib/eal/linux/eal_memory.c                    | 20 ++++++++++++-------
 lib/mldev/rte_mldev.c                         |  2 +-
 11 files changed, 35 insertions(+), 16 deletions(-)
Signature · 1 line
2.52.0
#28 lore raw

PATCH v4 1/11 mem: check fbarray name truncation in secondary process

When compiling in debug mode, the format-truncation check raises a warning:

In function 'secondary_msl_create_walk':
lib/eal/linux/eal_memalloc.c:1401:50:
error: '%i' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 63 [-Werror=format-truncation=]
note: 'snprintf' output between 3 and 76 bytes into a destination of size 64
1401 | snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
1402 | primary_msl->memseg_arr.name, getpid());

This is a new warning enabled in DPDK 26.03.
It is solved by checking the return of snprintf.

Bugzilla ID: 1878

---
 lib/eal/linux/eal_memalloc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
lib/eal/linux/eal_memalloc.c +6 -1
index d9e8ea76b9..4dee224ac5 100644
@@ -1398,8 +1398,13 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
 	local_msl = &local_memsegs[msl_idx];
 
 	/* create distinct fbarrays for each secondary */
-	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
+	ret = snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
 		primary_msl->memseg_arr.name, getpid());
+	if (ret >= RTE_FBARRAY_NAME_LEN) {
+		EAL_LOG(ERR, "fbarray name %s_%i is too long",
+				primary_msl->memseg_arr.name, getpid());
+		return -1;
+	}
 
 	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
 		primary_msl->memseg_arr.len,
Signature · 1 line
2.52.0
#29 lore raw

PATCH v4 2/11 mem: avoid hugepage path overflow

In reply to Thomas Monjalon

When constructing hugepage path, allocate the variable to avoid a possible overflow which was detected in debug build:

In function 'find_numasocket':
lib/eal/linux/eal_memory.c:450:31:
error: 'snprintf' output may be truncated
before the last format character [-Werror=format-truncation=]
lib/eal/linux/eal_memory.c:449:9:
note: 'snprintf' output 2 or more bytes (assuming 4097) into a destination of size 4096
449 | snprintf(hugedir_str, sizeof(hugedir_str),
450 | "%s/%s", hpi->hugedir, eal_get_hugefile_prefix());

This is a new warning (format-truncation) enabled in DPDK 26.03.

Bugzilla ID: 1878

---
 lib/eal/linux/eal_memory.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
lib/eal/linux/eal_memory.c +13 -7
index 7c4197a5b8..ceda9c3246 100644
@@ -436,8 +436,9 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 	unsigned i, hp_count = 0;
 	uint64_t virt_addr;
 	char buf[BUFSIZ];
-	char hugedir_str[PATH_MAX];
+	char *hugedir_str;
 	FILE *f;
+	int ret;
 
 	f = fopen("/proc/self/numa_maps", "r");
 	if (f == NULL) {
@@ -446,8 +447,14 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 		return 0;
 	}
 
-	snprintf(hugedir_str, sizeof(hugedir_str),
-			"%s/%s", hpi->hugedir, eal_get_hugefile_prefix());
+	ret = asprintf(&hugedir_str, "%s/%s",
+			hpi->hugedir, eal_get_hugefile_prefix());
+	if (ret < 0) {
+		EAL_LOG(ERR, "%s(): failed to store hugepage path", __func__);
+		goto error;
+	}
+
+	ret = -1;
 
 	/* parse numa map */
 	while (fgets(buf, sizeof(buf), f) != NULL) {
@@ -503,12 +510,11 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 	if (hp_count < hpi->num_pages[0])
 		goto error;
 
-	fclose(f);
-	return 0;
-
+	ret = 0;
 error:
+	free(hugedir_str);
 	fclose(f);
-	return -1;
+	return ret;
 }
 
 static int
Signature · 1 line
2.52.0
#30 lore raw

Re: [PATCH v4 02/11] mem: avoid hugepage path overflow

lib/eal/linux/eal_memory.c find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi) · line 454

Quoted 11 lines · Thomas Monjalon
lib/eal/linux/eal_memory.c +5 -2
@@ -446,8 +447,14 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
                return 0;
        }
 
-       snprintf(hugedir_str, sizeof(hugedir_str),
-                       "%s/%s", hpi->hugedir, eal_get_hugefile_prefix());
+       ret = asprintf(&hugedir_str, "%s/%s",
+                       hpi->hugedir, eal_get_hugefile_prefix());
+       if (ret < 0) {
+               EAL_LOG(ERR, "%s(): failed to store hugepage path", __func__);
+               goto error;

On asprintf failure, hugedir_str content is undefined.
It is safer to reset hugedir_str to NULL before jumping to the error label where free() is called.

Signature · 1 line
David Marchand
#31 lore raw

Re: [PATCH v4 02/11] mem: avoid hugepage path overflow

06/02/2026 09:12, David Marchand:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines
lib/eal/linux/eal_memory.c +0 -0
@@ -446,8 +447,14 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
                return 0;
        }
 
Quoted 11 lines

lib/eal/linux/eal_memory.c find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi) · line 454

Quoted 7 lines
lib/eal/linux/eal_memory.c +5 -2
-       snprintf(hugedir_str, sizeof(hugedir_str),
-                       "%s/%s", hpi->hugedir, eal_get_hugefile_prefix());
+       ret = asprintf(&hugedir_str, "%s/%s",
+                       hpi->hugedir, eal_get_hugefile_prefix());
+       if (ret < 0) {
+               EAL_LOG(ERR, "%s(): failed to store hugepage path", __func__);
+               goto error;

On asprintf failure, hugedir_str content is undefined.
It is safer to reset hugedir_str to NULL before jumping to the error label where free() is called.

You're right, I do this small change:

        if (ret < 0) {
                EAL_LOG(ERR, "%s(): failed to store hugepage path", __func__);
+               hugedir_str = NULL;
                goto error;
        }
#32 lore raw

PATCH v4 3/11 argparse: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'parse_args', lib/argparse/rte_argparse.c:764:31: error:
'arg_idx' may be used uninitialized [-Werror=maybe-uninitialized]
764 | if (arg_parsed[arg_idx] && !arg_attr_flag_multi(arg)) {
| ^

It looks to be a compiler issue because we are not supposed to reach this point in case of find_option_arg() failure.

The variable is initialized to allow compiling with "minsize" option.

---
 lib/argparse/rte_argparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/argparse/rte_argparse.c +1 -1
index 9c3c5e7ae3..88c3e7740c 100644
@@ -702,7 +702,7 @@ parse_args(const struct rte_argparse *obj, bool *arg_parsed,
 	const char *arg_name;
 	size_t n_args_to_move;
 	char **args_to_move;
-	uint32_t arg_idx;
+	uint32_t arg_idx = 0;
 	char *curr_argv;
 	char *value;
 	int ret;
Signature · 1 line
2.52.0
#33 lore raw

PATCH v4 4/11 mldev: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'rte_ml_dev_pmd_allocate':
lib/mldev/rte_mldev.c:84:16: error:
'dev' may be used uninitialized [-Werror=maybe-uninitialized]

   84 |         if (dev->data == NULL) {
      |             ~~~^~~~~~

It looks to be a compiler issue because we are not supposed to reach this point without finding a device to assign.

The variable is initialized to allow compiling with "minsize" option.

---
 lib/mldev/rte_mldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mldev/rte_mldev.c +1 -1
index f5061f015c..7fae867882 100644
@@ -55,7 +55,7 @@ rte_ml_dev_pmd_allocate(const char *name, uint8_t socket_id)
 {
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz;
-	struct rte_ml_dev *dev;
+	struct rte_ml_dev *dev = NULL;
 	int16_t dev_id;
 
 	/* implicit initialization of library before adding first device */
Signature · 1 line
2.52.0
#34 lore raw

PATCH v4 5/11 bus/pci: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'pci_vfio_map_resource_secondary':
drivers/bus/pci/linux/pci_vfio.c:1005:28: error:
'maps' may be used uninitialized [-Werror=maybe-uninitialized]
1005 | if (maps[j].addr)

On failure before assigning maps, it was trying to unmap. The compiler should have detected that the unmap loop is a nop.

The fix is changing the goto destination after unmapping to allow compiling with "minsize" option.

---
 drivers/bus/pci/linux/pci_vfio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/pci/linux/pci_vfio.c +2 -1
index 242f567ed7..bc5c5c2499 100644
@@ -968,7 +968,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 
 	ret = pci_vfio_fill_regions(dev, vfio_dev_fd, &device_info);
 	if (ret)
-		goto err_vfio_dev_fd;
+		goto err_vfio_dev;
 
 	/* map BARs */
 	maps = vfio_res->maps;
@@ -1005,6 +1005,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 		if (maps[j].addr)
 			pci_unmap_resource(maps[j].addr, maps[j].size);
 	}
+err_vfio_dev:
 	rte_vfio_release_device(rte_pci_get_sysfs_path(),
 			pci_addr, vfio_dev_fd);
 	return -1;
Signature · 1 line
2.52.0
#35 lore raw

PATCH v4 6/11 power/intel_pstate: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'power_init_for_setting_freq',

	drivers/power/intel_pstate/intel_pstate_cpufreq.c:205:30:
	error: 'max_non_turbo' may be used uninitialized
		[-Werror=maybe-uninitialized]

drivers/power/intel_pstate/intel_pstate_cpufreq.c:122:18:
note: 'max_non_turbo' was declared here
122 | uint64_t max_non_turbo;

It looks to be a compiler issue because we are not supposed to reach this point in case of power_read_turbo_pct() failure.

The variable is initialized to allow compiling with "minsize" option.

---
 drivers/power/intel_pstate/intel_pstate_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/intel_pstate/intel_pstate_cpufreq.c +1 -1
index eba50b2874..8e27570e3c 100644
@@ -119,7 +119,7 @@ power_init_for_setting_freq(struct pstate_power_info *pi)
 	FILE *f_base = NULL, *f_base_min = NULL, *f_base_max = NULL,
 	     *f_min = NULL, *f_max = NULL;
 	uint32_t base_ratio, base_min_ratio, base_max_ratio;
-	uint64_t max_non_turbo;
+	uint64_t max_non_turbo = 0;
 	int ret;
 
 	/* open all files we expect to have open */
Signature · 1 line
2.52.0
#36 lore raw

PATCH v4 7/11 net/bnxt/tf_ulp: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'ulp_blob_append':
error: 'num' may be used uninitialized [-Werror=maybe-uninitialized] drivers/net/bnxt/tf_ulp/ulp_utils.h:1109:13:
note: in expansion of macro 'unlikely'
1109 | if (unlikely((src_offset + src_len) > num))

      |             ^~~~~~~~

drivers/net/bnxt/tf_ulp/ulp_utils.h:1105:18: note: 'num' was declared here
1105 | uint16_t num;

Indeed num may be not initialized if ulp_blob_data_get() fails. It is fixed by checking the return value src_buf.

Fixes 0c036a1485b9 ("net/bnxt/tf_ulp: optimize with inline and prediction")
---
 drivers/net/bnxt/tf_ulp/ulp_utils.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/bnxt/tf_ulp/ulp_utils.h +2 -0
index 7a8145b5df..ce20f1916f 100644
@@ -1106,6 +1106,8 @@ ulp_blob_append(struct ulp_blob *dst, struct ulp_blob *src,
 	uint8_t bluff;
 	uint8_t *src_buf = ulp_blob_data_get(src, &num);
 
+	if (unlikely(src_buf == NULL))
+		return -EINVAL;
 	if (unlikely((src_offset + src_len) > num))
 		return -EINVAL;
 
Signature · 1 line
2.52.0
#37 lore raw

PATCH v4 8/11 net/iavf: fix minsize build

In reply to Thomas Monjalon

This error is seen in build of type "minsize":

In function 'iavf_ipsec_crypto_supported':
drivers/net/intel/iavf/iavf_ipsec_crypto.c:1649:29:
error: status may be used uninitialized
[-Werror=maybe-uninitialized]
1649 | if (rc == 0 && status.status == INLINE_IPSEC_STATUS_AVAILABLE)
drivers/net/intel/iavf/iavf_ipsec_crypto.c:1647:46:
note: status was declared here
1647 | struct virtchnl_ipsec_status status;

It looks to be a compiler issue because we are not supposed to reach this point in case of iavf_ipsec_crypto_status_get() failure.

The variable is initialized to allow compiling with "minsize" option.

---
 drivers/net/intel/iavf/iavf_ipsec_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/iavf/iavf_ipsec_crypto.c +1 -1
index d5bfbecf08..6d41b1744e 100644
@@ -1644,7 +1644,7 @@ iavf_ipsec_crypto_supported(struct iavf_adapter *adapter)
 	/** Capability check for IPsec Crypto */
 	if (resources && (resources->vf_cap_flags &
 		VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC_CRYPTO)) {
-		struct virtchnl_ipsec_status status;
+		struct virtchnl_ipsec_status status = {0};
 		int rc = iavf_ipsec_crypto_status_get(adapter, &status);
 		if (rc == 0 && status.status == INLINE_IPSEC_STATUS_AVAILABLE)
 			crypto_supported = true;
Signature · 1 line
2.52.0
#38 lore raw

PATCH v4 9/11 ci: fix debug build type

In reply to Thomas Monjalon

The debug build type was overridden by defining it to debugoptimized after debug was chosen based on an environment variable.

Fixes 918b6674b841 ("build: support Undefined Behavior Sanitizer")
---
 .ci/linux-build.sh | 1 -
 1 file changed, 1 deletion(-)
.ci/linux-build.sh +0 -1
index 084d9642fc..aac0bd3dc5 100755
@@ -128,7 +128,6 @@ else
 fi
 OPTS="$OPTS -Dlibdir=lib"
 
-buildtype=debugoptimized
 sanitizer=
 if [ "$ASAN" = "true" ]; then
     sanitizer=${sanitizer:+$sanitizer,}address
Signature · 1 line
2.52.0
Reviewed-by on v4 9/11
#39 lore raw

Re: [PATCH v4 09/11] ci: fix debug build type

Quoted 8 lines · Thomas Monjalon

The debug build type was overridden by defining it to debugoptimized after debug was chosen based on an environment variable.

Fixes 918b6674b841 ("build: support Undefined Behavior Sanitizer")

Ugh.. probably a rebase issue on my side, I kept rebasing the ubsan branch again and again...

Signature · 1 line
David Marchand
#40 lore raw

PATCH v4 10/11 devtools: test different build types

In reply to Thomas Monjalon

All builds were of type debugoptimized.
It is kept only for builds having an ABI check. Others will have the default build type (release), except if specified differently as in the x86 generic build which will be a test of the non-optimized debug build type. Some static builds will test the minsize build type.

---
 devtools/test-meson-builds.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
devtools/test-meson-builds.sh +4 -2
index 867a0a9c0c..11e4be3f88 100755
@@ -233,13 +233,15 @@ for c in gcc clang ; do
 	for s in static shared ; do
 		if [ $s = shared ] ; then
 			abicheck=ABI
+			buildtype=
 			stdatomic=-Denable_stdatomic=true
 		else
 			abicheck=skipABI # save time and disk space
+			buildtype='--buildtype=minsize'
 			stdatomic=-Denable_stdatomic=false
 		fi
 		export CC="$CCACHE $c"
-		build build-$c-$s $c $abicheck $stdatomic --default-library=$s
+		build build-$c-$s $c $abicheck $buildtype $stdatomic --default-library=$s
 		unset CC
 	done
 done
@@ -254,7 +256,7 @@ generic_isa='nehalem'
 if ! check_cc_flags "-march=$generic_isa" ; then
 	generic_isa='corei7'
 fi
-build build-x86-generic cc skipABI -Dcheck_includes=true \
+build build-x86-generic cc skipABI --buildtype=debug -Dcheck_includes=true \
 	-Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared
 
 # 32-bit with default compiler
Signature · 1 line
2.52.0
#41 lore raw

PATCH v4 11/11 ci: check minsize build type in GHA

In reply to Thomas Monjalon

In GitHub Actions, the build for Fedora with GCC is updated to use the Meson build type "minsize".
This type may have some different requirements (or bugs), so it is better for its maintenance to test it regularly in the CI.

---
 .ci/linux-build.sh          | 2 ++
 .github/workflows/build.yml | 2 ++
 2 files changed, 4 insertions(+)
.ci/linux-build.sh +2 -0
index aac0bd3dc5..e0b914a142 100755
@@ -85,6 +85,8 @@ buildtype=debugoptimized
 
 if [ "$BUILD_DEBUG" = "true" ]; then
     buildtype=debug
+elif [ "$BUILD_MINSIZE" = "true" ]; then
+    buildtype=minsize
 fi
 
 if [ "$BUILD_DOCS" = "true" ]; then
.github/workflows/build.yml +2 -0
index ab140f885e..f0142efd3b 100644
@@ -325,6 +325,7 @@ jobs:
         config:
           - image: fedora:43
             compiler: gcc
+            checks: minsize
           - image: fedora:43
             compiler: clang
 
@@ -362,6 +363,7 @@ jobs:
         echo CCACHE_DIR=/root/.ccache >> ~/env
         echo DEF_LIB=${{ matrix.config.library }} >> ~/env
         echo STDATOMIC=false >> ~/env
+        echo BUILD_MINSIZE=${{ contains(matrix.config.checks, 'minsize') }} >> ~/env
     - name: Load the cached image
       run: |
         docker load -i ~/.image/${{ matrix.config.image }}.tar
Signature · 1 line
2.52.0
#42 lore raw

Re: [PATCH v4 11/11] ci: check minsize build type in GHA

Quoted 38 lines · Thomas Monjalon

In GitHub Actions, the build for Fedora with GCC is updated to use the Meson build type "minsize".
This type may have some different requirements (or bugs), so it is better for its maintenance to test it regularly in the CI.

---
 .ci/linux-build.sh          | 2 ++
 .github/workflows/build.yml | 2 ++
 2 files changed, 4 insertions(+)
.ci/linux-build.sh +2 -0
index aac0bd3dc5..e0b914a142 100755
@@ -85,6 +85,8 @@ buildtype=debugoptimized
 
 if [ "$BUILD_DEBUG" = "true" ]; then
     buildtype=debug
+elif [ "$BUILD_MINSIZE" = "true" ]; then
+    buildtype=minsize
 fi
 
 if [ "$BUILD_DOCS" = "true" ]; then
.github/workflows/build.yml +1 -0
index ab140f885e..f0142efd3b 100644
@@ -325,6 +325,7 @@ jobs:
         config:
           - image: fedora:43
             compiler: gcc
+            checks: minsize
           - image: fedora:43
             compiler: clang
 

.github/workflows/build.yml jobs: · line 369

Quoted 7 lines
.github/workflows/build.yml +1 -0
@@ -362,6 +363,7 @@ jobs:
         echo CCACHE_DIR=/root/.ccache >> ~/env
         echo DEF_LIB=${{ matrix.config.library }} >> ~/env
         echo STDATOMIC=false >> ~/env
+        echo BUILD_MINSIZE=${{ contains(matrix.config.checks, 'minsize') }} >> ~/env
     - name: Load the cached image
       run: |
         docker load -i ~/.image/${{ matrix.config.image }}.tar

LGTM.

Note: the reason for this (ugly) manual filling of env is that we do not use GHA support of containers.
At the time I added fedora containers, I had multiple occasions when pulling the images resulted in failures (getting throttled).

Maybe things got better since then... I see OVS does use GHA support. Any volunteer to reevaluate this?

Signature · 1 line
David Marchand
#43 lore raw

Re: [PATCH v4 00/11] more build tests

In reply to Thomas Monjalon

05/02/2026 22:27, Thomas Monjalon:

Quoted 8 lines

While testing more build types, some errors occur.

v5: add minsize and fix debug build types in GHA
fix new warnings with minsize and debug builds
v4: fix new warnings with minsize
v3: fix minsize build with GCC
v2: fix init of var buildtype

Quoted 12 lines

Thomas Monjalon (11):
mem: check fbarray name truncation in secondary process
mem: avoid hugepage path overflow
argparse: fix minsize build
mldev: fix minsize build
bus/pci: fix minsize build
power/intel_pstate: fix minsize build net/bnxt/tf_ulp: fix minsize build
net/iavf: fix minsize build
ci: fix debug build type
devtools: test different build types
ci: check minsize build type in GHA

Applied with the fix for the undefined behaviour of asprintf.