You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/09/09 10:35:28 UTC

[incubator-nuttx] branch master updated (803599f -> 4ef8599)

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 803599f  uClibc++:remove typeinfo.cpp that confict with libsupc++
     new b5bb1fb  esp32_serial.c: Replace critical section by a device specific spin lock.
     new 4ef8599  esp32_serial.c: Release the spinlock before calling uart_xmitchars, this functions will call esp32_txint again which leads to deadlock since esp32_txint has already locked the spinlock.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/xtensa/src/esp32/esp32_serial.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

[incubator-nuttx] 01/02: esp32_serial.c: Replace critical section by a device specific spin lock.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b5bb1fb8a38b63b3388e8bcfd922852a427d9b84
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Tue Aug 24 16:56:05 2021 +0200

    esp32_serial.c: Replace critical section by a device specific spin lock.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_serial.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c
index 3d0f523..d2205f7 100644
--- a/arch/xtensa/src/esp32/esp32_serial.c
+++ b/arch/xtensa/src/esp32/esp32_serial.c
@@ -41,6 +41,7 @@
 #include <nuttx/arch.h>
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/serial/serial.h>
+#include <nuttx/spinlock.h>
 
 #include <arch/board/board.h>
 
@@ -268,6 +269,7 @@ struct esp32_dev_s
 #ifdef CONFIG_SERIAL_OFLOWCONTROL
   bool oflow;                          /* Output flow control (CTS) enabled */
 #endif
+  spinlock_t lock;
 };
 
 /****************************************************************************
@@ -816,7 +818,7 @@ static void esp32_disableallints(struct esp32_dev_s *priv, uint32_t *intena)
 
   /* The following must be atomic */
 
-  flags = enter_critical_section();
+  flags = spin_lock_irqsave(&priv->lock);
 
   if (intena)
     {
@@ -828,7 +830,7 @@ static void esp32_disableallints(struct esp32_dev_s *priv, uint32_t *intena)
   /* Disable all interrupts */
 
   putreg32(0, UART_INT_ENA_REG(priv->config->id));
-  leave_critical_section(flags);
+  spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 /****************************************************************************
@@ -953,7 +955,7 @@ static int esp32_setup(struct uart_dev_s *dev)
       modifyreg32(UART_CONF1_REG(priv->config->id), 0, regval);
     }
 
-#endif 
+#endif
 
 #endif
   return OK;
@@ -1641,7 +1643,7 @@ static void esp32_rxint(struct uart_dev_s *dev, bool enable)
   irqstate_t flags;
   int regval;
 
-  flags = enter_critical_section();
+  flags = spin_lock_irqsave(&priv->lock);
 
   if (enable)
     {
@@ -1666,7 +1668,7 @@ static void esp32_rxint(struct uart_dev_s *dev, bool enable)
       putreg32(regval, UART_INT_ENA_REG(priv->config->id));
     }
 
-  leave_critical_section(flags);
+  spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 /****************************************************************************
@@ -1714,7 +1716,7 @@ static void esp32_txint(struct uart_dev_s *dev, bool enable)
   if (priv->txdma == false)
     {
 #endif
-      flags = enter_critical_section();
+      flags = spin_lock_irqsave(&priv->lock);
 
       if (enable)
         {
@@ -1742,7 +1744,7 @@ static void esp32_txint(struct uart_dev_s *dev, bool enable)
                       (UART_TX_DONE_INT_ENA | UART_TXFIFO_EMPTY_INT_ENA), 0);
         }
 
-      leave_critical_section(flags);
+      spin_unlock_irqrestore(&priv->lock, flags);
 #ifdef CONFIG_SERIAL_TXDMA
     }
 #endif

[incubator-nuttx] 02/02: esp32_serial.c: Release the spinlock before calling uart_xmitchars, this functions will call esp32_txint again which leads to deadlock since esp32_txint has already locked the spinlock.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4ef859924bec0b0bfa5f0f8c03ae45c49154c84b
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Tue Aug 24 16:57:36 2021 +0200

    esp32_serial.c: Release the spinlock before calling uart_xmitchars, this
    functions will call esp32_txint again which leads to deadlock since
    esp32_txint has already locked the spinlock.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_serial.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c
index d2205f7..b4d7dda 100644
--- a/arch/xtensa/src/esp32/esp32_serial.c
+++ b/arch/xtensa/src/esp32/esp32_serial.c
@@ -1733,6 +1733,7 @@ static void esp32_txint(struct uart_dev_s *dev, bool enable)
            * interrupts disabled (note this may recurse).
            */
 
+          spin_unlock_irqrestore(&priv->lock, flags);
           uart_xmitchars(dev);
     #endif
         }