On Fri, May 18, 2018 at 10:20:13AM +0800, Shawn Lin wrote: > Hi, > > With the following patch appled, > > commit d76c74387e1c978b6c5524a146ab0f3f72206f98 > Author: Phil Edworthy <phil.edworthy@xxxxxxxxxxx> > Date: Thu May 10 15:13:56 2018 +0100 > > serial: 8250_dw: Fix runtime PM handling > > When using kgdb, you get an abort when accessing the UART registers. > This is because the driver has already entered runtime PM and so turned > off the bus clock needed to access the registers. > > To fix this, set the capability indicating Runtime PM is active while > idle. > > Signed-off-by: Phil Edworthy <phil.edworthy@xxxxxxxxxxx> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > > > leading to the following splat: > > > [ 30.419892] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled > [ 30.682642] ff180000.serial: ttyS0 at MMIO 0xff180000 (irq = 38, > base_baud = 1500000) is a 16550A > [ 30.770040] ff1a0000.serial: ttyS2 at MMIO 0xff1a0000 (irq = 39, > base_baud = 1500000) is a 16550A > [ 30.780849] console [ttyS2] enabled > [ 30.780849] console [ttyS2] enabled > [ 30.785492] BUG: sleeping function called from invalid context at > drivers/base/power/runtime.c:1034 > [ 30.785492] BUG: sleeping function called from invalid context at > drivers/base/power/runtime.c:1034 > [ 30.785554] in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0 > [ 30.785554] in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0 > [ 30.785596] 7 locks held by swapper/0/1: > [ 30.785596] 7 locks held by swapper/0/1: > [ 30.785630] #0: (____ptrval____) (&dev->mutex){....}, at: > __driver_attach+0x7c/0xf0 > [ 30.785630] #0: (____ptrval____) (&dev->mutex){....}, at: > __driver_attach+0x7c/0xf0 > [ 30.785839] #1: (____ptrval____) (&dev->mutex){....}, at: > __driver_attach+0x8c/0xf0 > [ 30.785839] #1: (____ptrval____) (&dev->mutex){....}, at: > __driver_attach+0x8c/0xf0 > [ 30.786042] #2: (____ptrval____) (serial_mutex){+.+.}, at: > serial8250_register_8250_port+0x48/0x708 > [ 30.786042] #2: (____ptrval____) (serial_mutex){+.+.}, at: > serial8250_register_8250_port+0x48/0x708 > [ 30.786253] #3: (____ptrval____) (port_mutex){+.+.}, at: > uart_add_one_port+0xe0/0x848 > [ 30.786253] #3: (____ptrval____) (port_mutex){+.+.}, at: > uart_add_one_port+0xe0/0x848 > [ 30.786457] #4: (____ptrval____) (&port->mutex){+.+.}, at: > uart_add_one_port+0xf4/0x848 > [ 30.786457] #4: (____ptrval____) (&port->mutex){+.+.}, at: > uart_add_one_port+0xf4/0x848 > [ 30.786661] #5: (____ptrval____) (console_lock){+.+.}, at: > vprintk_emit+0x284/0x4a0 > [ 30.786661] #5: (____ptrval____) (console_lock){+.+.}, at: > vprintk_emit+0x284/0x4a0 > [ 30.786864] #6: (____ptrval____) (console_owner){....}, at: > console_unlock+0x238/0x690 > [ 30.786864] #6: (____ptrval____) (console_owner){....}, at: > console_unlock+0x238/0x690 > [ 30.787077] irq event stamp: 577424 > [ 30.787077] irq event stamp: 577424 > [ 30.787136] hardirqs last enabled at (577423): [<ffff20000818988c>] > __down_trylock_console_sem+0x6c/0xb0 > [ 30.787136] hardirqs last enabled at (577423): [<ffff20000818988c>] > __down_trylock_console_sem+0x6c/0xb0 > [ 30.787197] hardirqs last disabled at (577424): [<ffff20000818a050>] > console_unlock+0x148/0x690 > [ 30.787197] hardirqs last disabled at (577424): [<ffff20000818a050>] > console_unlock+0x148/0x690 > [ 30.787254] softirqs last enabled at (577412): [<ffff20000808215c>] > __do_softirq+0x2d4/0x3b4 > [ 30.787254] softirqs last enabled at (577412): [<ffff20000808215c>] > __do_softirq+0x2d4/0x3b4 > [ 30.787309] softirqs last disabled at (577403): [<ffff2000080fe3f8>] > irq_exit+0x150/0x160 > [ 30.787309] softirqs last disabled at (577403): [<ffff2000080fe3f8>] > irq_exit+0x150/0x160 > [ 30.787367] Preemption disabled at:[<ffff20000818bcb8>] > vprintk_emit+0x280/0x4a0 > [ 30.787367] Preemption disabled at:[<ffff20000818bcb8>] > vprintk_emit+0x280/0x4a0 > [ 30.787457] CPU: 0 PID: 1 Comm: swapper/0 Not tainted > 4.17.0-rc5-next-20180517-00019-gae3b4aa-dirty #358 > [ 30.787457] CPU: 0 PID: 1 Comm: swapper/0 Not tainted > 4.17.0-rc5-next-20180517-00019-gae3b4aa-dirty #358 > [ 30.787502] Hardware name: Excavator-RK3399 Board (DT) > [ 30.787502] Hardware name: Excavator-RK3399 Board (DT) > [ 30.787538] Call trace: > [ 30.787538] Call trace: > [ 30.787579] dump_backtrace+0x0/0x238 > [ 30.787579] dump_backtrace+0x0/0x238 > [ 30.787618] show_stack+0x14/0x20 > [ 30.787618] show_stack+0x14/0x20 > [ 30.787656] dump_stack+0xb0/0xec > [ 30.787656] dump_stack+0xb0/0xec > [ 30.787695] ___might_sleep+0x254/0x2a8 > [ 30.787695] ___might_sleep+0x254/0x2a8 > [ 30.787734] __might_sleep+0x74/0xe0 > [ 30.787734] __might_sleep+0x74/0xe0 > [ 30.787777] __pm_runtime_resume+0xb0/0xb8 > [ 30.787777] __pm_runtime_resume+0xb0/0xb8 > [ 30.787820] serial8250_rpm_get.part.2+0x24/0x30 > [ 30.787820] serial8250_rpm_get.part.2+0x24/0x30 > [ 30.787863] serial8250_console_write+0x3a8/0x3d8 > [ 30.787863] serial8250_console_write+0x3a8/0x3d8 > [ 30.787909] univ8250_console_write+0x44/0x58 > [ 30.787909] univ8250_console_write+0x44/0x58 > [ 30.787949] console_unlock+0x56c/0x690 > [ 30.787949] console_unlock+0x56c/0x690 > [ 30.787988] vprintk_emit+0x28c/0x4a0 > [ 30.787988] vprintk_emit+0x28c/0x4a0 > [ 30.788027] vprintk_default+0x34/0x40 > [ 30.788027] vprintk_default+0x34/0x40 > [ 30.788067] vprintk_func+0x1e0/0x2b8 > [ 30.788067] vprintk_func+0x1e0/0x2b8 > [ 30.788105] printk+0xac/0xd8 > [ 30.788105] printk+0xac/0xd8 > [ 30.788146] register_console+0x2d0/0x508 > [ 30.788146] register_console+0x2d0/0x508 > [ 30.788187] uart_add_one_port+0x834/0x848 > [ 30.788187] uart_add_one_port+0x834/0x848 > [ 30.788233] serial8250_register_8250_port+0x514/0x708 > [ 30.788233] serial8250_register_8250_port+0x514/0x708 > [ 30.788271] dw8250_probe+0x6bc/0x8f0 > [ 30.788271] dw8250_probe+0x6bc/0x8f0 > [ 30.788312] platform_drv_probe+0x6c/0xd0 > [ 30.788312] platform_drv_probe+0x6c/0xd0 > [ 30.788353] driver_probe_device+0x2e0/0x3f8 > [ 30.788353] driver_probe_device+0x2e0/0x3f8 > [ 30.788393] __driver_attach+0xec/0xf0 > [ 30.788393] __driver_attach+0xec/0xf0 > [ 30.788433] bus_for_each_dev+0xdc/0x150 > [ 30.788433] bus_for_each_dev+0xdc/0x150 > [ 30.788472] driver_attach+0x30/0x40 > [ 30.788472] driver_attach+0x30/0x40 > [ 30.788515] bus_add_driver+0x1c0/0x318 > [ 30.788515] bus_add_driver+0x1c0/0x318 > [ 30.788556] driver_register+0xb4/0x198 > [ 30.788556] driver_register+0xb4/0x198 > [ 30.788602] __platform_driver_register+0x7c/0x88 > [ 30.788602] __platform_driver_register+0x7c/0x88 > [ 30.788648] dw8250_platform_driver_init+0x18/0x20 > [ 30.788648] dw8250_platform_driver_init+0x18/0x20 > [ 30.788688] do_one_initcall+0xac/0x210 > [ 30.788688] do_one_initcall+0xac/0x210 > [ 30.788729] kernel_init_freeable+0x294/0x33c > [ 30.788729] kernel_init_freeable+0x294/0x33c > [ 30.788768] kernel_init+0x10/0x118 > [ 30.788768] kernel_init+0x10/0x118 > [ 30.788808] ret_from_fork+0x10/0x18 > [ 30.788808] ret_from_fork+0x10/0x18 > [ 30.857151] bootconsole [uart8250] disabled > [ 30.857151] bootconsole [uart8250] disabled Ick. That's crazy. And reverting this patch makes things work again? If so, I'll go revert this, thanks for letting us know. Phil, any ideas? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html