diff mbox series

[OpenWrt-Devel] ramips: mt7621: limit dictionary size for DIR-860L due to kernel 5.4

Message ID 20200416153146.4377-1-szab.hu@gmail.com
State Superseded, archived
Headers show
Series [OpenWrt-Devel] ramips: mt7621: limit dictionary size for DIR-860L due to kernel 5.4 | expand

Commit Message

Szabolcs Hubai April 16, 2020, 3:31 p.m. UTC
Snapshot images for DIR-860L after the initial kernel 5.4 landing
(on Apr 4, 2020 commits from b51ea43f9001 to 4d979a4d1969)
are broken: they causes "LZMA ERROR 1 - must RESET board to recover"

Snapshot factory image serial log:
----
Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.

You choosed 3

0

3: System Boot system code via Flash.
addr:80500000
We have SEAMA, Image Size = 2424768
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover
----

The local defconfig build works, also the snapshot initramfs images.

The bug can be reproduced with the "CONFIG_ALL_KMODS=y" configuration.

As this "LZMA ERROR 1" isn't new (e.g. 77e2bccde8f7),
I tried to adjust the lzma dictionary parameter:
- with "-d20" and above it causes "LZMA ERROR 1"
- with "-d19" it boots but doesn't find the device tree (see below)
- with "-d18" it boots fine

Serial log with "-d19" lzma dictionary:
----
Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
0

3: System Boot system code via Flash.
addr:80500000
We have SEAMA, Image Size = 4915140
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... OK

Starting kernel ...

