[dpdk,v1] net/mlx5: fix possible building error
diff mbox series

Message ID 1582972040-7026-1-git-send-email-xiangxia.m.yue@gmail.com
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers show
Series
  • [dpdk,v1] net/mlx5: fix possible building error
Related show

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Tonghao Zhang Feb. 29, 2020, 10:27 a.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y,
and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include
relative codes.

> mlx5_common.o: In function `mlx5_glue_init':
> drivers/common/mlx5/mlx5_common.c:324: undefined reference to `dlclose'

Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
Cc: stable@dpdk.org

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ali Alnubani March 1, 2020, 5:09 p.m. UTC | #1
Hi Tonghao,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of
> xiangxia.m.yue@gmail.com
> Sent: Saturday, February 29, 2020 12:27 PM
> To: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>; stable@dpdk.org
> Subject: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> 
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5
> pmd, there is a building error.
> To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.
> 
> > mlx5_common.o: In function `mlx5_glue_init':
> > drivers/common/mlx5/mlx5_common.c:324: undefined reference to
> `dlclose'
> 
> Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  drivers/common/mlx5/mlx5_common.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

I test this case on multiple environments and don't see the build failure. Can you please provide more information about yours, and how to reproduce this?

Thanks,
Ali
Tonghao Zhang March 2, 2020, 12:22 a.m. UTC | #2
On Mon, Mar 2, 2020 at 1:09 AM Ali Alnubani <alialnu@mellanox.com> wrote:
>
> Hi Tonghao,
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of
> > xiangxia.m.yue@gmail.com
> > Sent: Saturday, February 29, 2020 12:27 PM
> > To: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> > Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> >
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5
> > pmd, there is a building error.
> > To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.
> >
> > > mlx5_common.o: In function `mlx5_glue_init':
> > > drivers/common/mlx5/mlx5_common.c:324: undefined reference to
> > `dlclose'
> >
> > Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> >  drivers/common/mlx5/mlx5_common.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
>
> I test this case on multiple environments and don't see the build failure. Can you please provide more information about yours, and how to reproduce this?
Hi Ali,
I use the dpdk-next-net, and the last commit id is
d7142fbae16f185e11bfa44be061399afc40a1be.
The build config is show as below:

diff --git a/config/common_base b/config/common_base
index 7ca2f28..4bd5126 100644
--- a/config/common_base
+++ b/config/common_base
@@ -57,7 +57,7 @@ CONFIG_RTE_ENABLE_LTO=n
 #
 # Compile to share library
 #
-CONFIG_RTE_BUILD_SHARED_LIB=n
+CONFIG_RTE_BUILD_SHARED_LIB=y

 #
 # Use newest code breaking previous ABI
@@ -363,7 +363,7 @@ CONFIG_RTE_LIBRTE_MLX4_DEBUG=n
 # Compile burst-oriented Mellanox ConnectX-4, ConnectX-5,
 # ConnectX-6 & BlueField (MLX5) PMD
 #
-CONFIG_RTE_LIBRTE_MLX5_PMD=n
+CONFIG_RTE_LIBRTE_MLX5_PMD=y
 CONFIG_RTE_LIBRTE_MLX5_DEBUG=n

 #

The building failure log show:
LD librte_common_mlx5.so.20.0.1
mlx5_common.o: In function `mlx5_glue_init':
/root/zth/myshell/dpdk-next-net/drivers/common/mlx5/mlx5_common.c:324:
undefined reference to `dlclose'
collect2: error: ld returned 1 exit status

> Thanks,
> Ali
Ali Alnubani March 2, 2020, 7:35 a.m. UTC | #3
> -----Original Message-----
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> Sent: Monday, March 2, 2020 2:23 AM
> To: Ali Alnubani <alialnu@mellanox.com>
> Cc: stable@dpdk.org; Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> 
> On Mon, Mar 2, 2020 at 1:09 AM Ali Alnubani <alialnu@mellanox.com>
> wrote:
> >
> > Hi Tonghao,
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of
> > > xiangxia.m.yue@gmail.com
> > > Sent: Saturday, February 29, 2020 12:27 PM
> > > To: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> > > Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>; stable@dpdk.org
> > > Subject: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> > >
> > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > >
> > > When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the
> > > mlx5 pmd, there is a building error.
> > > To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.
> > >
> > > > mlx5_common.o: In function `mlx5_glue_init':
> > > > drivers/common/mlx5/mlx5_common.c:324: undefined reference to
> > > `dlclose'
> > >
> > > Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > ---
> > >  drivers/common/mlx5/mlx5_common.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> >
> > I test this case on multiple environments and don't see the build failure.
> Can you please provide more information about yours, and how to
> reproduce this?
> Hi Ali,
> I use the dpdk-next-net, and the last commit id is
> d7142fbae16f185e11bfa44be061399afc40a1be.
> The build config is show as below:
> 
> diff --git a/config/common_base b/config/common_base index
> 7ca2f28..4bd5126 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -57,7 +57,7 @@ CONFIG_RTE_ENABLE_LTO=n  #  # Compile to share
> library  # -CONFIG_RTE_BUILD_SHARED_LIB=n
> +CONFIG_RTE_BUILD_SHARED_LIB=y
> 
>  #
>  # Use newest code breaking previous ABI @@ -363,7 +363,7 @@
> CONFIG_RTE_LIBRTE_MLX4_DEBUG=n  # Compile burst-oriented Mellanox
> ConnectX-4, ConnectX-5,  # ConnectX-6 & BlueField (MLX5) PMD  # -
> CONFIG_RTE_LIBRTE_MLX5_PMD=n
> +CONFIG_RTE_LIBRTE_MLX5_PMD=y
>  CONFIG_RTE_LIBRTE_MLX5_DEBUG=n
> 
>  #
> 
> The building failure log show:
> LD librte_common_mlx5.so.20.0.1
> mlx5_common.o: In function `mlx5_glue_init':
> /root/zth/myshell/dpdk-next-
> net/drivers/common/mlx5/mlx5_common.c:324:
> undefined reference to `dlclose'
> collect2: error: ld returned 1 exit status
> 

