Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1619320 > unrolled thread

Linux next-20170407 failed to build on ARM due to usage of mod in btrfs code

Started byIcenowy Zheng <icenowy@aosc.io>
First post2017-04-08 18:10 +0200
Last post2017-04-10 15:00 +0200
Articles 8 — 5 participants

Back to article view | Back to linux.kernel


Contents

  Linux next-20170407 failed to build on ARM due to usage of mod in  btrfs code Icenowy Zheng <icenowy@aosc.io> - 2017-04-08 18:10 +0200
    Re: Linux next-20170407 failed to build on ARM due to usage of mod in  btrfs code Fabio Estevam <festevam@gmail.com> - 2017-04-08 19:50 +0200
      Re: Linux next-20170407 failed to build on ARM due to usage of mod  in btrfs code Adam Borowski <kilobyte@angband.pl> - 2017-04-08 20:40 +0200
      [PATCH] btrfs: scrub: use do_div() for 64-by-32 division Adam Borowski <kilobyte@angband.pl> - 2017-04-08 23:10 +0200
        Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division Adam Borowski <kilobyte@angband.pl> - 2017-04-09 06:10 +0200
          Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division Adam Borowski <kilobyte@angband.pl> - 2017-04-10 03:20 +0200
        Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division David Sterba <dsterba@suse.cz> - 2017-04-10 13:20 +0200
        Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division "Austin S. Hemmelgarn" <ahferroin7@gmail.com> - 2017-04-10 15:00 +0200

#1619320 — Linux next-20170407 failed to build on ARM due to usage of mod in btrfs code

FromIcenowy Zheng <icenowy@aosc.io>
Date2017-04-08 18:10 +0200
SubjectLinux next-20170407 failed to build on ARM due to usage of mod in btrfs code
Message-ID<tu162-7uL-9@gated-at.bofh.it>
Hello everyone,
Today I tried to build a kernel with btrfs enabled on ARM, then when 
linking I met such an error:

```
fs/built-in.o: In function `scrub_bio_end_io_worker':
acl.c:(.text+0x2f0450): undefined reference to `__aeabi_uldivmod'
fs/built-in.o: In function `scrub_extent_for_parity':
acl.c:(.text+0x2f0bcc): undefined reference to `__aeabi_uldivmod'
fs/built-in.o: In function `scrub_raid56_parity':
acl.c:(.text+0x2f12a8): undefined reference to `__aeabi_uldivmod'
acl.c:(.text+0x2f15c4): undefined reference to `__aeabi_uldivmod'
```

These functions are found at fs/btrfs/scrub.c .

After disabling btrfs the kernel is successfully built.

For this problem, see also [1], which used to be a similar bug in PL330 
driver code.

[1] https://patchwork.kernel.org/patch/5299081/

Thanks,
Icenowy

[toc] | [next] | [standalone]


#1619351

FromFabio Estevam <festevam@gmail.com>
Date2017-04-08 19:50 +0200
Message-ID<tu2EO-8jn-9@gated-at.bofh.it>
In reply to#1619320
On Sat, Apr 8, 2017 at 1:02 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> Hello everyone,
> Today I tried to build a kernel with btrfs enabled on ARM, then when linking
> I met such an error:
>
> ```
> fs/built-in.o: In function `scrub_bio_end_io_worker':
> acl.c:(.text+0x2f0450): undefined reference to `__aeabi_uldivmod'
> fs/built-in.o: In function `scrub_extent_for_parity':
> acl.c:(.text+0x2f0bcc): undefined reference to `__aeabi_uldivmod'
> fs/built-in.o: In function `scrub_raid56_parity':
> acl.c:(.text+0x2f12a8): undefined reference to `__aeabi_uldivmod'
> acl.c:(.text+0x2f15c4): undefined reference to `__aeabi_uldivmod'
> ```
>
> These functions are found at fs/btrfs/scrub.c .
>
> After disabling btrfs the kernel is successfully built.

I see the same error with ARM imx_v6_v7_defconfig + btrfs support.

