linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
@ 2020-02-14 19:13 Alexander Lobakin
  2020-02-14 19:24 ` Jason Gunthorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Lobakin @ 2020-02-14 19:13 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Jason Gunthorpe, Yishai Hadas, Maxim Mikityanskiy,
	linux-rdma, linux-kernel, 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.

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

Fixes: f164be8c0366 ("IB/mlx5: Extend caps stage to handle VAR
capabilities")
Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
---
 drivers/infiniband/hw/mlx5/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e874d688d040..c47530e4d202 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -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);
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
  2020-02-14 19:13 [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches Alexander Lobakin
@ 2020-02-14 19:24 ` Jason Gunthorpe
  2020-02-14 19:44   ` Alexander Lobakin
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2020-02-14 19:24 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: Leon Romanovsky, Doug Ledford, Yishai Hadas, Maxim Mikityanskiy,
	linux-rdma, linux-kernel

On Fri, Feb 14, 2020 at 10:13:09PM +0300, Alexander Lobakin wrote:
> 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")
> Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
> ---
>  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/20200206143201.GF25297@ziepe.ca/

But it seems patchwork missed this somehow.

Applied now at least

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
  2020-02-14 19:24 ` Jason Gunthorpe
@ 2020-02-14 19:44   ` Alexander Lobakin
  2020-02-16 11:53     ` Maxim Mikityanskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Lobakin @ 2020-02-14 19:44 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Doug Ledford, Yishai Hadas, Maxim Mikityanskiy,
	linux-rdma, linux-kernel

Jason Gunthorpe wrote 14.02.2020 22:24:
> On Fri, Feb 14, 2020 at 10:13:09PM +0300, Alexander Lobakin wrote:
>> 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")
>> Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
>> ---
>>  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/20200206143201.GF25297@ziepe.ca/

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

> But it seems patchwork missed this somehow.
> 
> Applied now at least

Thanks!

> Jason

Regards,
ᚷ ᛖ ᚢ ᚦ ᚠ ᚱ

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
  2020-02-14 19:44   ` Alexander Lobakin
@ 2020-02-16 11:53     ` Maxim Mikityanskiy
  2020-02-17  0:36       ` Jason Gunthorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Maxim Mikityanskiy @ 2020-02-16 11:53 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Alexander Lobakin, Leon Romanovsky, Doug Ledford, Yishai Hadas,
	linux-rdma, linux-kernel

On 2020-02-14 21:44, Alexander Lobakin wrote:
> Jason Gunthorpe wrote 14.02.2020 22:24:
>> On Fri, Feb 14, 2020 at 10:13:09PM +0300, Alexander Lobakin wrote:
>>> 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")
>>> Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
>>> ---
>>>  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/20200206143201.GF25297@ziepe.ca/
> 
> Ah, OK. Sorry for missing this one. I didn't see any fix over
> git.kernel.org and thought it doesn't exist yet.
> 
>> 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.

> Thanks!
> 
>> Jason
> 
> Regards,
> ᚷ ᛖ ᚢ ᚦ ᚠ ᚱ


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches
  2020-02-16 11:53     ` Maxim Mikityanskiy
@ 2020-02-17  0:36       ` Jason Gunthorpe
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2020-02-17  0:36 UTC (permalink / raw)
  To: Maxim Mikityanskiy
  Cc: Alexander Lobakin, Leon Romanovsky, Doug Ledford, Yishai Hadas,
	linux-rdma, linux-kernel

On Sun, Feb 16, 2020 at 01:53:50PM +0200, Maxim Mikityanskiy wrote:
> On 2020-02-14 21:44, Alexander Lobakin wrote:
> > Jason Gunthorpe wrote 14.02.2020 22:24:
> > > On Fri, Feb 14, 2020 at 10:13:09PM +0300, Alexander Lobakin wrote:
> > > > 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")
> > > > Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
> > > >  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/20200206143201.GF25297@ziepe.ca/
> > 
> > Ah, OK. Sorry for missing this one. I didn't see any fix over
> > git.kernel.org and thought it doesn't exist yet.
> > 
> > > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-17  0:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 19:13 [PATCH rdma] IB/mlx5: Fix linkage failure on 32-bit arches Alexander Lobakin
2020-02-14 19:24 ` Jason Gunthorpe
2020-02-14 19:44   ` Alexander Lobakin
2020-02-16 11:53     ` Maxim Mikityanskiy
2020-02-17  0:36       ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).