Do you mind sharing which OS are you using, which gcc/clang version, whether you have MLNX_OFED or rdma-core installed, and which version?

Thanks,
Ali
Tonghao Zhang March 2, 2020, 8:13 a.m. UTC | #4
On Mon, Mar 2, 2020 at 3:35 PM Ali Alnubani <alialnu@mellanox.com> wrote:
>
> > -----Original Message-----
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > Sent: Monday, March 2, 2020 2:23 AM
> > To: Ali Alnubani <alialnu@mellanox.com>
> > Cc: stable@dpdk.org; Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> >
> > On Mon, Mar 2, 2020 at 1:09 AM Ali Alnubani <alialnu@mellanox.com>
> > wrote:
> > >
> > > Hi Tonghao,
> > >
> > > > -----Original Message-----
> > > > From: dev <dev-bounces@dpdk.org> On Behalf Of
> > > > xiangxia.m.yue@gmail.com
> > > > Sent: Saturday, February 29, 2020 12:27 PM
> > > > To: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> > > > Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>; stable@dpdk.org
> > > > Subject: [dpdk-dev] [dpdk v1] net/mlx5: fix possible building error
> > > >
> > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > >
> > > > When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the
> > > > mlx5 pmd, there is a building error.
> > > > To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.
> > > >
> > > > > mlx5_common.o: In function `mlx5_glue_init':
> > > > > drivers/common/mlx5/mlx5_common.c:324: undefined reference to
> > > > `dlclose'
> > > >
> > > > Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > > ---
> > > >  drivers/common/mlx5/mlx5_common.c | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > >
> > >
> > > I test this case on multiple environments and don't see the build failure.
> > Can you please provide more information about yours, and how to
> > reproduce this?
> > Hi Ali,
> > I use the dpdk-next-net, and the last commit id is
> > d7142fbae16f185e11bfa44be061399afc40a1be.
> > The build config is show as below:
> >
> > diff --git a/config/common_base b/config/common_base index
> > 7ca2f28..4bd5126 100644
> > --- a/config/common_base
> > +++ b/config/common_base
> > @@ -57,7 +57,7 @@ CONFIG_RTE_ENABLE_LTO=n  #  # Compile to share
> > library  # -CONFIG_RTE_BUILD_SHARED_LIB=n
> > +CONFIG_RTE_BUILD_SHARED_LIB=y
> >
> >  #
> >  # Use newest code breaking previous ABI @@ -363,7 +363,7 @@
> > CONFIG_RTE_LIBRTE_MLX4_DEBUG=n  # Compile burst-oriented Mellanox
> > ConnectX-4, ConnectX-5,  # ConnectX-6 & BlueField (MLX5) PMD  # -
> > CONFIG_RTE_LIBRTE_MLX5_PMD=n
> > +CONFIG_RTE_LIBRTE_MLX5_PMD=y
> >  CONFIG_RTE_LIBRTE_MLX5_DEBUG=n
> >
> >  #
> >
> > The building failure log show:
> > LD librte_common_mlx5.so.20.0.1
> > mlx5_common.o: In function `mlx5_glue_init':
> > /root/zth/myshell/dpdk-next-
> > net/drivers/common/mlx5/mlx5_common.c:324:
> > undefined reference to `dlclose'
> > collect2: error: ld returned 1 exit status
> >
>
> Do you mind sharing which OS are you using, which gcc/clang version, whether you have MLNX_OFED or rdma-core installed, and which version?
1. CentOS Linux release 7.6.1810 (Core)
2. kernel 3.10.0-957.1.3.el7.x86_64
3. OFED 4.7-3.2.9
4. FW 16.26.4012
5. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
6. build the dpdk with x86_64-native-linuxapp-gcc
> Thanks,
> Ali
Ali Alnubani March 2, 2020, 9:47 a.m. UTC | #5
> > Do you mind sharing which OS are you using, which gcc/clang version,
> whether you have MLNX_OFED or rdma-core installed, and which version?
> 1. CentOS Linux release 7.6.1810 (Core)
> 2. kernel 3.10.0-957.1.3.el7.x86_64
> 3. OFED 4.7-3.2.9
> 4. FW 16.26.4012
> 5. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 6. build the dpdk with x86_64-
> native-linuxapp-gcc

