Linux内核启动执行完函数run_init_process(execute_command)后发生Kernel panic
本文是原「蜗窝讨论区」的历史存档(2016-10-20),来自版块「Linux kernel技术问答」,共 6 帖。讨论区已停止服务,此处仅供查阅。
问题:Linux内核启动时发生如log所示kernel panic:
[== HTML ==]
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 3
ThumbEE CPU extension supported.
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Freeing unused kernel memory: 284K (805f6000 - 8063d000)
kernel_init 0
kernel_init 1
execute /linuxrc...
kernel_init 9
Unhandled fault: imprecise external abort (0x1c06) at 0x00156042
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000007
CPU: 0 PID: 1 Comm: linuxrc Tainted: G W 3.10.31-ltsi-04995-g339abcb-dirty #1
[<80014de0>] (unwind_backtrace+0x0/0x104) from [<80012440>] (show_stack+0x20/0x24)
[<80012440>] (show_stack+0x20/0x24) from [<80450bb0>] (dump_stack+0x20/0x28)
[<80450bb0>] (dump_stack+0x20/0x28) from [<8044df98>] (panic+0x8c/0x1dc)
[<8044df98>] (panic+0x8c/0x1dc) from [<80024e9c>] (do_exit+0x768/0x830)
[<80024e9c>] (do_exit+0x768/0x830) from [<800250f0>] (do_group_exit+0x4c/0xac)
[<800250f0>] (do_group_exit+0x4c/0xac) from [<80031574>] (get_signal_to_deliver+0x188/0x50c)
[<80031574>] (get_signal_to_deliver+0x188/0x50c) from [<8044da1c>] (do_signal+0xbc/0x3e4)
[<8044da1c>] (do_signal+0xbc/0x3e4) from [<80011e64>] (do_work_pending+0xac/0xc0)
[<80011e64>] (do_work_pending+0xac/0xc0) from [<8000e840>] (work_pending+0xc/0x20)
自己在内核中加入的debug信息为:
[== C++ ==]
static int __ref kernel_init(void *unused)
{
kernel_init_freeable(;
/* need to finish all async __init code before freeing the memory */
async_synchronize_full(;
free_initmem(;
mark_rodata_ro(;
system_state = SYSTEM_RUNNING;
numa_default_policy(;
flush_delayed_fput(;
if (ramdisk_execute_command) {
if (!run_init_process(ramdisk_execute_command))
return 0;
pr_err("Failed to execute %s\n", ramdisk_execute_command);
}
printk(KERN_INFO"kernel_init 0\n");
/*
* We try each of these until one succeeds.
*
* The Bourne shell can be used instead of init if we are
* trying to recover a really broken machine.
*/
if (execute_command) {
printk(KERN_INFO"kernel_init 1\n");
printk(KERN_INFO"execute %s...\n",
execute_command);
if (!run_init_process(execute_command))
{
printk(KERN_INFO"kernel_init 9\n");
return 0;
printk(KERN_INFO"kernel_init 10\n");
}
pr_err("Failed to execute %s. Attempting defaults...\n",
execute_command);
}
printk(KERN_INFO"kernel_init 2\n");
if (!run_init_process("/sbin/init") ||
!run_init_process("/etc/init") ||
!run_init_process("/bin/init") ||
!run_init_process("/bin/sh"))
return 0;
printk(KERN_INFO"kernel_init 3\n");
panic("No init found. Try passing init= option to kernel. "
"See Linux Documentation/init.txt for guidance.");
}
背景及猜测可能出问题的点: 1、双核A9双核SOC。但是在uboot中将CPU 1至于了Debug模式。 2、log中出现了以下warning。
[== HTML ==]
Truncating RAM at 10000000-7fffffff to -7f7fffff (vmalloc region overlap).
BUG: mapping for 0xffa00000 at 0xffa00000 out of vmalloc space
DDR的地址范围为0x10000000~0x80000000。 3、使用的根文件系统为ramdisk,bootargs为 bootargs = "root=/dev/ram0 rw initrd=0x38000000,16M init=/linuxrc console=ttyS0,115200"; 4、uImage下的地址为0x10008000,ramdisk下载的地址为0x38000000 5、内核及交叉工具链版本:Linux version 3.10.31-ltsi-04995-g339abcb-dirty (root@Linux) (gcc version 4.7.3 20121106 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2012.11-20121123 - Linaro GCC 2012.11)
完整的log信息如下:
[== HTML ==]
tarting kernel ...
Uncompressing Linux… done, booting the kernel.
ooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Linux version 3.10.31-ltsi-04995-g339abcb-dirty (root@Linux) (gcc version 4.7.3 20121106 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2012.11-20121123 - Linaro GCC 2012.11) #2 SMP Thu Oct 20 11:28:12 EDT 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: cma9, model: chipmotion cma9
Truncating RAM at 10000000-7fffffff to -7f7fffff (vmalloc region overlap).
Memory policy: ECC disabled, Data cache writealloc
BUG: mapping for 0xffa00000 at 0xffa00000 out of vmalloc space
PERCPU: Embedded 8 pages/cpu @8180e000 s11200 r8192 d13376 u32768
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 453136
Kernel command line: root=/dev/ram0 rw initrd=0x38000000,16M init=/linuxrc console=ttyS0,115200
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
Memory: 1784MB = 1784MB total
Memory: 1787248k/1787248k available, 39568k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xf0000000 - 0xff000000 ( 240 MB)
lowmem : 0x80000000 - 0xef800000 (1784 MB)
modules : 0x7f000000 - 0x80000000 ( 16 MB)
.text : 0x80008000 - 0x80641468 (6374 kB)
.init : 0x80642000 - 0x80694bc0 ( 331 kB)
.data : 0x80696000 - 0x806d15d0 ( 238 kB)
.bss : 0x806d15d0 - 0x80710e84 ( 255 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
sched_clock: 32 bits at 12MHz, resolution 80ns, wraps every 343597ms
Switching to timer-based delay loop
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 25.00 BogoMIPS (lpj=125000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
ftrace: allocating 17412 entries in 52 pages
schedule_preempt_disabled 0
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x80497b98 - 0x80497bf0
CPU1: failed to boot: -38
Brought up 1 CPUs
SMP: Total of 1 processors activated (25.00 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
L2x0 series cache controller enabled
l2x0: 8 ways, CACHE_ID 0x00000000, AUX_CTRL 0x00000000, Cache size: 65536 B
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Switching to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP: reno registered
UDP hash table entries: 1024 (order: 3, 32768 bytes)
UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs…
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 16384K (a8000000 - a9000000)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
NTFS driver 2.1.30 .
jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
msgmni has been set to 3522
io scheduler noop registered (default)
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
ttyS0: autoconf (0x0000, 0xfe020000): iir1=6 iir2=6 iir=3 type=16550A
fe020000.serial0: ttyS0 at MMIO 0xfe020000 (irq = 101) is a 16550A
console enabled
brd: module loaded
CAN device driver interface
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
Synopsys Designware Multimedia Card Interface Driver
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
oprofile: no performance counters
oprofile: using timer interrupt.
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
8021q: 802.1Q VLAN Support v1.8
Key type dns_resolver registered
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 3
ThumbEE CPU extension supported.
Registering SWP/SWPB emulation handler
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Freeing unused kernel memory: 328K (80642000 - 80694000)
kernel_init 0
kernel_init 1
execute /linuxrc…
kernel_init 9
Unhandled fault: imprecise external abort (0x1c06) at 0x00156042
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000007
CPU: 0 PID: 1 Comm: linuxrc Not tainted 3.10.31-ltsi-04995-g339abcb-dirty #2
[<80016710>] (unwind_backtrace+0x0/0x104) from [<80012f50>] (show_stack+0x20/0x24)
[<80012f50>] (show_stack+0x20/0x24) from [<80493be4>] (dump_stack+0x20/0x28)
[<80493be4>] (dump_stack+0x20/0x28) from [<80490778>] (panic+0xa0/0x1f4)
[<80490778>] (panic+0xa0/0x1f4) from [<80028118>] (do_exit+0x844/0x914)
[<80028118>] (do_exit+0x844/0x914) from [<800283ac>] (do_group_exit+0x4c/0xd4)
[<800283ac>] (do_group_exit+0x4c/0xd4) from [<800357ec>] (get_signal_to_deliver+0x1b8/0x620)
[<800357ec>] (get_signal_to_deliver+0x1b8/0x620) from [<80012264>] (do_signal+0x110/0x41c)
[<80012264>] (do_signal+0x110/0x41c) from [<800128e4>] (do_work_pending+0x78/0xb8)
[<800128e4>] (do_work_pending+0x78/0xb8) from [<8000e8c0>] (work_pending+0xc/0x20)
给kernel和driver用的虚拟地址空间不够了?
[== Undefined ==]
vmalloc : 0xf0000000 - 0xff000000 ( 240 MB)
32位 1G内存的系统,kernel默认给应该是128M,你试试加一下这个命令行参数:
[== Undefined ==]
vmalloc=256M
谢谢蜗蜗哥哥的耐心回复。该错误已经确认为一个硬件错误。
活出自我 写道: 谢谢蜗蜗哥哥的耐心回复。该错误已经确认为一个硬件错误。
具体是什么硬件错误呢?为什么产生了这个panic信息呢?可以的话给大家分享一下哈~~~
SOC design工程师把L2 Cache的地址搞错了。出现了这个panic.
活出自我 写道: SOC design工程师把L2 Cache的地址搞错了。出现了这个panic.
多谢分享
