ubifs: Fix regression in ubifs_readdir()
Richard Weinberger
maintainerPATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Commit c83ed4c9dbb35 ("ubifs: Abort readdir upon error") broke overlayfs support because the fix exposed an internal error code to VFS.
--- fs/ubifs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ubifs/dir.c +8 -0
@@ -543,6 +543,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)if (err != -ENOENT )ubifs_err (c,"cannot find next direntry, error %d" , err); +else +/* +* -ENOENT is a non-fatal error in this context, the TNC uses +* it to indicate that the cursor moved past the current directory +* and readdir() has to stop. +*/ + err =0 ; +/* 2 is a special value indicating that there are no more direntries */ ctx->pos =2 ;
Signature · 1 line
2.7.3
Hi,
Quoted 34 lines · Richard Weinberger
Commit
c83ed4c9dbb35("ubifs: Abort readdir upon error") broke overlayfs support because the fix exposed an internal error code to VFS.Reported-by Peter Rosin <[email protected]>Tested-by Peter Rosin <[email protected]>Reported-by Ralph Sennhauser <[email protected]>Fixes c83ed4c9dbb35 ("ubifs: Abort readdir upon error")Signed-off-by Richard Weinberger <[email protected]>---
fs/ubifs/dir.c | 8 ++++++++1 file changed, 8 insertions(+)fs/ubifs/dir.c +0
-0@@ -543,6 +543,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
if (err !=-ENOENT)
ubifs_err(c, "cannot find next direntry, error %d", err);fs/ubifs/dir.c +3
-0+else +/* +* -ENOENT is a non-fatal error in this context, the TNC uses
fs/ubifs/dir.c +1
-0+ * it to indicate that the cursor moved past thecurrent directory
fs/ubifs/dir.c +4
-0+* and readdir() has to stop. +*/ + err =0 ; +
Quoted 4 lines
/* 2 is a special value indicating that there are no more direntries */
ctx->pos= 2;
I'm not sure if it's related to the issue reported by Peter Rosin and Ralph Sennhauser, but I am still getting a kernel panic using UBIFS with OverlayFS on Linux v4.9.0-rc2 with this patch applied:
"""
[ 2.709197] ubi0: default fastmap pool size: 15
[ 2.713806] ubi0: default fastmap WL pool size: 7
[ 2.718776] ubi0: attaching mtd5
[ 3.690342] ubi0: scanning is finished
[ 3.726232] ubi0 warning: ubi_eba_init: cannot reserve enough PEBs for bad PEB handling, reserved 18, need 20
[ 3.756003] ubi0: attached mtd5 (name "ubi-0", size 44 MiB) [ 3.761658] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 3.768857] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 3.775860] ubi0: VID header offset: 2048 (aligned 2048), data
offset: 4096
[ 3.782886] ubi0: good PEBs: 352, bad PEBs: 0, corrupted PEBs: 0 [ 3.789080] ubi0: user volume: 1, internal volumes: 1, max. volumes
count: 128
[ 3.796501] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 955660178
[ 3.805742] ubi0: available PEBs: 0, total reserved PEBs: 352, PEBs reserved for bad PEB handling: 18
[ 3.815502] ubi0: background thread "ubi_bgt0d" started, PID 40 [ 3.822173] ubi1: default fastmap pool size: 10
[ 3.827213] ubi1: default fastmap WL pool size: 5
[ 3.832016] ubi1: attaching mtd7
[ 4.278806] ubi1: scanning is finished
[ 4.376526] ubi1: volume 0 ("user") re-sized from 13 to 162 LEBs [ 4.391959] ubi1: attached mtd7 (name "data", size 36 MiB) [ 4.397813] ubi1: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 4.404761] ubi1: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 4.411752] ubi1: VID header offset: 2048 (aligned 2048), data
offset: 4096
[ 4.418909] ubi1: good PEBs: 288, bad PEBs: 0, corrupted PEBs: 0 [ 4.425107] ubi1: user volume: 2, internal volumes: 1, max. volumes
count: 128
[ 4.432399] ubi1: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1961582752
[ 4.441714] ubi1: available PEBs: 0, total reserved PEBs: 288, PEBs reserved for bad PEB handling: 20
[ 4.451267] ubi1: background thread "ubi_bgt1d" started, PID 41 [ 4.469335] input: gpio-keys as /devices/soc0/gpio-keys/input/input0 [ 4.492732] stmp3xxx-rtc 80056000.rtc: setting system clock to 1970- 01-01 00:01:07 UTC (67)
[ 4.506810] ALSA device list:
[ 4.509854] #0: mxs_wm8524
[ 4.523140] uart-pl011 80074000.serial: no DMA platform data [ 4.909981] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs", R/O mode
[ 4.919428] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 4.933097] UBIFS (ubi0:1): FS size: 40378368 bytes (38 MiB, 318 LEBs), journal size 5586944 bytes (5 MiB, 44 LEBs)
[ 4.944659] UBIFS (ubi0:1): reserved for root: 0 bytes (0 KiB) [ 4.954275] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 3F29D9B8-363D-4A54-8CE4-BF6969BB9687, small LPT model
[ 4.993543] VFS: Mounted root (ubifs filesystem) readonly on device 0:13.
[ 5.023313] devtmpfs: mounted
[ 5.036855] Freeing unused kernel memory: 144K (c0506000 - c052a000) [ 5.043278] This architecture does not have kernel memory protection.
[ 5.869112] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 43
[ 6.056630] UBIFS (ubi1:0): start fixing up free space
[ 6.162648] UBIFS (ubi1:0): free space fixup complete
[ 6.263554] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "user"
[ 6.271600] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 6.285552] UBIFS (ubi1:0): FS size: 19300352 bytes (18 MiB, 152 LEBs), journal size 3047424 bytes (2 MiB, 24 LEBs)
[ 6.296731] UBIFS (ubi1:0): reserved for root: 0 bytes (0 KiB) [ 6.306432] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID A5813F13-6645-4096-B663-A08D87959541, small LPT model
[ 6.542487] random: crng init done
mount: mounting overlay on /mnt/overlay failed: No such file or directory
mount: mounting /dev on /mnt/overlay/dev failed: No such file or directory
mount: mounting /mnt/user on /mnt/overlay/mnt/user failed: No such file or directory
chroot: can't execute '/sbin/init': No such file or directory [ 6.670206] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[ 6.670206]
[ 6.679426] CPU: 0 PID: 1 Comm: chroot Not tainted 4.9.0-rc2-LINTECH #1
[ 6.686075] Hardware name: Freescale MXS (Device Tree)
[ 6.691320] [<c000f150>] (unwind_backtrace) from [<c000d318>] (show_stack+0x10/0x14)
[ 6.699143] [<c000d318>] (show_stack) from [<c0092338>] (panic+0xb4/0x23c)
[ 6.706098] [<c0092338>] (panic) from [<c00183dc>] (do_exit+0x450/0x84c)
[ 6.712866] [<c00183dc>] (do_exit) from [<c0019ecc>] (do_group_exit+0xb8/0xbc)
[ 6.720150] [<c0019ecc>] (do_group_exit) from [<c0019ee0>] (SyS_exit_group+0x10/0x14)
[ 6.728037] [<c0019ee0>] (SyS_exit_group) from [<c000a160>] (ret_fast_syscall+0x0/0x1c)
[ 6.736155] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
"""
This is my preinit script:
"""
#!/bin/sh
mount -t ubifs /dev/ubi1_0 /mnt/user
mkdir -p /mnt/user/overlay
mkdir -p /mnt/user/work
# Overlay read-only rootfs and read-write user filesystem. mount -t overlay overlay -o lowerdir=/,upperdir=/mnt/user/overlay,workdir=/mnt/user/work,noatime /mnt/overlay
# Move necessary mount points
mount -n --move /dev /mnt/overlay/dev
mount -n --move /mnt/user /mnt/overlay/mnt/user
exec chroot /mnt/overlay /sbin/init
"""
Note, this is working on Linux 4.7.
Best regards
Jörg Krause
Richard Weinberger
maintainerJörg,
Quoted 38 lines · Jörg Krause
Hi,
Quoted 35 lines · Richard Weinberger
Commit
c83ed4c9dbb35("ubifs: Abort readdir upon error") broke overlayfs support because the fix exposed an internal error code to VFS.Reported-by Peter Rosin <[email protected]>Tested-by Peter Rosin <[email protected]>Reported-by Ralph Sennhauser <[email protected]>Fixes c83ed4c9dbb35 ("ubifs: Abort readdir upon error")Signed-off-by Richard Weinberger <[email protected]>--- fs/ubifs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+)fs/ubifs/dir.c +3
-0@@ -543,6 +543,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)if (err != -ENOENT )ubifs_err (c,"cannot find next direntry, error %d" , err); +else +/* +* -ENOENT is a non-fatal error in this context, the TNC uses
fs/ubifs/dir.c +1
-0+* it to indicate that the cursor moved past the current directory
fs/ubifs/dir.c +4
-0+* and readdir() has to stop. +*/ + err =0 ; +
Quoted 7 lines
Quoted 3 lines
/* 2 is a special value indicating that there are no more
direntries */
ctx->pos= 2;I'm not sure if it's related to the issue reported by Peter Rosin and Ralph Sennhauser, but I am still getting a kernel panic using UBIFS with OverlayFS on Linux v4.9.0-rc2 with this patch applied:
Does reverting c83ed4c9dbb35 help?
And are you 100% sure you applied the fix?
Does the following WARN_ON() trigger?
fs/ubifs/dir.c +3 -0
@@ -554,6 +554,9 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)/* 2 is a special value indicating that there are no more direntries */ ctx->pos =2 ; + +WARN_ON (err); +return err; }
Thanks,
//richard
Richard,
Quoted 53 lines · Richard Weinberger
Jörg,
Quoted 41 lines · Jörg Krause
Hi,
Quoted 38 lines · Richard Weinberger
Commit
c83ed4c9dbb35("ubifs: Abort readdir upon error") broke overlayfs support because the fix exposed an internal error code to VFS.Reported-by Peter Rosin <[email protected]>Tested-by Peter Rosin <[email protected]>Reported-by Ralph Sennhauser <[email protected]>Fixes c83ed4c9dbb35 ("ubifs: Abort readdir upon error")Signed-off-by Richard Weinberger <[email protected]>---
fs/ubifs/dir.c | 8 ++++++++1 file changed, 8 insertions(+)fs/ubifs/dir.c +0
-0@@ -543,6 +543,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
if (err !=-ENOENT)
ubifs_err(c, "cannot find next direntry, error %d",
err);fs/ubifs/dir.c +3
-0+else +/* +* -ENOENT is a non-fatal error in this context, the
TNC usesfs/ubifs/dir.c +1
-0+ * it to indicate that the cursor moved past thecurrent directory
fs/ubifs/dir.c +4
-0+* and readdir() has to stop. +*/ + err =0 ; +
/* 2 is a special value indicating that there are noQuoted 8 lines
Quoted 3 lines
more
direntries */
ctx->pos= 2;I'm not sure if it's related to the issue reported by Peter Rosin and
Ralph Sennhauser, but I am still getting a kernel panic using UBIFS with OverlayFS on Linux v4.9.0-rc2 with this patch applied:
Quoted 2 lines
Does reverting
c83ed4c9dbb35help?
And are you 100% sure you applied the fix?
I double double checked. The fix was applied on the git tree, but the compiler cache (I am using Buildroot with this option enabled) fooled me by using an old copy. After disabling the compiler cache I got a fixed build of the kernel. The panic is gone! Thanks!
Quoted 15 lines
Does the following
WARN_ON()trigger?fs/ubifs/dir.c +0
-0@@ -554,6 +554,9 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) /* 2 is a special value indicating that there are no moredirentries */
ctx->pos= 2;fs/ubifs/dir.c +3
-0+ +WARN_ON (err); +
Quoted 2 lines
return err;
}
Best regards,
Jörg Krause
Richard Weinberger
maintainerQuoted 7 lines · Jörg Krause
Quoted 2 lines
Does reverting
c83ed4c9dbb35help?
And are you 100% sure you applied the fix?I double double checked. The fix was applied on the git tree, but the compiler cache (I am using Buildroot with this option enabled) fooled me by using an old copy. After disabling the compiler cache I got a fixed build of the kernel. The panic is gone! Thanks!
Thanks for letting me know.
Let's get this fix into -rc3 then. :-)
Thanks,
//richard
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
In reply to Jörg KrauseHello J?rg,
[E-mail thread hijacked from the linux-mtd mailing list, since there is a Buildroot related problem reported.]
Quoted 5 lines · J?rg Krause
Quoted 5 lines
Quoted 4 lines
I'm not sure if it's related to the issue reported by Peter Rosin and
Ralph Sennhauser, but I am still getting a kernel panic using UBIFS with OverlayFS on Linux v4.9.0-rc2 with this patch applied:
Quoted 7 lines
Quoted 2 lines
Does reverting
c83ed4c9dbb35help?
And are you 100% sure you applied the fix?I double double checked. The fix was applied on the git tree, but the compiler cache (I am using Buildroot with this option enabled) fooled me by using an old copy. After disabling the compiler cache I got a fixed build of the kernel. The panic is gone! Thanks!
This is *really* bad. Which Buildroot version are you using? Are you able to reproduce the bad ccache behavior here? A modified source code should definitely lead to a different hash of the preprocessed code, and therefore there shouldn't be such a confusion between two cache results.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 18 lines · Thomas Petazzoni
Hello J?rg,
[E-mail thread hijacked from the linux-mtd mailing list, since there is
a Buildroot related problem reported.]Quoted 10 lines · J?rg Krause
Quoted 9 lines
Quoted 6 lines
I'm not sure if it's related to the issue reported by Peter Rosin
and
Ralph Sennhauser, but I am still getting a kernel panic using UBIFS
with OverlayFS on Linux v4.9.0-rc2 with this patch applied:??Does reverting
c83ed4c9dbb35help?
And are you 100% sure you applied the fix???
Quoted 8 lines
Quoted 6 lines
I double double checked. The fix was applied on the git tree, but the
compiler cache (I am using Buildroot with this option enabled) fooled
me by using an old copy. After disabling the compiler cache I got a fixed build of the kernel. The panic is gone! Thanks!This is *really* bad. Which Buildroot version are you using?
2016.11 #
Note that I am using Buildroot as a submodule [1] and I needed to port the br2-external tree. Maybe I messed something up?
Quoted 1 line
Are you able to reproduce the bad ccache behavior here?
Yes, I am. Linux kernel source directory is located locally and the path is set using LINUX_OVERRIDE_SRCDIR in local.mk.
1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.10
4/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10
Quoted 3 lines
A modified source code should definitely lead to a different hash of the preprocessed code, and therefore there shouldn't be such a confusion between two cache results.
I checked the Linux source files in output/build/linux-custom/ and they are correct - after step 2 the directory contains the Linux sources of version 4.7.10 and after step 5 it contains version 4.8.5.
[1] https://github.com/Openwide-Ingenierie/buildroot-submodule
Best regards,
J?rg Krause
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Hello,
Quoted 12 lines · J?rg Krause
Quoted 1 line
This is *really* bad. Which Buildroot version are you using?
2016.11 #
Note that I am using Buildroot as a submodule [1] and I needed to port the br2-external tree. Maybe I messed something up?
Quoted 1 line
Are you able to reproduce the bad ccache behavior here?
Yes, I am. Linux kernel source directory is located locally and the path is set using
LINUX_OVERRIDE_SRCDIRin local.mk.
Quoted 7 lines
1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.104/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10
And this scenario works fine with ccache *disabled*, but breaks when you enable ccache support in Buildroot?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 21 lines · Thomas Petazzoni
Hello,
Quoted 17 lines · J?rg Krause
Quoted 1 line
This is *really* bad. Which Buildroot version are you using???
2016.11 #
Note that I am using Buildroot as a submodule [1] and I needed to port
the br2-external tree. Maybe I messed something up?Quoted 1 line
Are you able to reproduce the bad ccache behavior here???
Yes, I am. Linux kernel source directory is located locally and the path is set using
LINUX_OVERRIDE_SRCDIRin local.mk.1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.10
Quoted 6 lines
Quoted 3 lines
4/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10And this scenario works fine with ccache *disabled*, but breaks when you enable ccache support in Buildroot?
Yes.
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 22 lines · J?rg Krause
Quoted 21 lines · Thomas Petazzoni
Hello,
Quoted 17 lines · J?rg Krause
Quoted 1 line
This is *really* bad. Which Buildroot version are you using?
2016.11 #
Note that I am using Buildroot as a submodule [1] and I needed to port
the br2-external tree. Maybe I messed something up?Quoted 1 line
Are you able to reproduce the bad ccache behavior here?
Yes, I am. Linux kernel source directory is located locally and the path is set using
LINUX_OVERRIDE_SRCDIRin local.mk.1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.10
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
4/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10And this scenario works fine with ccache *disabled*, but breaks when you enable ccache support in Buildroot?
Yes.
I can't reproduce this. I've got a nice mix of cache misses and cache hits when
building a different version, and version.o is definitely a cache miss.
Can you double-check the version in output/build/linux-custom/init/version.o?
And the one in output/build/linux-custom/include/generated/utsrelease.h?
Hm, hang on, is there maybe a utsrelease.h that ends up in your staging dir and
that is used by ccache?
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 37 lines · Arnout Vandecappelle
Quoted 29 lines · J?rg Krause
Quoted 28 lines · Thomas Petazzoni
Hello,
Quoted 23 lines · J?rg Krause
Quoted 2 lines
This is *really* bad. Which Buildroot version are you using???
2016.11 #
Note that I am using Buildroot as a submodule [1] and I needed to
port
the br2-external tree. Maybe I messed something up?Quoted 1 line
Are you able to reproduce the bad ccache behavior here???
Yes, I am. Linux kernel source directory is located locally and the
path is set usingLINUX_OVERRIDE_SRCDIRin local.mk.1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.104/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10Quoted 5 lines
Quoted 3 lines
And this scenario works fine with ccache *disabled*, but breaks when
you enable ccache support in Buildroot?Yes.
Quoted 7 lines
?I can't reproduce this. I've got a nice mix of cache misses and cache hits when
building a different version, and version.o is definitely a cache miss.?Can you double-check the version in output/build/linux-
custom/init/version.o?
I checked the version string in version.o with hexdump -C and they differ.
Quoted 2 lines
And the one in output/build/linux-
custom/include/generated/utsrelease.h?
This as well.
Quoted 2 lines
?Hm, hang on, is there maybe a
utsrelease.hthat ends up in your staging dir and that is used by ccache?
No, there is only the linux generated file.
---
I am not experienced with ccache, but I got some statistics:
I cleared the cache by removing ~/.buildroot-ccache, than run make linux-dirclean linux:
cache hit (direct)?????????????????????0
cache hit (preprocessed)???????????????0
cache miss??????????????????????????1088
cache hit rate??????????????????????0.00 %
called for link???????????????????????10
called for preprocessing???????????????5
no input file????????????????????????394
cleanups performed?????????????????????0
files in cache??????????????????????3250
Then I re-run make linux-dirclean linux (without altering the linux sources):
cache hit (direct)??????????????????1076
cache hit (preprocessed)??????????????10
cache miss??????????????????????????1090
cache hit rate?????????????????????49.91 %
called for link???????????????????????20
called for preprocessing??????????????10
no input file????????????????????????788
cleanups performed?????????????????????0
files in cache??????????????????????3264
Again, clear the cache and run make linux-dirclean linux, but alter the linux sources by checking out a different branch:
cache hit (direct)????????????????????10
cache hit (preprocessed)??????????????62
cache miss??????????????????????????2102
cache hit rate??????????????????????3.31 %
called for link???????????????????????20
called for preprocessing??????????????10
no input file????????????????????????773
cleanups performed?????????????????????0
files in cache??????????????????????6386
---
Furthermore, I did the following for the different linux builds:
After building branch-4.7.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.7.10
After building branch-4.8.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.8.5
Afterwards, diff shows no differences:
# diff zImage-4.7.10 zImage-4.8.5
Best regards,
J?rg Krause
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 3 lines · J?rg Krause
Quoted 2 lines · Arnout Vandecappelle
On 02-11-16 23:49, J?rg Krause wrote:
[snip]
Quoted 23 lines
Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Yes, I am. Linux kernel source directory is located locally and the
path is set usingLINUX_OVERRIDE_SRCDIRin local.mk.1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.104/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10Quoted 5 lines
Quoted 3 lines
And this scenario works fine with ccache *disabled*, but breaks when
you enable ccache support in Buildroot?Yes.
I can't reproduce this. I've got a nice mix of cache misses and
cache hits when
building a different version, and version.o is definitely a cache miss.
Quoted 5 lines
Quoted 2 lines
Can you double-check the version in output/build/linux-
custom/init/version.o?I checked the version string in version.o with hexdump -C and they differ.
And the version that is in there is correct, right? (Use strings to get it, the
first string it finds should be the version string as in uname -a).
This is very weird, because version.o gets linked into the vmlinux.elf and
eventually the zImage, and ccache doesn't get activated anymore in that path because it's all linking and no compiling...
Quoted 41 lines
Quoted 3 lines
And the one in output/build/linux-
custom/include/generated/utsrelease.h?This as well.
Quoted 2 lines
Hm, hang on, is there maybe a
utsrelease.hthat ends up in your
staging dir and that is used by ccache?No, there is only the linux generated file.
---
I am not experienced with ccache, but I got some statistics:
I cleared the cache by removing ~/.buildroot-ccache, than run
make linux-dirclean linux:cache hit (direct) 0
cache hit (preprocessed) 0
cache miss 1088
cache hit rate 0.00 %
called for link 10
called for preprocessing 5
no input file 394
cleanups performed 0
files in cache 3250Then I re-run
make linux-dirclean linux(without altering the linux sources):cache hit (direct) 1076
cache hit (preprocessed) 10
cache miss 1090
cache hit rate 49.91 %
called for link 20
called for preprocessing 10
no input file 788
cleanups performed 0
files in cache 3264
Quoted 4 lines
Again, clear the cache and run
make linux-dirclean linux, but alter the linux sources by checking out a different branch:cache hit (direct) 10
This is weird, it shouldn't go down... Did you clear the cache or the
statistics somewhere in between?
Quoted 13 lines
cache hit (preprocessed) 62
cache miss 2102
cache hit rate 3.31 %
called for link 20
called for preprocessing 10
no input file 773
cleanups performed 0
files in cache 6386---
Furthermore, I did the following for the different linux builds:
Quoted 8 lines
After building branch-4.7.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.7.10After building branch-4.8.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.8.5Afterwards, diff shows no differences:
# diff zImage-4.7.10 zImage-4.8.5
Since version.o differs, it means the version.o doesn't end up in the zImage...
Again, can you check for the intermediate files what happens to them? E.g. init/built-in.o, .tmp_vmlinux1, arch/arm/boot/Image. Maybe just do "mv output/build/linux-custom output/build/linux-custom.orig" before rebuilding and do a full tree compare to find which files are identical.
Regards,
Arnout
Quoted 4 lines
Best regards,
J?rg Krause
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
Quoted 94 lines · Arnout Vandecappelle
Quoted 3 lines · J?rg Krause
Quoted 2 lines · Arnout Vandecappelle
On 02-11-16 23:49, J?rg Krause wrote:
[snip]
Quoted 25 lines
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Yes, I am. Linux kernel source directory is located locally and
the
path is set usingLINUX_OVERRIDE_SRCDIRin local.mk.1/ Checkout Linux kernel version 4.7.10
2/ make linux-dirclean all
3/ Booted Linux version is 4.7.104/ Checkout Linux kernel version 4.8.5
5/ make linux-dirclean all
6/ Booted Linux version is still 4.7.10Quoted 6 lines
Quoted 4 lines
And this scenario works fine with ccache *disabled*, but breaks
when
you enable ccache support in Buildroot?Yes.
?I can't reproduce this. I've got a nice mix of cache misses and cache hits when
building a different version, and version.o is definitely a cache miss.Quoted 5 lines
Quoted 2 lines
?Can you double-check the version in output/build/linux-
custom/init/version.o?I checked the version string in version.o with hexdump -C and they differ.
?And the version that is in there is correct, right? (Use strings to get it, the
first string it finds should be the version string as in uname -a).?This is very weird, because version.o gets linked into the vmlinux.elf and
eventually the zImage, and ccache doesn't get activated anymore in that path
because it's all linking and no compiling...Quoted 46 lines
Quoted 3 lines
And the one in output/build/linux-
custom/include/generated/utsrelease.h?This as well.
Quoted 2 lines
?Hm, hang on, is there maybe a
utsrelease.hthat ends up in your staging dir and that is used by ccache?No, there is only the linux generated file.
---
I am not experienced with ccache, but I got some statistics:
I cleared the cache by removing ~/.buildroot-ccache, than run
make linux-dirclean linux:cache hit (direct)?????????????????????0
cache hit (preprocessed)???????????????0
cache miss??????????????????????????1088
cache hit rate??????????????????????0.00 %
called for link???????????????????????10
called for preprocessing???????????????5
no input file????????????????????????394
cleanups performed?????????????????????0
files in cache??????????????????????3250Then I re-run
make linux-dirclean linux(without altering the linux
sources):cache hit (direct)??????????????????1076
cache hit (preprocessed)??????????????10
cache miss??????????????????????????1090
cache hit rate?????????????????????49.91 %
called for link???????????????????????20
called for preprocessing??????????????10
no input file????????????????????????788
cleanups performed?????????????????????0
files in cache??????????????????????3264Again, clear the cache and run
make linux-dirclean linux, but alter
the linux sources by checking out a different branch:
Quoted 5 lines
Quoted 1 line
cache hit (direct)????????????????????10
?This is weird, it shouldn't go down... Did you clear the cache or the
statistics somewhere in between?
Yes. Maybe you missed it, but I wrote "Again, clear the cache...".
Quoted 22 lines
Quoted 13 lines
cache hit (preprocessed)??????????????62
cache miss??????????????????????????2102
cache hit rate??????????????????????3.31 %
called for link???????????????????????20
called for preprocessing??????????????10
no input file????????????????????????773
cleanups performed?????????????????????0
files in cache??????????????????????6386---
Furthermore, I did the following for the different linux builds:
Quoted 8 lines
After building branch-4.7.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.7.10After building branch-4.8.y:
# cp output/build/linux-custom/arch/arm/boot/zImage zImage-4.8.5Afterwards, diff shows no differences:
# diff zImage-4.7.10 zImage-4.8.5
Quoted 9 lines
?Since version.o differs, it means the version.o doesn't end up in the zImage...
Again, can you check for the intermediate files what happens to them? E.g.init/built-in.o, .tmp_vmlinux1,arch/arm/boot/Image. Maybe just do "mv
output/build/linux-custom output/build/linux-custom.orig" before rebuilding and
do a full tree compare to find which files are identical.
I did the following:
1/ checkout linux-4.8 branch
2/ make linux-dirclean linux
3/ move output/build/linux-custom to output/build/linux-custom.orig 4/ checkout linux-4.7 branch
5/ make linux-dirclean linux
6/ diff:
# diff output/build/linux-custom/arch/arm/boot/Image output/build/linux-custom.orig/arch/arm/boot/Image Binary files output/build/linux-custom/arch/arm/boot/Image and output/build/linux-custom.orig/arch/arm/boot/Image differ # diff output/build/linux-custom/arch/arm/boot/zImage output/build/linux-custom.orig/arch/arm/boot/zImage
Weird, the Image binaries differ, but the zImage don't. The zImage in output/build/linux-custom/arch/arm/boot/ is exactly the same as in output/build/linux-custom.orig/arch/arm/boot/
J?rg
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
On Mon, 2016-11-07 at 23:08 +0100, J?rg Krause wrote:
[snip]
Quoted 28 lines
Quoted 11 lines
?Since version.o differs, it means the version.o doesn't end up in the zImage...
Again, can you check for the intermediate files what happens to them?
E.g.init/built-in.o, .tmp_vmlinux1,arch/arm/boot/Image. Maybe just do "mv
output/build/linux-custom output/build/linux-custom.orig" before rebuilding and
do a full tree compare to find which files are identical.I did the following:
1/ checkout linux-4.8 branch
2/ make linux-dirclean linux
3/ move output/build/linux-custom to output/build/linux-custom.orig 4/ checkout linux-4.7 branch
5/ make linux-dirclean linux
6/ diff:# diff output/build/linux-custom/arch/arm/boot/Image output/build/linux-custom.orig/arch/arm/boot/Image Binary files output/build/linux-custom/arch/arm/boot/Image and output/build/linux-custom.orig/arch/arm/boot/Image differ # diff output/build/linux-custom/arch/arm/boot/zImage output/build/linux-custom.orig/arch/arm/boot/zImage
Quoted 3 lines
Weird, the Image binaries differ, but the zImage don't. The zImage in output/build/linux-custom/arch/arm/boot/ is exactly the same as in output/build/linux-custom.orig/arch/arm/boot/
After running the above steps I did the following:
7/ disable compiler cache option in Buildroot
8/ make linux-dirclean linux
9/ diff:
diff output/build/linux-custom/arch/arm/boot/zImage output/build/linux- custom.orig/arch/arm/boot/zImage
Binary files hbm10/output/build/linux-custom/arch/arm/boot/zImage and hbm10/output/build/linux-custom.orig/arch/arm/boot/zImage differ
10/ re-enable compiler cache in Buildroot
11/ Binary files hbm10/output/build/linux-custom/arch/arm/boot/zImage and hbm10/output/build/linux-custom.orig/arch/arm/boot/zImage differ 12/ diff:
diff output/build/linux-custom/arch/arm/boot/zImage output/build/linux- custom.orig/arch/arm/boot/zImage
(No message)
No idea!
J?rg
PATCH 1/1 ubifs: Fix regression in ubifs_readdir()
In reply to Arnout VandecappelleQuoted 5 lines · Arnout Vandecappelle
Quoted 3 lines · J?rg Krause
Quoted 2 lines · Arnout Vandecappelle
On 02-11-16 23:49, J?rg Krause wrote:
[snip]
Quoted 9 lines
?Since version.o differs, it means the version.o doesn't end up in the zImage...
Again, can you check for the intermediate files what happens to them? E.g.init/built-in.o, .tmp_vmlinux1,arch/arm/boot/Image. Maybe just do "mv
output/build/linux-custom output/build/linux-custom.orig" before rebuilding and
do a full tree compare to find which files are identical.
Got it! ccache <3.3.3 is affected by bug concerning rebuilding the kernel [1].
So, I guess we should update ccache.
[1] https://github.com/ccache/ccache/issues/136
Many thanks for your help!