Skip to contentSkip to conversation

IB/mlx5: Fix linkage failure on 32-bit arches

PATCH In review Alexander Lobakin 3 participants 5 messages Feb 14, 2020 – Feb 17, 2020

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

PATCH 1/1 IB/mlx5: Fix linkage failure on 32-bit arches

Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities") introduced a straight "/" division of the u64 variable "bar_size", which emits an __udivdi3() libgcc call on 32-bit arches and certain GCC versions:

error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]

Replace it with the corresponding div_u64() call. Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.

[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@mail.gmail.com/

Fixes f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR

capabilities")

---
 drivers/infiniband/hw/mlx5/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +2 -1
index e874d688d040..c47530e4d202 100644
@@ -6545,7 +6545,8 @@ 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 = div_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);
Signature · 1 line
2.25.0
#1 lore raw
Quoted 10 lines · Alexander Lobakin

Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities") introduced a straight "/" division of the u64 variable "bar_size", which emits an __udivdi3() libgcc call on 32-bit arches and certain GCC versions:

error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]

Replace it with the corresponding div_u64() call. Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.

Quoted 8 lines

[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@mail.gmail.com/

Fixes f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR

capabilities")

---
 drivers/infiniband/hw/mlx5/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Randy beat you too it..

https://lore.kernel.org/linux-rdma/[email protected]/

But it seems patchwork missed this somehow.

Applied now at least

Jason

#2 lore raw

Jason Gunthorpe wrote 14.02.2020 22:24:

Quoted 20 lines · Alexander Lobakin
Quoted 10 lines

Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities") introduced a straight "/" division of the u64 variable "bar_size", which emits an __udivdi3() libgcc call on 32-bit arches and certain GCC versions:

error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]

Replace it with the corresponding div_u64() call. Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.

Quoted 8 lines

[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@mail.gmail.com/

Fixes f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR

capabilities")

---
 drivers/infiniband/hw/mlx5/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 3 lines

Randy beat you too it..

https://lore.kernel.org/linux-rdma/[email protected]/

Ah, OK. Sorry for missing this one. I didn't see any fix over git.kernel.org and thought it doesn't exist yet.

Quoted 3 lines

But it seems patchwork missed this somehow.

Applied now at least

Thanks!

Quoted 1 line

Jason

Regards,
ᚷ ᛖ ᚢ ᚦ ᚠ ᚱ

#3 lore raw
Quoted 22 lines · Alexander Lobakin

Jason Gunthorpe wrote 14.02.2020 22:24:

Quoted 21 lines · Alexander Lobakin
Quoted 19 lines

Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities") introduced a straight "/" division of the u64 variable "bar_size", which emits an __udivdi3() libgcc call on 32-bit arches and certain GCC versions:

error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]

Replace it with the corresponding div_u64() call. Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.

[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@mail.gmail.com/

Fixes f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR

capabilities")

---
 drivers/infiniband/hw/mlx5/main.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 10 lines
Quoted 3 lines

Randy beat you too it..

https://lore.kernel.org/linux-rdma/[email protected]/

Ah, OK. Sorry for missing this one. I didn't see any fix over git.kernel.org and thought it doesn't exist yet.

Quoted 3 lines

But it seems patchwork missed this somehow.

Applied now at least

Jason, I think Alexander's patch is more correct. It uses div_u64, while yours uses div64_u64. The divider is 32-bit, so div_u64 would be more optimized on most 32-bit architectures.

Quoted 6 lines

Thanks!

Quoted 1 line

Jason

Regards,
ᚷ ᛖ ᚢ ᚦ ᚠ ᚱ

#4 lore raw
Quoted 30 lines · Maxim Mikityanskiy
Quoted 29 lines · Alexander Lobakin

Jason Gunthorpe wrote 14.02.2020 22:24:

Quoted 21 lines · Alexander Lobakin
Quoted 11 lines

Commit f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR capabilities") introduced a straight "/" division of the u64 variable "bar_size", which emits an __udivdi3() libgcc call on 32-bit arches and certain GCC versions:

error: "__udivdi3" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined! [1]

Replace it with the corresponding div_u64() call. Compile-tested on ARCH=mips 32r2el_defconfig BOARDS=ocelot.

Quoted 8 lines

[1] https://lore.kernel.org/linux-mips/CAMuHMdXM9S1VkFMZ8eDAyZR6EE4WkJY215Lcn2qdOaPeadF+EQ@mail.gmail.com/

Fixes f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR

capabilities")

 drivers/infiniband/hw/mlx5/main.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 3 lines

Randy beat you too it..

https://lore.kernel.org/linux-rdma/[email protected]/

Ah, OK. Sorry for missing this one. I didn't see any fix over git.kernel.org and thought it doesn't exist yet.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

But it seems patchwork missed this somehow.

Applied now at least

Jason, I think Alexander's patch is more correct. It uses div_u64, while yours uses div64_u64. The divider is 32-bit, so div_u64 would be more optimized on most 32-bit architectures.

Seems so, but it is already done. You can send a followup to fix it

Jason