Looks like it is caused by commit 7d0ef8b4dbbd220 ("Btrfs: update
scrub_parity to use u64 stripe_len").

[toc] | [prev] | [next] | [standalone]


#1619358 — Re: Linux next-20170407 failed to build on ARM due to usage of mod in btrfs code

FromAdam Borowski <kilobyte@angband.pl>
Date2017-04-08 20:40 +0200
SubjectRe: Linux next-20170407 failed to build on ARM due to usage of mod in btrfs code
Message-ID<tu3rb-rJ-1@gated-at.bofh.it>
In reply to#1619351
On Sat, Apr 08, 2017 at 02:45:34PM -0300, Fabio Estevam wrote:
> On Sat, Apr 8, 2017 at 1:02 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> > Hello everyone,
> > Today I tried to build a kernel with btrfs enabled on ARM, then when linking
> > I met such an error:
> >
> > ```
> > fs/built-in.o: In function `scrub_bio_end_io_worker':
> > acl.c:(.text+0x2f0450): undefined reference to `__aeabi_uldivmod'
> > fs/built-in.o: In function `scrub_extent_for_parity':
> > acl.c:(.text+0x2f0bcc): undefined reference to `__aeabi_uldivmod'
> > fs/built-in.o: In function `scrub_raid56_parity':
> > acl.c:(.text+0x2f12a8): undefined reference to `__aeabi_uldivmod'
> > acl.c:(.text+0x2f15c4): undefined reference to `__aeabi_uldivmod'
> > ```
> >
> > These functions are found at fs/btrfs/scrub.c .
> >
> > After disabling btrfs the kernel is successfully built.
> 
> I see the same error with ARM imx_v6_v7_defconfig + btrfs support.
> 
> Looks like it is caused by commit 7d0ef8b4dbbd220 ("Btrfs: update
> scrub_parity to use u64 stripe_len").

+1, my bisect just finished, same bad commit.

-- 
⢀⣴⠾⠻⢶⣦⠀ Meow!
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Collisions shmolisions, let's see them find a collision or second
⠈⠳⣄⠀⠀⠀⠀ preimage for double rot13!

[toc] | [prev] | [next] | [standalone]


#1619386 — [PATCH] btrfs: scrub: use do_div() for 64-by-32 division

FromAdam Borowski <kilobyte@angband.pl>
Date2017-04-08 23:10 +0200
Subject[PATCH] btrfs: scrub: use do_div() for 64-by-32 division
Message-ID<tu5Ml-24v-3@gated-at.bofh.it>
In reply to#1619351
Unbreaks ARM and possibly other 32-bit architectures.

Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
Reported-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
You'd probably want to squash this with Liu's commit, to be nice to future
bisects.

Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
sometimes works, but, like most operations, randomly dies with some badness
that doesn't look related: io_schedule, kunmap_high.  That badness wasn't
there in 4.11-rc5, needs investigating, but since it's not connected to our
issue at hand, I consider this patch sort-of tested.

 fs/btrfs/scrub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index b6fe1cd08048..95372e3679f3 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
 
 	start -= sparity->logic_start;
 	start = div64_u64_rem(start, sparity->stripe_len, &offset);
-	offset /= sectorsize;
+	do_div(offset, sectorsize);
 	nsectors = (int)len / sectorsize;
 
 	if (offset + nsectors <= sparity->nsectors) {
-- 
2.11.0

[toc] | [prev] | [next] | [standalone]


#1619440 — Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division

FromAdam Borowski <kilobyte@angband.pl>
Date2017-04-09 06:10 +0200
SubjectRe: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
Message-ID<tuckN-6mt-5@gated-at.bofh.it>
In reply to#1619386
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.

Turns out those "other 32-bit architectures" happen to include i386.

A modular build:

ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!

With the patch, i386 builds fine.

> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high.  That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.

Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
(non-NX Pentium 4) it hangs very early during boot, way before filesystem
modules would be loaded.  Qemu boots but has random hangs.

So it looks like it's compile only for now...

-- 
⢀⣴⠾⠻⢶⣦⠀ Meow!
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Collisions shmolisions, let's see them find a collision or second
⠈⠳⣄⠀⠀⠀⠀ preimage for double rot13!

[toc] | [prev] | [next] | [standalone]


#1619584 — Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division

FromAdam Borowski <kilobyte@angband.pl>
Date2017-04-10 03:20 +0200
SubjectRe: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
Message-ID<tuw9P-2ht-3@gated-at.bofh.it>
In reply to#1619440

[Multipart message — attachments visible in raw view] — view raw

On Sun, Apr 09, 2017 at 05:58:54AM +0200, Adam Borowski wrote:
> On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> > Unbreaks ARM and possibly other 32-bit architectures.
> 
> Turns out those "other 32-bit architectures" happen to include i386.
> 
> A modular build:
> ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
> With the patch, i386 builds fine.
> 
> > Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> > sometimes works, but, like most operations, randomly dies with some badness
> > that doesn't look related: io_schedule, kunmap_high.  That badness wasn't
> > there in 4.11-rc5, needs investigating, but since it's not connected to our
> > issue at hand, I consider this patch sort-of tested.
> 
> Looks like current -next is pretty broken: while amd64 is ok, on an i386 box
> (non-NX Pentium 4) it hangs very early during boot, way before filesystem
> modules would be loaded.  Qemu boots but has random hangs.

A non-modular i386_defconfig + btrfs of -next is ok; whatever the problem
is, it's not relevant to our division build failure in scrub.

But, it looks like parity scrub is ${EXPLETIVE}ed on 32-bit.  Not just on
-next, also on 4.11-rc5 and 4.9.  Test script I used is attached, although
it's enough to just scrub a kosher filesystem without even damaging it.
On 64-bit it mostly works, but still warns about bogus unrecoverable errors
when in fact it succeeded.

Thus, I'd recommend:
* applying this patch to at least make it compile
* taking steps to warn outside people about RAID5/6

Let's discuss the rest in another thread, it's no longer interesting to ARM
people, they just want no build failures.

-- 
⢀⣴⠾⠻⢶⣦⠀ Meow!
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Collisions shmolisions, let's see them find a collision or second
⠈⠳⣄⠀⠀⠀⠀ preimage for double rot13!

[toc] | [prev] | [next] | [standalone]


#1619822 — Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division

FromDavid Sterba <dsterba@suse.cz>
Date2017-04-10 13:20 +0200
SubjectRe: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
Message-ID<tuFwt-8nU-15@gated-at.bofh.it>
In reply to#1619386
On Sat, Apr 08, 2017 at 11:07:37PM +0200, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
> 
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.

Thanks for finding it!

> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high.  That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
> 
>  fs/btrfs/scrub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>  
>  	start -= sparity->logic_start;
>  	start = div64_u64_rem(start, sparity->stripe_len, &offset);
> -	offset /= sectorsize;
> +	do_div(offset, sectorsize);

I'll use the div_u64 helper instead, I don't want to reintroduce do_div
to fs/btrfs , for-next will be updated in a minute.

[toc] | [prev] | [next] | [standalone]


#1619885 — Re: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division

From"Austin S. Hemmelgarn" <ahferroin7@gmail.com>
Date2017-04-10 15:00 +0200
SubjectRe: [PATCH] btrfs: scrub: use do_div() for 64-by-32 division
Message-ID<tuH5g-M6-9@gated-at.bofh.it>
In reply to#1619386
On 2017-04-08 17:07, Adam Borowski wrote:
> Unbreaks ARM and possibly other 32-bit architectures.
>
> Fixes: 7d0ef8b4d: Btrfs: update scrub_parity to use u64 stripe_len
> Reported-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
> You'd probably want to squash this with Liu's commit, to be nice to future
> bisects.
>
> Tested on amd64 where all is fine, and on arm (Odroid-U2) where scrub
> sometimes works, but, like most operations, randomly dies with some badness
> that doesn't look related: io_schedule, kunmap_high.  That badness wasn't
> there in 4.11-rc5, needs investigating, but since it's not connected to our
> issue at hand, I consider this patch sort-of tested.
>
>  fs/btrfs/scrub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6fe1cd08048..95372e3679f3 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2407,7 +2407,7 @@ static inline void __scrub_mark_bitmap(struct scrub_parity *sparity,
>
>  	start -= sparity->logic_start;
>  	start = div64_u64_rem(start, sparity->stripe_len, &offset);
> -	offset /= sectorsize;
> +	do_div(offset, sectorsize);
>  	nsectors = (int)len / sectorsize;
>
>  	if (offset + nsectors <= sparity->nsectors) {
>
Also fixes things on:
32-bit MIPS (eb and el variants)
32-bit SPARC
32-bit PPC

You can add my Tested-by if you want.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web