[v2] net/mlx5: fix linkage error for glue lib

Message ID 20180725131854.51881-1-shahafs@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers
Series [v2] net/mlx5: fix linkage error for glue lib |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shahaf Shuler July 25, 2018, 1:18 p.m. UTC
  From: Yaroslav Brustinov <ybrustin@cisco.com>

addressing a gcc 4.7.2 bug that cannot be reproduced with latter
versions:

"bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"

Fix it be forcing the alignment of the glue lib.

Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate file")
Cc: stable@dpdk.org
Cc: nelio.laranjeiro@6wind.com
Cc: adrien.mazarguil@6wind.com

Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
On v2:
 - Forced alignment using alignas to the size of the cacheline.

---
 drivers/net/mlx5/mlx5_glue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Adrien Mazarguil July 25, 2018, 1:22 p.m. UTC | #1
On Wed, Jul 25, 2018 at 04:18:54PM +0300, Shahaf Shuler wrote:
> From: Yaroslav Brustinov <ybrustin@cisco.com>
> 
> addressing a gcc 4.7.2 bug that cannot be reproduced with latter
> versions:
> 
> "bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
> src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
> src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"
> 
> Fix it be forcing the alignment of the glue lib.
> 
> Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate file")
> Cc: stable@dpdk.org
> Cc: nelio.laranjeiro@6wind.com
> Cc: adrien.mazarguil@6wind.com
> 
> Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>

Except for a couple of minor nits below,

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

> ---
> On v2:
>  - Forced alignment using alignas to the size of the cacheline.
> 
> ---
>  drivers/net/mlx5/mlx5_glue.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
> index c7965e51fe..705232f614 100644
> --- a/drivers/net/mlx5/mlx5_glue.c
> +++ b/drivers/net/mlx5/mlx5_glue.c
> @@ -6,6 +6,7 @@
>  #include <errno.h>
>  #include <stddef.h>
>  #include <stdint.h>
> +#include <stdalign.h>

You should keep alphabetical order.

>  
>  /*
>   * Not needed by this file; included to work around the lack of off_t
> @@ -23,6 +24,8 @@
>  #pragma GCC diagnostic error "-Wpedantic"
>  #endif
>  
> +#include <rte_config.h>
> +
>  #include "mlx5_autoconf.h"
>  #include "mlx5_glue.h"
>  
> @@ -343,7 +346,8 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
>  #endif
>  }
>  
> -const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
> +alignas(RTE_CACHE_LINE_SIZE)
> +const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {

Extra space added before opening brace :)

>  	.version = MLX5_GLUE_VERSION,
>  	.fork_init = mlx5_glue_fork_init,
>  	.alloc_pd = mlx5_glue_alloc_pd,
> -- 
> 2.12.0
>
  
Shahaf Shuler July 26, 2018, 5:44 a.m. UTC | #2
Wednesday, July 25, 2018 4:23 PM, Adrien Mazarguil:
> Subject: Re: [PATCH v2] net/mlx5: fix linkage error for glue lib
> 
> On Wed, Jul 25, 2018 at 04:18:54PM +0300, Shahaf Shuler wrote:
> > From: Yaroslav Brustinov <ybrustin@cisco.com>
> >
> > addressing a gcc 4.7.2 bug that cannot be reproduced with latter
> > versions:
> >
> > "bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
> > src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
> > src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"
> >
> > Fix it be forcing the alignment of the glue lib.
> >
> > Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate
> > file")
> > Cc: stable@dpdk.org
> > Cc: nelio.laranjeiro@6wind.com
> > Cc: adrien.mazarguil@6wind.com
> >
> > Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> Except for a couple of minor nits below,
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to next-net-mlx with the needed fixes. Thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index c7965e51fe..705232f614 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -6,6 +6,7 @@ 
 #include <errno.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <stdalign.h>
 
 /*
  * Not needed by this file; included to work around the lack of off_t
@@ -23,6 +24,8 @@ 
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
+#include <rte_config.h>
+
 #include "mlx5_autoconf.h"
 #include "mlx5_glue.h"
 
@@ -343,7 +346,8 @@  mlx5_glue_dv_create_qp(struct ibv_context *context,
 #endif
 }
 
-const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
+alignas(RTE_CACHE_LINE_SIZE)
+const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 	.version = MLX5_GLUE_VERSION,
 	.fork_init = mlx5_glue_fork_init,
 	.alloc_pd = mlx5_glue_alloc_pd,