[    0.000000] Linux version 5.4.32 (xabolcs@ut1804) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r12974-75f19deb3a)) #0 SMP Wed Apr 15 02:14:19 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] OF: fdt: No valid device tree found, continuing without
[    0.000000] percpu: Embedded 14 pages/cpu s26704 r8192 d22448 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line:   rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=0004050c
[    0.000000] Readback ErrCtl register=0004050c
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 120752K/131072K available (5826K kernel code, 206K rwdata, 1252K rodata, 1280K init, 237K bss, 10320K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:2998 rcu_init+0x55c/0x774
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.32 #0
[    0.000000] Stack : 00000000 800774cc 806b0000 806b6474 80720000 806b643c 806b5590 806efdb4
[    0.000000]         80860000 80701248 80700d83 8064c7e4 00000000 00000001 806efd58 00000000
[    0.000000]         00000000 00000000 808a0000 00000000 00000030 00000027 342e3520 2032332e
[    0.000000]         00000000 00000000 00000000 00000000 00000000 80720000 00000000 807299f0
[    0.000000]         00000009 806451a4 806fe2b0 80700000 00000002 00000010 87ff0000 00000000
[    0.000000]         ...
[    0.000000] Call Trace:
[    0.000000] [<8000b72c>] show_stack+0x30/0x100
[    0.000000] [<8058fac4>] dump_stack+0xa4/0xdc
[    0.000000] [<80028038>] __warn+0xc0/0x10c
[    0.000000] [<800280e0>] warn_slowpath_fmt+0x5c/0xac
[    0.000000] [<807299f0>] rcu_init+0x55c/0x774
[    0.000000] [<80720a7c>] start_kernel+0x2dc/0x55c
[    0.000000] [<80011044>] start_secondary+0xb0/0x3a0
[    0.000000] random: get_random_bytes called from print_oops_end_marker+0x2c/0x64 with crng_init=0
[    0.000000] ---[ end trace 0000000000000000 ]---
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:2999 rcu_init+0x5ac/0x774
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W          5.4.32 #0
[    0.000000] Stack : 00000000 800774cc 806b0000 806b6474 80720000 806b643c 806b5590 806efdb4
[    0.000000]         80860000 80701248 80700d83 8064c7e4 00000000 00000001 806efd58 00000000
[    0.000000]         00000000 00000000 808a0000 00000000 00000030 0000003b 342e3520 2032332e
[    0.000000]         00000000 00000000 00000000 00000000 00000000 80720000 00000000 80729a40
[    0.000000]         00000009 806451a4 806fe2b0 80700000 00000002 00000010 87ff0000 00000000
[    0.000000]         ...
[    0.000000] Call Trace:
[    0.000000] [<8000b72c>] show_stack+0x30/0x100
[    0.000000] [<8058fac4>] dump_stack+0xa4/0xdc
[    0.000000] [<80028038>] __warn+0xc0/0x10c
[    0.000000] [<800280e0>] warn_slowpath_fmt+0x5c/0xac
[    0.000000] [<80729a40>] rcu_init+0x5ac/0x774
[    0.000000] [<80720a7c>] start_kernel+0x2dc/0x55c
[    0.000000] [<80011044>] start_secondary+0xb0/0x3a0
[    0.000000] ---[ end trace f68728a0d3053b52 ]---
[    0.000000] NR_IRQS: 256
[    0.000000] Kernel panic - not syncing: Failed to find mtk,mt7621-sysc node
[    0.000000] Rebooting in 1 seconds..
[    0.000000] Reboot failed -- System halted
----

Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
---
 target/linux/ramips/image/mt7621.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Szabolcs Hubai April 16, 2020, 8:07 p.m. UTC | #1
Hi!

Sorry, I didn't noticed that the lzma-loader thread [0] originally had
a note about DIR-860L.
I read the landed commits only which didn't talk about followups.


Sure, this dictionary size adjustment is just a workaround, the real
fix would be that updated lzma-loader.

Sorry for the noise!


Szabolcs



[0] http://lists.infradead.org/pipermail/openwrt-devel/2020-April/022834.html

Szabolcs Hubai <szab.hu@gmail.com> ezt írta (időpont: 2020. ápr. 16.,
Cs, 17:32):
>
> Snapshot images for DIR-860L after the initial kernel 5.4 landing
> (on Apr 4, 2020 commits from b51ea43f9001 to 4d979a4d1969)
> are broken: they causes "LZMA ERROR 1 - must RESET board to recover"
>
> Snapshot factory image serial log:
> ----
> Please choose the operation:
>    1: Load system code to SDRAM via TFTP.
>    2: Load system code then write to Flash via TFTP.
>    3: Boot system code via Flash (default).
>    4: Entr boot command line interface.
>    7: Load Boot Loader code then write to Flash via Serial.
>    9: Load Boot Loader code then write to Flash via TFTP.
>
> You choosed 3
>
> 0
>
> 3: System Boot system code via Flash.
> addr:80500000
> We have SEAMA, Image Size = 2424768
> Verifying Checksum ...
> Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover
> ----
>
> The local defconfig build works, also the snapshot initramfs images.
>
> The bug can be reproduced with the "CONFIG_ALL_KMODS=y" configuration.
>
> As this "LZMA ERROR 1" isn't new (e.g. 77e2bccde8f7),
> I tried to adjust the lzma dictionary parameter:
> - with "-d20" and above it causes "LZMA ERROR 1"
> - with "-d19" it boots but doesn't find the device tree (see below)
> - with "-d18" it boots fine
>
> Serial log with "-d19" lzma dictionary:
> ----
> Please choose the operation:
>    1: Load system code to SDRAM via TFTP.
>    2: Load system code then write to Flash via TFTP.
>    3: Boot system code via Flash (default).
>    4: Entr boot command line interface.
>    7: Load Boot Loader code then write to Flash via Serial.
>    9: Load Boot Loader code then write to Flash via TFTP.
> 0
>
> 3: System Boot system code via Flash.
> addr:80500000
> We have SEAMA, Image Size = 4915140
> Verifying Checksum ...
> Uncompressing SEAMA linux.lzma ... OK
>
> Starting kernel ...
>
> [    0.000000] Linux version 5.4.32 (xabolcs@ut1804) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r12974-75f19deb3a)) #0 SMP Wed Apr 15 02:14:19 2020
> [    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
> [    0.000000] printk: bootconsole [early0] enabled
> [    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
> [    0.000000] Initrd not found or empty - disabling initrd
> [    0.000000] VPE topology {2,2} total 4
> [    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
> [    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
> [    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
> [    0.000000]   HighMem  empty
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
> [    0.000000] OF: fdt: No valid device tree found, continuing without
> [    0.000000] percpu: Embedded 14 pages/cpu s26704 r8192 d22448 u57344
> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
> [    0.000000] Kernel command line:   rootfstype=squashfs,jffs2
> [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
> [    0.000000] Writing ErrCtl register=0004050c
> [    0.000000] Readback ErrCtl register=0004050c
> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> [    0.000000] Memory: 120752K/131072K available (5826K kernel code, 206K rwdata, 1252K rodata, 1280K init, 237K bss, 10320K reserved, 0K cma-reserved, 0K highmem)
> [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
> [    0.000000] rcu: Hierarchical RCU implementation.
> [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:2998 rcu_init+0x55c/0x774
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.32 #0
> [    0.000000] Stack : 00000000 800774cc 806b0000 806b6474 80720000 806b643c 806b5590 806efdb4
> [    0.000000]         80860000 80701248 80700d83 8064c7e4 00000000 00000001 806efd58 00000000
> [    0.000000]         00000000 00000000 808a0000 00000000 00000030 00000027 342e3520 2032332e
> [    0.000000]         00000000 00000000 00000000 00000000 00000000 80720000 00000000 807299f0
> [    0.000000]         00000009 806451a4 806fe2b0 80700000 00000002 00000010 87ff0000 00000000
> [    0.000000]         ...
> [    0.000000] Call Trace:
> [    0.000000] [<8000b72c>] show_stack+0x30/0x100
> [    0.000000] [<8058fac4>] dump_stack+0xa4/0xdc
> [    0.000000] [<80028038>] __warn+0xc0/0x10c
> [    0.000000] [<800280e0>] warn_slowpath_fmt+0x5c/0xac
> [    0.000000] [<807299f0>] rcu_init+0x55c/0x774
> [    0.000000] [<80720a7c>] start_kernel+0x2dc/0x55c
> [    0.000000] [<80011044>] start_secondary+0xb0/0x3a0
> [    0.000000] random: get_random_bytes called from print_oops_end_marker+0x2c/0x64 with crng_init=0
> [    0.000000] ---[ end trace 0000000000000000 ]---
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:2999 rcu_init+0x5ac/0x774
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W          5.4.32 #0
> [    0.000000] Stack : 00000000 800774cc 806b0000 806b6474 80720000 806b643c 806b5590 806efdb4
> [    0.000000]         80860000 80701248 80700d83 8064c7e4 00000000 00000001 806efd58 00000000
> [    0.000000]         00000000 00000000 808a0000 00000000 00000030 0000003b 342e3520 2032332e
> [    0.000000]         00000000 00000000 00000000 00000000 00000000 80720000 00000000 80729a40
> [    0.000000]         00000009 806451a4 806fe2b0 80700000 00000002 00000010 87ff0000 00000000
> [    0.000000]         ...
> [    0.000000] Call Trace:
> [    0.000000] [<8000b72c>] show_stack+0x30/0x100
> [    0.000000] [<8058fac4>] dump_stack+0xa4/0xdc
> [    0.000000] [<80028038>] __warn+0xc0/0x10c
> [    0.000000] [<800280e0>] warn_slowpath_fmt+0x5c/0xac
> [    0.000000] [<80729a40>] rcu_init+0x5ac/0x774
> [    0.000000] [<80720a7c>] start_kernel+0x2dc/0x55c
> [    0.000000] [<80011044>] start_secondary+0xb0/0x3a0
> [    0.000000] ---[ end trace f68728a0d3053b52 ]---
> [    0.000000] NR_IRQS: 256
> [    0.000000] Kernel panic - not syncing: Failed to find mtk,mt7621-sysc node
> [    0.000000] Rebooting in 1 seconds..
> [    0.000000] Reboot failed -- System halted
> ----
>
> Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
> ---
>  target/linux/ramips/image/mt7621.mk | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
> index 6e64fb8bf1..cfae103d22 100644
> --- a/target/linux/ramips/image/mt7621.mk
> +++ b/target/linux/ramips/image/mt7621.mk
> @@ -218,6 +218,7 @@ define Device/dlink_dir-860l-b1
>    $(Device/seama)
>    BLOCKSIZE := 64k
>    SEAMA_SIGNATURE := wrgac13_dlink.2013gui_dir860lb
> +  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma -d18 | uImage lzma
>    KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
>    IMAGE_SIZE := 16064k
>    DEVICE_VENDOR := D-Link
> --
> 2.17.1
>
Szabolcs Hubai April 19, 2020, 12:37 a.m. UTC | #2
Hello,

This is my second attempt to fix the snapshot images for D-Link DIR 860L B1.


This device accepts uncompressed uImages as initramfs only.
From the flash it expects LZMA compressed image and ignores the uImage header.


To create a bootable image, the LZMA packed kernel prepared with the LZMA loader
has to be packed again with LZMA.
For the initramfs, it needs an LZMA compressed uImage header too.

In the second LZMA compression stage I use the fastest compression ("-a0") to
save some CPU power.


In my previous attempt the "-d18" LZMA parameter needs 128K more space,
while "-d19" and above causes LZMA ERROR 1.

With this patch (LZMA loader + double LZMA compression) it needs 64K more space,
compared to the snapshot image, which uses "-d23" as default.




--
Regards,
Szabolcs
Szabolcs Hubai April 19, 2020, 6:49 p.m. UTC | #3
Hello,

This is my third attempt to revive the snapshot images for D-Link DIR-860L B1.

In this version, only the dlink_dir-860l-b1 recipe is modified.


--
Regards,
Szabolcs
diff mbox series

Patch

diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 6e64fb8bf1..cfae103d22 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -218,6 +218,7 @@  define Device/dlink_dir-860l-b1
   $(Device/seama)
   BLOCKSIZE := 64k
   SEAMA_SIGNATURE := wrgac13_dlink.2013gui_dir860lb
+  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma -d18 | uImage lzma
   KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
   IMAGE_SIZE := 16064k
   DEVICE_VENDOR := D-Link