plic causes panic
gtxzsxxk opened this issue · 1 comments
gtxzsxxk commented
[ 0.533803][ T1] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.542065][ T1] Serial probe1
[ 0.542499][ T1] devm_ioremap membase 2751467520 regs->start 307232768 resource_size(regs) 256
[ 0.542804][ T1] dw8250_probe: p->type 1
[ 0.544943][ legacy console [ttyS0] disabled
[ 0.566388][ T1] 12500000.uart: ttyS0 at MMIO 0x12500000 (irq = 1, base_baud = 72000) is a 16550A
[ 0.566657][ T1] printk: legacy console [ttyS0] enabled
[ 0.566657][ T1] printk: legacy console [ttyS0] enabled
[ 0.566921][ T1] printk: legacy bootconsole [sbi0] disabled
[ 0.566921][ T1] printk: legacy bootconsole [sbi0] disabled
[ 0.569058][ T1] serial8250_register_8250_port: 0
[ 0.574381][ T1] brd: module loaded
[ 0.574538][ T1] start plist test
[ 0.625515][ T1] end plist test
[ 0.663751][ T1] clk: Disabling unused clocks
[ 0.665372][ T1] BUG: spinlock bad magic on CPU#0, swapper/1
[ 0.665565][ T1] lock: 0xc0615a9c, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[ 0.665831][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 6.8.0-rc4-00006-gd90188ef7a29-dirty #157
[ 0.666108][ T1] Call Trace:
[ 0.666232][ T1] [<c0004070>] dump_backtrace+0x2c/0x3c
[ 0.666466][ T1] [<c00040bc>] show_stack+0x3c/0x50
[ 0.666692][ T1] [<c01d6544>] dump_stack_lvl+0x34/0x50
[ 0.666949][ T1] [<c01d657c>] dump_stack+0x1c/0x2c
[ 0.667198][ T1] [<c0035ea8>] spin_bug+0x84/0xac
[ 0.667421][ T1] [<c0035f60>] do_raw_spin_lock+0x34/0x84
[ 0.667660][ T1] [<c01f5214>] _raw_spin_lock+0x24/0x34
[ 0.667890][ T1] [<c0187a50>] plic_toggle.constprop.0+0x34/0xc4
[ 0.668145][ T1] [<c0187b70>] plic_irq_toggle.constprop.0+0x60/0x68
[ 0.668409][ T1] [<c0187b90>] plic_irq_enable+0x18/0x28
[ 0.668648][ T1] [<c003fffc>] irq_enable+0x74/0x90
[ 0.668869][ T1] [<c00400f8>] irq_startup+0xe0/0xe8
[ 0.669092][ T1] [<c003ded0>] __setup_irq+0x584/0x6ac
[ 0.669309][ T1] [<c003e188>] request_threaded_irq+0x190/0x1ac
[ 0.669546][ T1] [<c01b06dc>] univ8250_setup_irq+0x19c/0x1d8
[ 0.669815][ T1] [<c01b3ad4>] serial8250_do_startup+0x358/0x68c
[ 0.670061][ T1] [<c01b3e38>] serial8250_startup+0x30/0x34
[ 0.670296][ T1] [<c01ac7dc>] uart_startup+0xf8/0x1d4
[ 0.670537][ T1] [<c01ac900>] uart_port_activate+0x48/0x74
[ 0.670790][ T1] [<c01987b8>] tty_port_open+0x98/0xfc
[ 0.6048][ T1] [<c01ab4ac>] uart_open+0x20/0x38
[ 0.671274][ T1] [<c0191980>] tty_open+0x308/0x3c0
[ 0.671505][ T1] [<c00bebe4>] chrdev_open+0x1ac/0x1c8
[ 0.671764][ T1] [<c00b6ad8>] do_dentry_open+0x378/0x3b4
[ 0.671995][ T1] [<c00b7bd4>] vfs_open+0x38/0x48
[ 0.672214][ T1] [<c00ca0c0>] path_openat+0x9a0/0xa54
[ 0.672464][ T1] [<c00ca1b8>] do_filp_open+0x44/0x98
[ 0.672713][ T1] [<c00b8058>] file_open_name+0x40/0x54
[ 0.672945][ T1] [<c00b80a8>] filp_open+0x3c/0x68
[ 0.673167][ T1] [<c01f6edc>] console_on_rootfs+0x2c/0x80
[ 0.673413][ T1] [<c01f70ec>] kernel_init_freeable+0x1bc/0x21c
[ 0.673673][ T1] [<c01ef71c>] kernel_init+0x24/0x134
[ 0.673923][ T1] [<c01f5ad4>] ret_from_fork+0x14/0x24
[ 0.674156][ T1] plic: __plic_toggle enable_base 0 hwirq 10 1
[ 0.674398][ T1] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 0.674634][ T1] Oops [#1]
[ 0.674761][ T1] CPU: 0 PID: 1 Comm: swapper Not tainted 6.8.0-rc4-00006-gd90188ef7a29-dirty #157
[ 0.6038][ T1] epc : plic_toggle.constprop.0+0x74/0xc4
[ 0.675266][ T1] ra : plic_toggle.constprop.0+0x6c/0xc4
[ 0.675494][ T1] epc : c0187a90 ra : c0187a88 sp : c0835ad0
[ 0.675702][ T1] gp : c0623a68 tp : c0830000 t0 : 3a000000
[ 0.675909][ T1] t1 : 00000070 t2 : 3a63696c s0 : c0835b00
[ 0.676112][ T1] s1 : 00000400 a0 : 0000002c a1 : 00000000
[ 0.676305][ T1] a2 : 00000000 a3 : 00000062 a4 : c060f930
[ 0.676502][ T1] a5 : 00000002 a6 : c06030f0 a7 : 00000018
[ 0.676699][ T1] s2 : 00000000 s3 : 00000001 s4 : c0616000
[ 0.676894][ T1] s5 : c0899234 s6 : 00000122 s7 : c08992c8
[ 0.677098][ T1] s8 : c0899260 s9 : c1231d80 s10: c05ea000
[ 0.677305][ T1] s11: 00000000 t3 : c062a973 t4 : c062a973
[ 0.677507][ T1] t5 : c062a974 t6 : c08359a0
[ 0.677677][ T1] status: 00000120 badaddr: 00000000 cause: 0000000d
[ 0.677883][ T1] [<c0187a90>] plic_toggle.constprop.0+0x74/0xc4
[ 0.678138][ T1] [<c0187b70>] plic_irq_toggle.constprop.0+0x60/0x68
[ 8401][ T1] [<c0187b90>] plic_irq_enable+0x18/0x28
[ 0.678640][ T1] [<c003fffc>] irq_enable+0x74/0x90
[ 0.678861][ T1] [<c00400f8>] irq_startup+0xe0/0xe8
[ 09083][ T1] [<c003ded0>] __setup_irq+0x584/0x6ac
[ 0.679301][ T1] [<c003e188>] request_threaded_irq+0x190/0x1ac
[ 0.679538][ T1] [<c01b06dc>] univ8250_setup_irq+0x19c/0x1d8
[ 0.679807][ T1] [<c01b3ad4>] serial8250_do_startup+0x358/0x68c
[ 0.680052][ T1] [<c01b3e38>] serial8250_startup+0x30/0x34
[ 0.80287][ T1] [<c01ac7dc>] uart_startup+0xf8/0x1d4
[ 0.680528][ T1] [<c01ac900>] uart_port_activate+0x48/0x74
[ 0.680781][ T1] [<c01987b8>] tty_port_open+0x98/0xfc
[ 0.681039][ T1] [<c01ab4ac>] uart_open+0x20/0x38
[ 0.681265][ T1] [<c0191980>] tty_open+0x308/0x3c0
[ 0.681495][ T1] [<c00bebe4>] chrdev_open+0x1ac/0x1c8
[ 0.681754][ T1] [<c00b6ad8>] do_dentry_open+0x378/0x3b4
[ 0.681986][ T1] [<c00b7bd4>] vfs_open+0x38/0x48
[ 0.682c00ca0c0>] path_openat+0x9a0/0xa54
[ 0.682455][ T1] [<c00ca1b8>] do_filp_open+0x44/0x98
[ 0.682703][ T1] [<c00b8058>] file_open_name+0x40/0x54
[ 0.682935][ T1] [<c00b80a8>] filp_open+0x3c/0x68
[ 0.683157][ T1] [<c01f6edc>] console_on_rootfs+0x2c/0x80
[ 0.3403][ T1] [<c01f70ec>] kernel_init_freeable+0x1bc/0x21c
[ 0.683663][ T1] [<c01ef71c>] kernel_init+0x24/0x134
[ 0.683913][ T1] [<c01f5ad4>] ret_from_fork+0x14/0x24
[ 0.684231][ T1] Code: 8933 0125 f097 ffea 80e7 df40 8063 0409 000f 0140 (2783) 0009
[ 0.684497][ T1] ---[ end trace 0000000000000000 ]---
[ 0.684659][ T1] note: swapper[1] exited with preempt_count 2
[ 0.684861][ T1] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 0.685089][ T1] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
gtxzsxxk commented
We fixed it by using thead plic instead. This problem is caused by the code
if (parent.args[0] != RV_IRQ_EXT) {
/* Disable S-mode enable bits if running in M-mode. */
if (IS_ENABLED(CONFIG_RISCV_M_MODE)) {
void __iomem *enable_base = priv->regs +
CONTEXT_ENABLE_BASE +
i * CONTEXT_ENABLE_SIZE;
for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
__plic_toggle(enable_base, hwirq, 0);
}
continue;
}
By introducing the thead-plic, we solve the problem by adding supervisor external interrupt.