Modify

Opened 5 years ago

Closed 3 years ago

#13161 closed defect (fixed)

[ar71xx] kexec regression in 3.8.2

Reported by: Damian Kaczkowski <damian.kaczkowski+openwrt@…> Owned by: developers
Priority: highest Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: Cc:

Description

Hi.

Loading and executing ar71xx initramfs image through kexec fails in 3.8.2. In 3.7.10 all worked fine.

Here are some logs comparing 3.8.2 and 3.7.10. As I can see load address and some console output differs. Have a look:

3.7.10 (ar71xx r35868) ok

root@Open:/# kexec -e
[  120.080000] eth0: link down
[  120.080000] eth1: link down
[  120.090000] br-lan: port 1(eth1) entered disabled state
[  120.090000] Starting new kernel
[  120.100000] kexec_relocate_size = 5416
[  120.100000] reboot_code_buffer = 8e4a4000
[  120.110000] kexec_start_address(entry point of new kernel) = 80060000
[  120.110000] kexec_indirection_page = 8eb7e000
[  120.120000] Copy kexec_relocate section from 8026d874 to reboot_code_buffer: 8e4a4000
[  120.120000] kexec_args[0] (argc): 8
[  120.130000] kexec_args[1] (argv): a0871c00
[  120.130000] kexec_args[2] (env ):   (null)
[  120.140000] kexec_args[3] (desc):   (null)
[  120.140000] kexec_argv[0] =   (null), (null)
[  120.140000] kexec_argv[1] =   (null), (null)
[  120.150000] kexec_argv[2] =   (null), (null)
[  120.150000] kexec_argv[3] =   (null), (null)
[  120.160000] kexec_argv[4] =   (null), (null)
[  120.160000] kexec_argv[5] =   (null), (null)
[  120.170000] kexec_argv[6] =   (null), (null)
[  120.170000] kexec_argv[7] =   (null), (null)
[  120.170000] Will call new kernel at 80060000
[  120.170000] Bye ...


OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80060000...

(...)

3.8.2 (ar71xx r35977) fails

root@OpenWrt:/# kexec -e
[   45.260000] eth0: link down
[   45.270000] eth1: link down
[   45.270000] br-lan: port 1(eth1) entered disabled state
[   45.280000] Starting new kernel
[   45.280000] Will call new kernel at 00060000
[   45.280000] Bye ...


OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80060000...

