How to debug kernel panic on kernel 4.12.28?

1

I am trying to debug the embedded Linux kernel 4.12.28, this crashes and shows kernel panic. I have put some prints inside blocks/genhd.c to print the disk_name. I see that it crashes inside - "bdget_disk" while getting the bdgt_disk for disk_name "ram0". I am using a power pc architecture. I am a bit puzzled on how should I approach this issue or how can I debug? I am unable to understand the root cause. My understanding is that ram0 is like a RAM disk needed for initial bootup by the system. The initrd contents will be copied to ram0 for bootup. I don't understand why it crashes. I can make out that it is related to bad address. But what is the real reason and how to debug this?

My defconfig has -

CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=32768

The kernel panic logs are -

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16, base_baud = 19531250) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17, base_baud = 19531250) is a 16550A
console [ttyS1] enabled
console [ttyS1] enabled
bootconsole [udbg0] disabled
bootconsole [udbg0] disabled
Custom Debug..DEBUG: Passed bdget_disk 765
Custom Debug.. the disc name is ram0
Unable to handle kernel paging request for data at address 0x00005484
Faulting instruction address: 0xc0100154
Oops: Kernel access of bad area, sig: 11 [#1]
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.12.28-standard #1
task: df416a60 task.stack: df42a000
NIP: c0100154 LR: c011d158 CTR: c02bd990
REGS: df42bcb0 TRAP: 0300   Not tainted  (4.12.28-standard)
MSR: 00009032 <EE,ME,IR,DR,RI>
  CR: 242c0484  XER: 00000000
DAR: 00005484 DSISR: 20000000
GPR00: c02406bc df42bd60 df416a60 df407800 00000001 c011cb4c c011cb64 df42bd68
GPR08: 00000005 00000001 c0660000 00000000 222c0824 00000000 c00040f0 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c0660000 c05fa2dc
GPR24: 00000007 00000093 df50d00c df50d060 00000000 df50d058 00000000 df50d040
NIP [c0100154] iget5_locked+0xc/0x250
LR [c011d158] bdget+0x40/0xf4
Call Trace:
[df42bd60] [c0652708] log_wait+0x0/0x8 (unreliable)
[df42bd80] [c02406bc] bdget_disk+0xac/0xf8
[df42bda0] [c0241780] device_add_disk+0x3f4/0x43c
[df42bdf0] [c060ed5c] brd_init+0xa8/0x184
[df42be20] [c0003a5c] do_one_initcall+0x48/0x18c
[df42be90] [c05faafc] kernel_init_freeable+0x130/0x228
[df42bf20] [c0004108] kernel_init+0x18/0x110
[df42bf40] [c00103f0] ret_from_kernel_thread+0x5c/0x64
Instruction dump:
741d7e44 3f090d7e ea9463ef 3a7ebecd fc607969 24b8044d a251c1c7 2c91258b
242aaa92 9887d4e0 2f4a22b5 8b2ef93c <8b9c5484> 7ecf225d 6a9c4a5b 1a5791d4
---[ end trace 47ca8dc77d8de71b ]---

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Rebooting in 180 seconds..
linux-kernel
kernel
embedded-linux
powerpc
asked on Stack Overflow Jul 8, 2019 by Prawn Hongs • edited Jul 12, 2019 by Prawn Hongs

1 Answer

0

In simple words kernel was searching for /dev/ram0 which it couldn't find.

probable root-cause: you didn't provided proper command line argument to initialize initrd. please do post you kernel command line. we can sort it out.

answered on Stack Overflow Jul 15, 2019 by Devidas

User contributions licensed under CC BY-SA 3.0