Thanks for sharing this information, still can't reproduce though:

"""
[root@hostname dpdk-next-net]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

[root@hostname dpdk-next-net]# ofed_info -s
MLNX_OFED_LINUX-4.7-3.2.9.0:

[root@hostname dpdk-next-net]# gcc --version | head -1
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)

[root@hostname dpdk-next-net]# git log -1 --oneline
d7142fb version: 20.02

[root@hostname dpdk-next-net]# git diff -U0
diff --git a/config/common_base b/config/common_base
index 7ca2f28..4bd5126 100644
--- a/config/common_base
+++ b/config/common_base
@@ -60 +60 @@ CONFIG_RTE_ENABLE_LTO=n
-CONFIG_RTE_BUILD_SHARED_LIB=n
+CONFIG_RTE_BUILD_SHARED_LIB=y
@@ -366 +366 @@ CONFIG_RTE_LIBRTE_MLX4_DEBUG=n
-CONFIG_RTE_LIBRTE_MLX5_PMD=n
+CONFIG_RTE_LIBRTE_MLX5_PMD=y

[root@hostname dpdk-next-net]# make install T=x86_64-native-linuxapp-gcc -j$(nproc --all) > /dev/null
[root@hostname dpdk-next-net]# echo $?
0
"""

Anyway, I ran some tests on the patch and don't see any regressions.
One small issue though, the script check-git-log.sh is failing:
"""
./devtools/check-git-log.sh -1
Wrong headline prefix:
        net/mlx5: fix possible building error
"""
You could use common/mlx5 instead of net/mlx5. 

Tested-by: Ali Alnubani <alialnu@mellanox.com>

Thanks,
Ali
Tonghao Zhang March 2, 2020, 10:56 a.m. UTC | #6
On Mon, Mar 2, 2020 at 5:47 PM Ali Alnubani <alialnu@mellanox.com> wrote:
>
> > > Do you mind sharing which OS are you using, which gcc/clang version,
> > whether you have MLNX_OFED or rdma-core installed, and which version?
> > 1. CentOS Linux release 7.6.1810 (Core)
> > 2. kernel 3.10.0-957.1.3.el7.x86_64
> > 3. OFED 4.7-3.2.9
> > 4. FW 16.26.4012
> > 5. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 6. build the dpdk with x86_64-
> > native-linuxapp-gcc
>
> Thanks for sharing this information, still can't reproduce though:
>
> """
> [root@hostname dpdk-next-net]# cat /etc/redhat-release
> CentOS Linux release 7.6.1810 (Core)
>
> [root@hostname dpdk-next-net]# ofed_info -s
> MLNX_OFED_LINUX-4.7-3.2.9.0:
>
> [root@hostname dpdk-next-net]# gcc --version | head -1
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
>
> [root@hostname dpdk-next-net]# git log -1 --oneline
> d7142fb version: 20.02
>
> [root@hostname dpdk-next-net]# git diff -U0
> diff --git a/config/common_base b/config/common_base
> index 7ca2f28..4bd5126 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -60 +60 @@ CONFIG_RTE_ENABLE_LTO=n
> -CONFIG_RTE_BUILD_SHARED_LIB=n
> +CONFIG_RTE_BUILD_SHARED_LIB=y
> @@ -366 +366 @@ CONFIG_RTE_LIBRTE_MLX4_DEBUG=n
> -CONFIG_RTE_LIBRTE_MLX5_PMD=n
> +CONFIG_RTE_LIBRTE_MLX5_PMD=y
>
> [root@hostname dpdk-next-net]# make install T=x86_64-native-linuxapp-gcc -j$(nproc --all) > /dev/null
> [root@hostname dpdk-next-net]# echo $?
> 0
> """
>
> Anyway, I ran some tests on the patch and don't see any regressions.
> One small issue though, the script check-git-log.sh is failing:
> """
> ./devtools/check-git-log.sh -1
> Wrong headline prefix:
>         net/mlx5: fix possible building error
> """
> You could use common/mlx5 instead of net/mlx5.
>
> Tested-by: Ali Alnubani <alialnu@mellanox.com>
Thanks for your work, v2 has been sent.

> Thanks,
> Ali

Patch
diff mbox series

diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index 610fb48..570a3f4 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -209,8 +209,6 @@  enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-	void *handle = NULL;
-
 	/* Initialize common log type. */
 	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
 	if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@  enum mlx5_class
 		 mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
 	};
 	unsigned int i = 0;
+	void *handle = NULL;
 	void **sym;
 	const char *dlmsg;
 
@@ -320,8 +319,10 @@  enum mlx5_class
 	mlx5_glue->fork_init();
 	return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
 	if (handle)
 		dlclose(handle);
+#endif
 	DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
 		" run-time dependency on rdma-core libraries (libibverbs,"
 		" libmlx5)");