Skip to contentSkip to conversation

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined!

DISCUSSION Borislav Petkov 4 participants 9 messages Sep 30, 2019 – Oct 15, 2019

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

Hi!

JFYI,

I'm seeing this on i386 allyesconfig builds of current Linus master:

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#1 lore raw
Quoted 5 lines · Borislav Petkov

I'm seeing this on i386 allyesconfig builds of current Linus master:

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This is usually result of dividing (or modulo) by a 64-bit integer. Can you identify where (file and line number) is the __umoddi3() call generated?

Michal

#2 lore raw
Quoted 10 lines · Michal Kubecek
Quoted 5 lines · Borislav Petkov

I'm seeing this on i386 allyesconfig builds of current Linus master:

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This is usually result of dividing (or modulo) by a 64-bit integer. Can you identify where (file and line number) is the __umoddi3() call generated?

Did another 32-bit allyesconfig build. It said:

ld: drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.o: in function `mlx5dr_icm_alloc_chunk':
dr_icm_pool.c:(.text+0x733): undefined reference to `__umoddi3'
make: *** [vmlinux] Error 1

The .s file then points to the exact location:

# drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c:140: align_diff = icm_mr->icm_start_addr % align_base;

        pushl   %ebx    # align_base
        pushl   %ecx    # align_base
        call    __umoddi3       #
        popl    %edx    #
        popl    %ecx    #

HTH.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#3 lore raw
Quoted 18 lines · On Mon, 30 Sep 2019 18:29:10 +0200 Borislav Petkov <[email protected]> wrote:
Quoted 10 lines · Michal Kubecek
Quoted 5 lines · Borislav Petkov

I'm seeing this on i386 allyesconfig builds of current Linus master:

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This is usually result of dividing (or modulo) by a 64-bit integer. Can you identify where (file and line number) is the __umoddi3() call generated?

Did another 32-bit allyesconfig build. It said:

ld: drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.o: in function `mlx5dr_icm_alloc_chunk':
dr_icm_pool.c:(.text+0x733): undefined reference to `__umoddi3'
make: *** [vmlinux] Error 1

Quoted 8 lines

The .s file then points to the exact location:

# drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c:140: align_diff = icm_mr->icm_start_addr % align_base;

        pushl   %ebx    # align_base
        pushl   %ecx    # align_base
        call    __umoddi3       #
        popl    %edx    #
        popl    %ecx    #

Since align_base is a power of 2 masking should work as well.

#4 lore raw
In reply to Borislav Petkov
Quoted 20 lines · On Mon, 30 Sep 2019 18:29:10 +0200 Borislav Petkov <[email protected]> wrote:
Quoted 10 lines · Michal Kubecek
Quoted 5 lines · Borislav Petkov

I'm seeing this on i386 allyesconfig builds of current Linus master:

ERROR: "__umoddi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This is usually result of dividing (or modulo) by a 64-bit integer. Can you identify where (file and line number) is the __umoddi3() call generated?

Did another 32-bit allyesconfig build. It said:

ld: drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.o: in function `mlx5dr_icm_alloc_chunk':
dr_icm_pool.c:(.text+0x733): undefined reference to `__umoddi3'
make: *** [vmlinux] Error 1

The .s file then points to the exact location:

Quoted 9 lines

# drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c:140: align_diff = icm_mr->icm_start_addr % align_base;

        pushl   %ebx    # align_base
        pushl   %ecx    # align_base
        call    __umoddi3       #
        popl    %edx    #
        popl    %ecx    #

HTH.

Could also us div_u64_rem here?

#5 lore raw
Quoted 1 line · Stephen Hemminger

Could also us div_u64_rem here?

Yah, the below seems to work and the resulting asm looks sensible to me but someone should definitely double-check me as I don't know this code at all.

Thx.

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +1 -1
index 913f1e5aaaf2..b4302658e5f8 100644
@@ -137,7 +137,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool,
 
 	icm_mr->icm_start_addr = icm_mr->dm.addr;
 
-	align_diff = icm_mr->icm_start_addr % align_base;
+	div_u64_rem(icm_mr->icm_start_addr, align_base, &align_diff);
 	if (align_diff)
 		icm_mr->used_length = align_base - align_diff;
 
Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#6 lore raw
Quoted 15 lines · Borislav Petkov
Quoted 1 line · Stephen Hemminger

Could also us div_u64_rem here?

