From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E7F0A0574 for ; Thu, 5 Mar 2020 07:59:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5797B1BFD6; Thu, 5 Mar 2020 07:59:52 +0100 (CET) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by dpdk.org (Postfix) with ESMTP id F07443B5; Thu, 5 Mar 2020 07:59:48 +0100 (CET) Received: by mail-qk1-f195.google.com with SMTP id u25so4314955qkk.3; Wed, 04 Mar 2020 22:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8dEMCpM3BnEZEamox7QZD+PbYbN+/oa6a6MG6peHppg=; b=cb6d2L1bkFzZtqQQ3B/b3ixzwsfGTDRXZ5iMcJJwHcgksruss5lFQklpnt6j1WObKd YUyneiKMd+WZ+y42PTeOElutPaDyJjbkbc7UDLLBO2bxVE22UPMTVgPXxYI6zRP/iti3 TcKn07XWEdoInu1qMfn6SGyt8944q3RzQzOQgaKh/J3WaUNpM15d5jMbVS8ixLCbM6qR Rnd5/GKU+Pzr/oUaFw6X8HU95rLK1UQVuW9IeF7Vzl7AkrebRyWmmpZeh8tihJWidFLq xddKwHTidzRhHTS0+QDHklrduavdS4yTEnIKaNuFfeXY2EItJj11ohfB+0L9mTsO8Pi9 U1fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8dEMCpM3BnEZEamox7QZD+PbYbN+/oa6a6MG6peHppg=; b=XK+PD44Mxe64auxoJuRJWKJ9W0hqH4SDtLBKbC2FRpaAjjGUR1ubTERhIVk9eS2K4w nqIumiD6EkxsghKbG9hGvBtBkOJW05KJLleKuOrPoXfNWwqDhiLpmlGddn2eZLElLb2P sddjymGDXvc+g8YdM7in1lTveUmYEbS8bPf1hnDqueK0mOkcyrn13xXOmJohFAI6aaQ2 HJwc+OaRqhG18VZCOtz4xKVaiDcN5NRpLbJHr9+VAE1gyKQd+NtBYdTrXX06Xy6exaju hRapxIPS6+DvS3Ocf2/rHvV+qdFn8HDogQ5pcy/tr6Z+QB/LhQlktCeyvl3zIvvC1rtU uMRg== X-Gm-Message-State: ANhLgQ2o4KCnxuvyl2PvSzKSdLyT46G9wRFfYRpRfJBRZ92v0cvcsAaw mOVz/2KezDYC454SZJEiPhdOKvUUM9oJtVja5JU= X-Google-Smtp-Source: ADFU+vvOhhN/GZz7WkecZ2dOiE7Hn612jb+GZLBQvN5VJtiegP5rrYpcx9ePdpVjP1RLcuFbN6NcEuasnsZXq6uo0Vo= X-Received: by 2002:a05:620a:148e:: with SMTP id w14mr6787415qkj.473.1583391588108; Wed, 04 Mar 2020 22:59:48 -0800 (PST) MIME-Version: 1.0 References: <1583146517-7079-1-git-send-email-xiangxia.m.yue@gmail.com> In-Reply-To: From: Tonghao Zhang Date: Thu, 5 Mar 2020 14:59:11 +0800 Message-ID: To: Matan Azrad Cc: Raslan Darawsheh , Ali Alnubani , "dev@dpdk.org" , "stable@dpdk.org" Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [PATCH dpdk-dev v2] common/mlx5: fix possible building error X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Thu, Mar 5, 2020 at 12:03 AM Matan Azrad wrote: > > > > From: Tonghao Zhang > > On Wed, Mar 4, 2020 at 10:25 PM Matan Azrad > > wrote: > > > > > > > > > > > > From: Tonghao Zhang > > > > On Tue, Mar 3, 2020 at 3:15 PM Matan Azrad > > wrote: > > > > > > > > > > > > > > > Hi > > > > > > > > > > From: xiangxia.m.yue@gmail.com > > > > > > From: Tonghao Zhang > > > > > > > > > > > > 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 > > > > > > Tested-by: Ali Alnubani > > > > > > > > > > The title should point to the root cause - not to the results. > > > > > > > > > > Something like: > > > > > > > > > > common/mlx5: fix dynamic loading reference > > > > > > > > > > > drivers/common/mlx5/mlx5_common.c | 5 +++-- > > > > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > What's about " #include " Is it compiled for you? > > > > Yes, still building fail. > > > > > If so, why dlclose is not known on your setup? > > > > When I fixed it, I found the codes in mlx5_glue_init, use the > > > > RTE_IBVERBS_LINK_DLOPEN. > > > > but dlclose is not included in it. I think we should add > > > > RTE_IBVERBS_LINK_DLOPEN to fix the building fail. > > > > > > I agree, but looks like the include should be in the define area too. No? > > No, the "dlfcn.h" in dpdk is not included in define area at all. > > > > [root@localhost dpdk-next-net]# grep -rwin "dlfcn.h" > > lib/librte_eal/common/eal_common_options.c:17:#include > > drivers/net/ark/ark_ethdev.c:7:#include > > drivers/net/mlx4/mlx4.c:11:#include > > drivers/common/mlx5/mlx5_common.c:5:#include > > examples/performance-thread/pthread_shim/pthread_shim.c:10:#include > > > > > > and other codes should be in define area, but not: > > drivers/net/ark/ark_ethdev.c:177 > > lib/librte_eal/common/eal_common_options.c:306 > > drivers/common/mlx5/mlx5_common.c:325(this patch fix) > > > > > So, Is it compiled well to include it while its lib is not loaded? Review the codes again, RTE_IBVERBS_LINK_DLOPEN is only used for mlx4/mlx5. Other codes is unnecessary included in RTE_IBVERBS_LINK_DLOPEN define. v3 is shown as below, and tested: https://travis-ci.com/ovn-open-virtual-networks/dpdk-next-net/builds/151882661 diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 610fb48..9ea56f2 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -2,10 +2,12 @@ * Copyright 2019 Mellanox Technologies, Ltd */ -#include #include #include #include +#ifdef RTE_IBVERBS_LINK_DLOPEN +#include +#endif #include @@ -209,8 +211,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) @@ -233,6 +233,8 @@ enum mlx5_class /* The glue initialization was done earlier by mlx5 common library. */ #ifdef RTE_IBVERBS_LINK_DLOPEN char glue_path[sizeof(RTE_EAL_PMD_PATH) - 1 + sizeof("-glue")]; + void *handle = NULL; + const char *path[] = { /* * A basic security check is necessary before trusting @@ -320,8 +322,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)"); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index a1dd658..8e29878 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -8,7 +8,6 @@ * mlx4 driver initialization. */ -#include #include #include #include @@ -18,6 +17,9 @@ #include #include #include +#ifdef RTE_IBVERBS_LINK_DLOPEN +#include +#endif /* Verbs headers do not support -pedantic. */ #ifdef PEDANTIC > > > > > > > > > > > > > > > > DRV_LOG(WARNING, "Cannot initialize MLX5 common due to > > > > > > missing" > > > > > > " run-time dependency on rdma-core libraries (libibverbs," > > > > > > " libmlx5)"); > > > > > > -- > > > > > > 1.8.3.1 > > > > > > > > > > > > > > > > > -- > > > > Thanks, > > > > Tonghao > > > > > > > > -- > > Thanks, > > Tonghao -- Thanks, Tonghao