casaroli commented on code in PR #20591:
URL: https://github.com/apache/nuttx/pull/20591#discussion_r4248100071


##########
drivers/serial/uart_pl011.c:
##########
@@ -743,17 +743,24 @@ static void pl011_txint(FAR struct uart_dev_s *dev, bool 
enable)
   FAR struct pl011_uart_port_s *sport = dev->priv;
   irqstate_t flags;
 
-  flags = spin_lock_irqsave(&sport->lock);

Review Comment:
   The irqsave did block the TX interrupt, but only until 
spin_unlock_irqrestore(), and that ran before uart_xmitchars(). So 
uart_xmitchars() ran with interrupts enabled, and the TX interrupt could enter 
it in the middle.
   
   uart_xmitchars() cannot run while sport->lock is held, because it calls 
pl011_send(), which takes the same lock (a deadlock on SMP).
   
   So the spinlock now covers only the register write, and the enable and 
uart_xmitchars() run inside enter_critical_section(), as uart_16550.c does.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to