From 233e175f28783bd8d94b48afab8fd46a1c30bdac Mon Sep 17 00:00:00 2001 From: hujun5 Date: Tue, 24 Dec 2024 10:49:07 +0800 Subject: [PATCH] fix a deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0 up_testset (lock=0x404241c0 ) at /home/hujun5/下载/vela_sim/nuttx/include/arch/spinlock.h:96 1 spin_lock_wo_note (lock=) at /home/hujun5/下载/vela_sim/nuttx/include/nuttx/spinlock.h:207 2 spin_lock_irqsave_wo_note (lock=0x404241c0 ) at /home/hujun5/下载/vela_sim/nuttx/include/nuttx/spinlock.h:467 3 spin_lock_irqsave (lock=0x404241c0 ) at /home/hujun5/下载/vela_sim/nuttx/include/nuttx/spinlock.h:521 4 pl011_txint (dev=0x404240b0 , enable=false) at serial/uart_pl011.c:746 5 0x00000000402a3f1c in uart_xmitchars (dev=0x404240b0 ) at serial/serial_io.c:118 6 0x00000000402a10f8 in pl011_txint (dev=, enable=) at serial/uart_pl011.c:756 7 0x00000000402a2ca0 in uart_write (filep=, buffer=, buflen=0) at serial/serial.c:1493 8 0x000000004028c464 in file_writev_compat (filep=0x4046cda0, uio=) at vfs/fs_write.c:81 9 0x000000004028c588 in file_writev (filep=, uio=uio@entry=0x40470dc0) at vfs/fs_write.c:161 10 0x000000004028c5fc in nx_writev (fd=, iov=iov@entry=0x40470e10, iovcnt=iovcnt@entry=1) at vfs/fs_write.c:257 11 0x000000004028c660 in writev (fd=, iov=iov@entry=0x40470e10, iovcnt=iovcnt@entry=1) at vfs/fs_write.c:356 12 0x000000004028c6dc in write (fd=, buf=buf@entry=0x404090b2 , nbytes=) at vfs/fs_write.c:421 13 0x00000000402adb10 in nsh_session (pstate=pstate@entry=0x40471080, login=login@entry=1, argc=argc@entry=1, argv=argv@entry=0x4046cf40) at nsh_session.c:108 14 0x00000000402ad94c in nsh_consolemain (argc=argc@entry=1, argv=argv@entry=0x4046cf40) at nsh_consolemain.c:75 15 0x00000000402ad894 in nsh_main (argc=argc@entry=1, argv=argv@entry=0x4046cf40) at nsh_main.c:74 16 0x00000000402a5880 in nxtask_startup (entrypt=0x402ad7fc , argc=1, argv=0x4046cf40) at sched/task_startup.c:72 17 0x000000004029d444 in nxtask_start () at task/task_start.c:116 18 0x0000000000000000 in ?? () fix regresion from https://github.com/apache/nuttx/pull/15301 Signed-off-by: hujun5 --- drivers/serial/uart_pl011.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/serial/uart_pl011.c b/drivers/serial/uart_pl011.c index 4ce110c45348c..1da270069920e 100644 --- a/drivers/serial/uart_pl011.c +++ b/drivers/serial/uart_pl011.c @@ -748,19 +748,15 @@ static void pl011_txint(FAR struct uart_dev_s *dev, bool enable) if (enable) { pl011_irq_tx_enable(sport); - - /* Fake a TX interrupt here by just calling uart_xmitchars() with - * interrupts disabled (note this may recurse). - */ + spin_unlock_irqrestore(&sport->lock, flags); uart_xmitchars(dev); } else { pl011_irq_tx_disable(sport); + spin_unlock_irqrestore(&sport->lock, flags); } - - spin_unlock_irqrestore(&sport->lock, flags); } /***************************************************************************