Yah, the below seems to work and the resulting asm looks sensible to me but someone should definitely double-check me as I don't know this code at all.

Thx.

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +0 -0
index 913f1e5aaaf2..b4302658e5f8 100644

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool, · line 143

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +1 -1
@@ -137,7 +137,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool,
 
 	icm_mr->icm_start_addr = icm_mr->dm.addr;
 
-	align_diff = icm_mr->icm_start_addr % align_base;
+	div_u64_rem(icm_mr->icm_start_addr, align_base, &align_diff);
 	if (align_diff)
 		icm_mr->used_length = align_base - align_diff;
 

While this fixes 32-bit builds, it breaks 64-bit ones as align_diff is 64-bit and div_u64_rem expects pointer to u32. :-(

I checked that align_base is always a power of two so that we could get away with

	align_diff = icm_mr->icm_start_addr & (align_base - 1)

I'm not sure, however, if it's safe to assume align_base will always have to be a power of two or if we should add a check for safety.

(Cc-ing also author of commit 29cf8febd185 ("net/mlx5: DR, ICM pool memory allocator").)

Michal

#7 lore raw
Quoted 40 lines · Michal Kubecek
Quoted 22 lines · Borislav Petkov
Quoted 1 line · Stephen Hemminger

Could also us div_u64_rem here?

Yah, the below seems to work and the resulting asm looks sensible to me
but someone should definitely double-check me as I don't know this code
at all.

Thx.

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c index 913f1e5aaaf2..b4302658e5f8 100644
---
a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
+++
b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c dr_icm_pool_mr_create(struct mlx5dr_icm_pool · line 143

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +1 -1
@@ -137,7 +137,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool
 *pool,
 
 	icm_mr->icm_start_addr = icm_mr->dm.addr;
 
-	align_diff = icm_mr->icm_start_addr % align_base;
+	div_u64_rem(icm_mr->icm_start_addr, align_base, &align_diff);
 	if (align_diff)
 		icm_mr->used_length = align_base - align_diff;

While this fixes 32-bit builds, it breaks 64-bit ones as align_diff is
64-bit and div_u64_rem expects pointer to u32. :-(

I checked that align_base is always a power of two so that we could get
away with

Quoted 8 lines
	align_diff = icm_mr->icm_start_addr & (align_base - 1)

I'm not sure, however, if it's safe to assume align_base will always have to be a power of two or if we should add a check for safety.

(Cc-ing also author of commit 29cf8febd185 ("net/mlx5: DR, ICM pool memory allocator").)

Thanks everyone for your input on this, Alex will take care of this and we will submit a patch ..

Quoted 1 line

Michal

#8 lore raw
Quoted 49 lines · Saeed Mahameed
Quoted 48 lines · Michal Kubecek
Quoted 24 lines · Borislav Petkov
Quoted 1 line · Stephen Hemminger

Could also us div_u64_rem here?

Yah, the below seems to work and the resulting asm looks sensible to me
but someone should definitely double-check me as I don't know this
code
at all.

Thx.

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c index 913f1e5aaaf2..b4302658e5f8 100644
---
a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
+++
b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c dr_icm_pool_mr_create(struct mlx5dr_icm_pool · line 143

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +1 -1
@@ -137,7 +137,7 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool
 *pool,
 
 	icm_mr->icm_start_addr = icm_mr->dm.addr;
 
-	align_diff = icm_mr->icm_start_addr % align_base;
+	div_u64_rem(icm_mr->icm_start_addr, align_base, &align_diff);
 	if (align_diff)
 		icm_mr->used_length = align_base - align_diff;

While this fixes 32-bit builds, it breaks 64-bit ones as align_diff is
64-bit and div_u64_rem expects pointer to u32. :-(

I checked that align_base is always a power of two so that we could get
away with

	align_diff = icm_mr->icm_start_addr & (align_base - 1)

I'm not sure, however, if it's safe to assume align_base will always
have to be a power of two or if we should add a check for safety.

Quoted 8 lines
Quoted 3 lines

(Cc-ing also author of commit 29cf8febd185 ("net/mlx5: DR, ICM pool memory allocator").)

Thanks everyone for your input on this, Alex will take care of this and
we will submit a patch ..

Please disregard, i see this was fixed in
"[net] mlx5: avoid 64-bit division in dr_icm_pool_mr_create()"

Just came back from a long vacation, got a lot of catching up to do :)..