Subject: Re: linux-next: Tree for Jan 30 + 20200206 (drivers/infiniband/hw/mlx5/)

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 6 Feb 2020 10:32:01 -0400

On Thu, Feb 06, 2020 at 01:40:33PM +0200, Leon Romanovsky wrote:
> On Thu, Feb 06, 2020 at 09:30:19AM +0200, Leon Romanovsky wrote:
> > On Wed, Feb 05, 2020 at 09:31:15PM -0800, Randy Dunlap wrote:
> > > On 1/30/20 5:47 AM, Randy Dunlap wrote:
> > > > On 1/29/20 8:28 PM, Stephen Rothwell wrote:
> > > >> Hi all,
> > > >>
> > > >> Please do not add any v5.7 material to your linux-next included
> > > >> branches until after v5.6-rc1 has been released.
> > > >>
> > > >> Changes since 20200129:
> > > >>
> > > >
> > > > on i386:
> > > >
> > > > ERROR: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> > > > ERROR: "__divdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> > > >
> > > >
> > > > Full randconfig file is attached.
> > > >
> > > >
> > >
> > > I am still seeing this on linux-next of 20200206.
> >
> > Sorry, I was under wrong impression that this failure is connected to
> > other issue reported by you.
> >
> > I'm looking on it right now.
> 
> Randy,
> 
> I'm having hard time to reproduce the failure.
> ➜  kernel git:(a0c61bf1c773) ✗ git fixes
> Fixes: a0c61bf1c773 ("Add linux-next specific files for 20200206")
> ➜  kernel git:(a0c61bf1c773) ✗ wget https://lore.kernel.org/lkml/[email-masked]/2-config-r9621
> from https://lore.kernel.org/lkml/[email-masked]/
> ➜  kernel git:(a0c61bf1c773) ✗ mv 2-config-r9621 .config
> ➜  kernel git:(a0c61bf1c773) ✗ make ARCH=i386 -j64 -s M=drivers/infiniband/hw/mlx5
> ➜  kernel git:(a0c61bf1c773) ✗ file drivers/infiniband/hw/mlx5/mlx5_ib.ko
> drivers/infiniband/hw/mlx5/mlx5_ib.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), BuildID[sha1]=49f81f5d56f7caf95d4a6cc9097391622c34f4ba, not stripped
> 
> on my 64bit system:
> ➜  kernel git:(rdma-next) file drivers/infiniband/hw/mlx5/mlx5_ib.ko
> drivers/infiniband/hw/mlx5/mlx5_ib.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=2dcb1e30d0bba9885d5a824f6f57488a98f0c95d, with debug_info, not stripped

You need to link to see it..

>From bee7b242c2c6a3bfb696cd5fa37d83a731f3ab15 Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <[email-masked]>
Date: Thu, 6 Feb 2020 10:27:54 -0400
Subject: [PATCH] IB/mlx5: Use div64_u64 for num_var_hw_entries calculation

On i386:

ERROR: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
ERROR: "__divdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!

Fixes: f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities")
Reported-by: Randy Dunlap <[email-masked]>
Signed-off-by: Jason Gunthorpe <[email-masked]>
---
 drivers/infiniband/hw/mlx5/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 0ca9581432808c..9b88935f805ba2 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6543,7 +6543,7 @@ static int mlx5_ib_init_var_table(struct mlx5_ib_dev *dev)
 					doorbell_bar_offset);
 	bar_size = (1ULL << log_doorbell_bar_size) * 4096;
 	var_table->stride_size = 1ULL << log_doorbell_stride;
-	var_table->num_var_hw_entries = bar_size / var_table->stride_size;
+	var_table->num_var_hw_entries = div64_u64(bar_size, var_table->stride_size);
 	mutex_init(&var_table->bitmap_lock);
 	var_table->bitmap = bitmap_zalloc(var_table->num_var_hw_entries,
 					  GFP_KERNEL);
-- 
2.25.0