[    0.000000] Linux version 3.8.2 (dk@box) (collect2: ld returned 1 exit status) #5 Tue Mar 12 13:30:12 CET 2013
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR7161 rev 2
[    0.000000] Clocks: CPU:680.000MHz, DDR:340.000MHz, AHB:170.000MHz, Ref:40.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x07ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x07ffffff]
[    0.000000] Reserving 0MB of memory at 0MB for crashkernel
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line:  rootfstype=yaffs noinitrd
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] __ex_table already sorted, skipping sort
[    0.000000] Writing ErrCtl register=0007a000
[    0.000000] Readback ErrCtl register=0007a000
[    0.000000] Memory: 123624k/131072k available (2126k kernel code, 7448k reserved, 434k data, 3132k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 452.19 BogoMIPS (lpj=2260992)
[    0.060000] pid_max: default: 32768 minimum: 301
[    0.060000] Mount-cache hash table entries: 512
[    0.070000] NET: Registered protocol family 16
[    0.070000] MIPS: machine is Generic AR71XX/AR724X/AR913X based board
[    0.080000] bio: create slab <bio-0> at 0
[    0.090000] Switching to clocksource MIPS
[    0.090000] NET: Registered protocol family 2
[    0.100000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.100000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.110000] TCP: reno registered
[    0.120000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.120000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.130000] NET: Registered protocol family 1
[    3.560000] msgmni has been set to 241
[    3.560000] io scheduler noop registered
[    3.570000] io scheduler deadline registered (default)
[    3.570000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
?    3.600000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11) is a 16550A

And it sticks at this point.

Kernel configs are exactly the same in both revisions. 3.8.2 image boots fine when loaded from flash. Also I can load 3.8.2 image from system running 3.7.10 kernel. I just can't load 3.8.2 (or any other) image from system running 3.8.2 kernel. Is this upstream or OpenWrt bug? Could some dev please take a look at this? Many thanks in advance.

Greets.

Attachments (0)

Change History (14)

comment:1 Changed 5 years ago by Nilfred <nilfred@…>

How you kernel load command

kexec -l kernel-image --append=command-line-options --initrd=initrd-image

looks like?

comment:2 Changed 5 years ago by Damian Kaczkowski <damian.kaczkowski+openwrt@…>

Hi Nilfred. I just load the initramfs image (-l). No additional arguments. Are they necessary if 3.7.10 properly loads image without them? Or can I add some arguments to fix this issue?

comment:3 Changed 5 years ago by Damian Kaczkowski <damian.kaczkowski+openwrt@…>

Tried:

kexec -l kernel-image --append="$(cat /proc/cmdline)"
kexec -l kernel-image --command-line=="$(cat /proc/cmdline)"

Still the same error/freeze.

Kernel Command Line does not change even when --append/--command-line switch is used. It remains default:

[    0.000000] Kernel command line:  rootfstype=yaffs noinitrd

btw. It seems that

kexec-tools/patches/0004-mips_regdefs.patch

Is no longer needed?

comment:4 Changed 5 years ago by jogo

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker (trunk)

comment:5 Changed 3 years ago by yousong

I noticed that kexec related patches 330-335 were removed from kernel version 3.8 above. It's still there for 3.3. Is this because those patches were rejected upstream by linux-mips?

comment:6 Changed 3 years ago by yousong

I am working on allowing specifying kernel parameters with --command-line= from kexec. Currently it can load and boot ELF format kernels. I tried bringing lzma support to kexec-tools, but looks like the decompression did not work right. Will investigate later.

Last edited 3 years ago by yousong (previous) (diff)

comment:7 follow-ups: Changed 3 years ago by mchwalisz

Do you have any progress on --command-line= parameters? It is still not working.

Are there any patches to help with that?

comment:8 in reply to: ↑ 7 Changed 3 years ago by yousong

Replying to mchwalisz:

Do you have any progress on --command-line= parameters? It is still not working.

Are there any patches to help with that?

Yes. It's just that the patch on kernel looks shabby and I guess they kind of have rotten in my local tree now... But I will just clean it up a bit and try sending a RFC series in the near future. Thanks for the remainder though.

comment:9 in reply to: ↑ 7 Changed 3 years ago by yousong

Replying to mchwalisz:

Do you have any progress on --command-line= parameters? It is still not working.

Are there any patches to help with that?

Hi, I just sent a patch series. They can be viewed and downloaded from the following URL.

http://patchwork.ozlabs.org/bundle/yousong/kexec/

Update: a link to the cover letter of the series will be good.

https://lists.openwrt.org/pipermail/openwrt-devel/2015-January/030775.html

Last edited 3 years ago by yousong (previous) (diff)

comment:10 follow-up: Changed 3 years ago by mchwalisz

I have downloaded the patch series, applied, compiled and tested on TP-Link WDR4300 router.

There are couple of comments. First if you load openwrt-ar71xx-generic-vmlinux-lzma.elf it complains about being not in gzip format. It still boots correctly.

# kexec -d --command-line="board=TL-WDR4300 console=ttyS0,115200" -l openwrt.elf 
`openwrt.elf' is not in gzip format: 
kernel: 0x7753a008 kernel_size: 1409c9
kexec_load: entry = 0x60000 flags = 80000
nr_segments = 2
segment[0].buf   = 0x41a11c
segment[0].bufsz = 100
segment[0].mem   = (nil)
segment[0].memsz = 1000
segment[1].buf   = 0x7754a008
segment[1].bufsz = 13082d
segment[1].mem   = 0x60000
segment[1].memsz = 131000

I can also convert it to gzip and run successfully.

# gzip -c openwrt.elf > openwrt.elf.gz
# kexec -d --command-line="board=TL-WDR4300 console=ttyS0,115200" -l openwrt.elf.gz 
kernel: 0x77b43008 kernel_size: 1409c9
kexec_load: entry = 0x60000 flags = 80000
nr_segments = 2
segment[0].buf   = 0x41a11c
segment[0].bufsz = 100
segment[0].mem   = (nil)
segment[0].memsz = 1000
segment[1].buf   = 0x77b53008
segment[1].bufsz = 13082d
segment[1].mem   = 0x60000
segment[1].memsz = 131000

Still the command line has the part added by kernel (although I use --commnad-line parameter, not append).

Kernel command line:  board=TL-WDR4300 console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd

It is still progress now I can boot correctly to the new kernel. Previously console was misconfigured and hanged the system.

comment:11 in reply to: ↑ 10 Changed 3 years ago by yousong

Hi, mchwalisz

Replying to mchwalisz:

I have downloaded the patch series, applied, compiled and tested on TP-Link WDR4300 router.

There are couple of comments. First if you load openwrt-ar71xx-generic-vmlinux-lzma.elf it complains about being not in gzip format. It still boots correctly.

It still booted correctly because that file was a valid ELF image and kexec recognised that after giving up on gzip and lzma. Yes, those error messages from xxx_decompress_file() should be printed as debug messages.

# kexec -d --command-line="board=TL-WDR4300 console=ttyS0,115200" -l openwrt.elf 
`openwrt.elf' is not in gzip format: 
kernel: 0x7753a008 kernel_size: 1409c9
kexec_load: entry = 0x60000 flags = 80000
nr_segments = 2
segment[0].buf   = 0x41a11c
segment[0].bufsz = 100
segment[0].mem   = (nil)
segment[0].memsz = 1000
segment[1].buf   = 0x7754a008
segment[1].bufsz = 13082d
segment[1].mem   = 0x60000
segment[1].memsz = 131000

I can also convert it to gzip and run successfully.

# gzip -c openwrt.elf > openwrt.elf.gz
# kexec -d --command-line="board=TL-WDR4300 console=ttyS0,115200" -l openwrt.elf.gz 
kernel: 0x77b43008 kernel_size: 1409c9
kexec_load: entry = 0x60000 flags = 80000
nr_segments = 2
segment[0].buf   = 0x41a11c
segment[0].bufsz = 100
segment[0].mem   = (nil)
segment[0].memsz = 1000
segment[1].buf   = 0x77b53008
segment[1].bufsz = 13082d
segment[1].mem   = 0x60000
segment[1].memsz = 131000

Still the command line has the part added by kernel (although I use --commnad-line parameter, not append).

Kernel command line:  board=TL-WDR4300 console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd

This was caused by kernel configuration options CONFIG_CMDLINE_BOOL and CONFIG_CMDLINE_OVERRIDE; in the case of OpenWrt, the first option is enabled and the latter not which will cause builtin_cmdline[] to be appended to prom_init()-ed one.

It is still progress now I can boot correctly to the new kernel. Previously console was misconfigured and hanged the system.

Thanks for the feedback!

comment:12 Changed 3 years ago by florian

Is this is still a problem with current trunk builds?

comment:13 Changed 3 years ago by Damian Kaczkowski

No.

comment:14 Changed 3 years ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.