This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

J721EXSOMXEVM: UART 8250 Omap deadlock issue

Part Number: J721EXSOMXEVM

I have found an issue with UART 8250_omap.c linux driver. When I enabled child node on uart (for external Bluetooth module) kernel stuck with RCU stall. I have found a scenario which leads to deadlock.

The issue is related to kernel "ti-linux-6.6.y" tag: 10.01.02. 

The driver uses port->lock in function omap8250_runtime_resume() line at 1856. But in this scenario the lock is held by serial line layer. 

We solve this issue by disabling UART_CAP_RPM for uarts. 
The stack track for this scenario follows:
 
queued_spin_lock_slowpath(lock = 0xFFFF80008235D7B8, val = 1141638144)
queued_spin_lock(inline)
do_raw_spin_lock(lock = 0xFFFF80008235D7B8)
__raw_spin_lock_irq(inline)
_raw_spin_lock_irq(lock = 0xFFFF80008235D7B8)                                                               !!!!!! deadlock
omap8250_runtime_resume(dev = 0xFFFF000000187010)
pm_generic_runtime_resume(dev = ???)
__genpd_runtime_resume(dev = ???)
genpd_runtime_resume(dev = 0xFFFF000000187010)
__rpm_callback(cb = 0xFFFF800080817D44, dev = 0xFFFF000000187010)
rpm_callback(cb = ???, dev = 0xFFFF000000187010)
rpm_resume(dev = 0xFFFF000000187010, rpmflags = 4)
__pm_runtime_resume(dev = 0xFFFF000000187010, rpmflags = 192)
pm_runtime_get_sync(inline)
serial8250_rpm_get(inline)
serial8250_rpm_get(inline)
serial8250_do_get_mctrl(port = 0xFFFF80008235D7B8)
serial8250_get_mctrl(port = ???)
uart_line_info(inline)                                                                                            !!!!!! take port->lock an call mctrl
uart_proc_show(m = 0xFFFF000005CB1658, v = ???)
seq_read_iter(iocb = 0xFFFF800083943D48, iter = 0xFFFF800083943D20)
proc_reg_read_iter(iocb = ???, iter = ???)
call_read_iter(inline)
new_sync_read(inline)
vfs_read(file = 0xFFFF000007BCC400, buf = 0x0361A7F0, count = 1024, pos = 0xFFFF800083943DC0)
ksys_read(fd = ???, buf = 0x0361A7F0, count = 1024)
__do_sys_read(inline)
__se_sys_read(inline)
__arm64_sys_read(regs = ???)
__invoke_syscall(inline)
invoke_syscall(regs = 0xFFFF800083943EB0, scno = ???, sc_nr = ???, syscall_table = ???)
el0_svc_common(regs = 0xFFFF800083943EB0, scno = ???, syscall_table = ???, sc_nr = ?)
do_el0_svc(regs = ???)
el0_svc(regs = 0xFFFF800083943EB0)
el0t_64_sync_handler(regs = ???)
el0t_64_sync(asm)
exception