I'm using WNDR4500 and network elf booting for testing OpenWRT. It's
working quite nice at the moment (it doesn't crash, most of the
initialization works fine).

So I decided to hack my hardware a little further and wrote some
additional kernel module. I've built it in, to be able to test it with
elf booting (obj-y += hello.o).

Unfortunately building OpenWRT with my new module started crashing
kernel. Of course it does not happen directly in the module, my code
seems to be OK and stable. The crash message looks like this:
Loader:elf Filesys:tftp Dev:eth0
File:192.168.1.2:/openwrt-brcm47xx-vmlinux.elf Options:(null)
 Loading: 0x80001000/4587928 0x80461198/113016 Entry at 0x8024dfc0
 Closing network.
 Starting program at 0x8024dfc0
 [    0.000000] Linux version 3.5.0-rc6-wl+ (za...@linux-bxwm.site)
(gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) )
#150 Thu Jul 19 08:30:31 CEST 2012
 [    0.000000] bootconsole [early0] enabled
 [    0.000000] CPU revision is: 00019749 (MIPS 74Kc)
 [    0.000000] bcm47xx: using bcma bus
 [    0.000000] bcma: bus0: Found chip with id 0x5300, rev 0x01 and package 0x00
 [    0.000000] bcma: bus0: Core 0 found: BCM4706 ChipCommon (manuf
0x4BF, id 0x500, rev 0x1F, class 0x0)
 [    0.000000] bcma: bus0: Core 3 found: MIPS 74K (manuf 0x4A7, id
0x82C, rev 0x00, class 0x0)
 [    0.000000] bcma: bus0: Initializing MIPS core...
 [    0.000000] bcma: bus0: IRQ reconfiguration done
 [    0.000000] bcma: core 0x082c, irq : 2(S)* 3  4  5  6  D  I
 [    0.000000] bcma: core 0x0500, irq : 2(S)* 3  4  5  6  D  I
 [    0.000000] bcma: bus0: Serial flash not supported
 [    0.000000] bcma: bus0: NAND flash not supported
 [    0.000000] bcma: bus0: Early bus registered
 [    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] Primary instruction cache 32kB, 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:  console=ttyS0,115200
root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd
console=ttyS0,115200
 [    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=80000020
 [    0.000000] Readback ErrCtl register=80000020
 [    0.000000] Cache parity protection enabled
 [    0.000000] Memory: 125308k/131072k available (2410k kernel code,
5764k reserved, 539k data, 1532k init, 0k highmem)
 [    0.000000] NR_IRQS:128
 [    0.000000] Calibrating delay loop... [    0.000000] Unhandled
kernel unaligned access[#1]:
 [    0.000000] Cpu 0

 [    0.000000] $ 0   :
 [    0.000000]  00000000 11000000 802ba000 00000000
 [    0.000000] $ 4   : b3756016 00000000 73756016 00000030
 [    0.000000] $ 8   : 11000000 1000001e 00000000 00000000
 [    0.000000] $12   : 00000001 87c04e00 00000200 00000e00
 [    0.000000] $16   : 73756016 73755f6f 802ba108 00000028
 [    0.000000] $20   : 80460000 00000000 00000000 00000001
 [    0.000000] $24   : 00000001 807029f8
 [    0.000000] $28   : 802ba000 802ba038 00030000 80004ea0
 [    0.000000] Hi    : 00000000
 [    0.000000] Lo    : 00000000
 [    0.000000] epc   : 8000f288 do_page_fault+0x68/0x350
 [    0.000000]     Not tainted
 [    0.000000] ra    : 80004ea0 ret_from_exception+0x0/0x24
 [    0.000000] Status: 11000002    KERNEL EXL
 [    0.000000] Cause : c0808010
 [    0.000000] BadVA : 73756013
 [    0.000000] PrId  : 00019749 (MIPS 74Kc)
 [    0.000000] Modules linked in:
 [    0.000000] Process ô˙$h (pid: -1884159964, threadinfo=802b8000,
task=8017456c, tls=802c1f86)
 [    0.000000] *HwTLS: 8ffffbfa
 [    0.000000] Stack : 5f5f0072 6669666b 756f5f6f 65705f74 725f6b65
6b5f5f00 6f666966 5f6e695f
         5f5f0072 00030001 656c5f6f 00725f6e 666b5f5f 5f6f6669 5f78616d 5f5f0072
         6669666b 6d645f6f 756f5f61 72705f74 72617065 5f5f0065 6669666b 6d645f6f
         6e695f61 6572705f 65726170 6b5f5f00 6f666966 5f6f745f 72657375 6b5f5f00
         6f666966 6f72665f 73755f6d 5f007265 69666b5f 6f5f6f66 5f007475 69666b5f
         ...
 [    0.000000] Call Trace:
 [    0.000000] [<8000f288>] do_page_fault+0x68/0x350
 [    0.000000]
 [    0.000000]
 Code: 0083182b  00a0b021  00c08021 <14600092> 8e3500a4  8f830014
3c02efff  3442ffff  00621024
 [    0.000000] ---[ end trace 4eaa2a86a8e2da22 ]---
 [    0.000000] Kernel panic - not syncing: Fatal exception in interrupt

I've started hacking my new module to find out which part of it causes
the crash. Well, crash happens a long time before my module gets
loaded, but I suspected some compiler bug or sth. I was hacking in for
a whole day but didn't find anything.

Finally I've noticed that adding/removing a single pr_err line can
cause/stop crashes! For example adding this line:
pr_err("\n");
in some code that is never executed (!!) causes my kernel to crash early.

Today I started suspecting it's something related to the image size.
I've done some test and there's what I got:

CRASH
4588152         vmlinux
4593260         vmlinux.elf

NO-CRASH
4584328         vmlinux
4589436         vmlinux.elf

NO-CRASH
4584344         vmlinux
4589452         vmlinux.elf

NO-CRASH
4584360         vmlinux
4589468         vmlinux.elf

CRASH
4588168         vmlinux
4593276         vmlinux.elf

CRASH
4588736         vmlinux
4593844         vmlinux.elf

It seems I got creashed only with vmlinux.elf being over 4'590'000.


Do you have any idea what may be causing this problem? Can this be
compiler bug? Or is this some internal limit of elf image that my
router supports? Or sth else?

-- 
Rafał
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to