You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "zyfeier (via GitHub)" <gi...@apache.org> on 2024/10/23 01:54:31 UTC

[PR] sem: change sem wait to atomic operation [nuttx]

zyfeier opened a new pull request, #14465:
URL: https://github.com/apache/nuttx/pull/14465

   
   ## Summary
   
   Add sem_wait fast operations, use atomic to ensure atomicity of semcount operations, and do not depend on critical section.
   
   Test with robot board:
   before modify:
   nxmutex_lock cost: 78 ns
   nxmutex_unlock cost: 82 ns
   
   after modify:
   nxmutex_lock cost: 28 ns
   nxmutex_unlock cost: 14 ns
   
   ## Impact
   
   semaphore
   
   ## Testing
   
   bes board with monkey test pass
   sabre-6quad:smp with ostest pass


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812176461


##########
sched/semaphore/sem_wait.c:
##########
@@ -69,17 +68,12 @@
  *
  ****************************************************************************/
 
-int nxsem_wait(FAR sem_t *sem)
+static int nxsem_wait_slow(FAR sem_t *sem)
 {
   FAR struct tcb_s *rtcb = this_task();
   irqstate_t flags;
   int ret;
 
-  /* This API should not be called from interrupt handlers & idleloop */
-
-  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);

Review Comment:
   Why are these not relevant anymore?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "chirping78 (via GitHub)" <gi...@apache.org>.
chirping78 commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2477830420

   
   
   > But the problem might be that the iram is not compatiable with `s32c1i` instruction. @tmedicci you may need to check this with the IC designer.
   > 
   
   @tmedicci  Found this statement in "Xtensa ® LX7 MicroprocessorData Book"
   ```
   S32C1I instructions may target cached, cache-bypass, and data RAM memory locations. 
   S32C1I instructions are not permitted to access memory addresses in data ROM,
   instruction memory or the address region allocated to the XLMI port. Attempts to direct
   the S32C1I at these addresses will cause an exception.
   ```
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "yamt (via GitHub)" <gi...@apache.org>.
yamt commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1839500844


##########
sched/semaphore/sem_post.c:
##########
@@ -78,21 +78,20 @@ int nxsem_post(FAR sem_t *sem)
   uint8_t proto;
 #endif
 
-  DEBUGASSERT(sem != NULL);
-
   /* The following operations must be performed with interrupts
    * disabled because sem_post() may be called from an interrupt
    * handler.
    */
 
   flags = enter_critical_section();
 
-  sem_count = sem->semcount;
+  sem_count = atomic_fetch_add(NXSEM_COUNT(sem), 1);
 
   /* Check the maximum allowable value */
 
   if (sem_count >= SEM_VALUE_MAX)
     {

Review Comment:
   the overflown value is already visible to other threads at this point, isn't it?
   isn't it a problem?
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812182144


##########
sched/semaphore/sem_wait.c:
##########
@@ -224,6 +213,65 @@ int nxsem_wait(FAR sem_t *sem)
   return ret;
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_wait
+ *
+ * Description:
+ *   This function attempts to lock the semaphore referenced by 'sem'.  If
+ *   the semaphore value is (<=) zero, then the calling task will not return
+ *   until it successfully acquires the lock.
+ *
+ *   This is an internal OS interface.  It is functionally equivalent to
+ *   sem_wait except that:
+ *
+ *   - It is not a cancellation point, and
+ *   - It does not modify the errno value.
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor.
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *   Possible returned errors:
+ *
+ *   - EINVAL:  Invalid attempt to get the semaphore
+ *   - EINTR:   The wait was interrupted by the receipt of a signal.
+ *
+ ****************************************************************************/
+
+int nxsem_wait(FAR sem_t *sem)
+{
+  /* This API should not be called from interrupt handlers & idleloop */
+
+  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
+  DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
+
+  /* If this is a mutex, we can try to get the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)

Review Comment:
   So the fast path is usable only when priority inheritance is not used? For mutexes you could actually set the holder atomically without locking (by setting PID) although for semaphores this is not the case (semaphores can have several holders).



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1811799994


##########
sched/semaphore/sem_post.c:
##########
@@ -217,3 +214,60 @@ int nxsem_post(FAR sem_t *sem)
 
   return OK;
 }
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_post
+ *
+ * Description:
+ *   When a kernel thread has finished with a semaphore, it will call
+ *   nxsem_post().  This function unlocks the semaphore referenced by sem
+ *   by performing the semaphore unlock operation on that semaphore.
+ *
+ *   If the semaphore value resulting from this operation is positive, then
+ *   no tasks were blocked waiting for the semaphore to become unlocked; the
+ *   semaphore is simply incremented.
+ *
+ *   If the value of the semaphore resulting from this operation is zero,
+ *   then one of the tasks blocked waiting for the semaphore shall be
+ *   allowed to return successfully from its call to nxsem_wait().
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *
+ * Assumptions:
+ *   This function may be called from an interrupt handler.
+ *
+ ****************************************************************************/
+
+int nxsem_post(FAR sem_t *sem)
+{
+  DEBUGASSERT(sem != NULL);
+
+  /* If this is a mutex, we can try to unlock the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)
+  if (sem->flags & SEM_TYPE_MUTEX)

Review Comment:
    why not move SEM_TYPE_MUTEX related logic inside mutex?



##########
sched/semaphore/sem_wait.c:
##########
@@ -224,6 +213,65 @@ int nxsem_wait(FAR sem_t *sem)
   return ret;
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_wait
+ *
+ * Description:
+ *   This function attempts to lock the semaphore referenced by 'sem'.  If
+ *   the semaphore value is (<=) zero, then the calling task will not return
+ *   until it successfully acquires the lock.
+ *
+ *   This is an internal OS interface.  It is functionally equivalent to
+ *   sem_wait except that:
+ *
+ *   - It is not a cancellation point, and
+ *   - It does not modify the errno value.
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor.
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *   Possible returned errors:
+ *
+ *   - EINVAL:  Invalid attempt to get the semaphore
+ *   - EINTR:   The wait was interrupted by the receipt of a signal.
+ *
+ ****************************************************************************/
+
+int nxsem_wait(FAR sem_t *sem)
+{
+  /* This API should not be called from interrupt handlers & idleloop */
+
+  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
+  DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
+
+  /* If this is a mutex, we can try to get the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)
+  if (sem->flags & SEM_TYPE_MUTEX)
+    {
+      short old = 1;
+      if (atomic_compare_exchange_weak_explicit(NXSEM_COUNT(sem), &old, 0,

Review Comment:
   ditto



##########
sched/semaphore/sem_post.c:
##########
@@ -217,3 +214,60 @@ int nxsem_post(FAR sem_t *sem)
 
   return OK;
 }
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_post
+ *
+ * Description:
+ *   When a kernel thread has finished with a semaphore, it will call
+ *   nxsem_post().  This function unlocks the semaphore referenced by sem
+ *   by performing the semaphore unlock operation on that semaphore.
+ *
+ *   If the semaphore value resulting from this operation is positive, then
+ *   no tasks were blocked waiting for the semaphore to become unlocked; the
+ *   semaphore is simply incremented.
+ *
+ *   If the value of the semaphore resulting from this operation is zero,
+ *   then one of the tasks blocked waiting for the semaphore shall be
+ *   allowed to return successfully from its call to nxsem_wait().
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *
+ * Assumptions:
+ *   This function may be called from an interrupt handler.
+ *
+ ****************************************************************************/
+
+int nxsem_post(FAR sem_t *sem)
+{
+  DEBUGASSERT(sem != NULL);
+
+  /* If this is a mutex, we can try to unlock the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)
+  if (sem->flags & SEM_TYPE_MUTEX)
+    {
+      short old = 0;
+      if (atomic_compare_exchange_weak_explicit(NXSEM_COUNT(sem), &old, 1,

Review Comment:
   let us wrapper inline function named nxsem_post_fast
   
   https://github.com/torvalds/linux/blob/master/kernel/locking/mutex.c#L177-L182



##########
sched/semaphore/sem_destroy.c:
##########
@@ -72,10 +74,18 @@ int nxsem_destroy(FAR sem_t *sem)
    * leave the count unchanged but still return OK.
    */
 
-  if (sem->semcount >= 0)
+  do
     {
-      sem->semcount = 1;

Review Comment:
   I think this PR should be split to two, one is replace semaphore count type to atomic, another one is fast mutex



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812531878


##########
sched/semaphore/sem_post.c:
##########
@@ -217,3 +214,60 @@ int nxsem_post(FAR sem_t *sem)
 
   return OK;
 }
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_post
+ *
+ * Description:
+ *   When a kernel thread has finished with a semaphore, it will call
+ *   nxsem_post().  This function unlocks the semaphore referenced by sem
+ *   by performing the semaphore unlock operation on that semaphore.
+ *
+ *   If the semaphore value resulting from this operation is positive, then
+ *   no tasks were blocked waiting for the semaphore to become unlocked; the
+ *   semaphore is simply incremented.
+ *
+ *   If the value of the semaphore resulting from this operation is zero,
+ *   then one of the tasks blocked waiting for the semaphore shall be
+ *   allowed to return successfully from its call to nxsem_wait().
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *
+ * Assumptions:
+ *   This function may be called from an interrupt handler.
+ *
+ ****************************************************************************/
+
+int nxsem_post(FAR sem_t *sem)
+{
+  DEBUGASSERT(sem != NULL);
+
+  /* If this is a mutex, we can try to unlock the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)
+  if (sem->flags & SEM_TYPE_MUTEX)

Review Comment:
   If the atomic operation for count is implemented in the lib mutex, when mutex_lock is called, it may exit early due to fast_lock, which can result in the sem->count value not being updated. This, in turn, can cause mutex_unlock to fail.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2453964517

   @tmedicci Could you please help test if this patch #14625  can fix the issue? Thanks.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812561451


##########
sched/semaphore/semaphore.h:
##########
@@ -31,10 +31,17 @@
 #include <nuttx/compiler.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/sched.h>
+#include <nuttx/atomic.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount)

Review Comment:
   In c code, the type of atomic_short is always short.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812583298


##########
sched/semaphore/semaphore.h:
##########
@@ -31,10 +31,17 @@
 #include <nuttx/compiler.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/sched.h>
+#include <nuttx/atomic.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount)

Review Comment:
   Yes but my point is, is short guaranteed to be atomic without locking ? atomic_short can be forwarded to stdatomic which can use locks to implement the read-modify-write. On some architectures only the natural datawidth can be handled atomically by the hardware.
   
   So should we use u64 as semcount for u64 architectures, u32 for u32 architectures etc?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "yamt (via GitHub)" <gi...@apache.org>.
yamt commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1839502661


##########
sched/semaphore/sem_post.c:
##########
@@ -78,21 +78,20 @@ int nxsem_post(FAR sem_t *sem)
   uint8_t proto;
 #endif
 
-  DEBUGASSERT(sem != NULL);
-
   /* The following operations must be performed with interrupts
    * disabled because sem_post() may be called from an interrupt
    * handler.
    */
 
   flags = enter_critical_section();
 
-  sem_count = sem->semcount;
+  sem_count = atomic_fetch_add(NXSEM_COUNT(sem), 1);
 
   /* Check the maximum allowable value */
 
   if (sem_count >= SEM_VALUE_MAX)
     {

Review Comment:
   i guess it's safer to use compare xchg.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "chirping78 (via GitHub)" <gi...@apache.org>.
chirping78 commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2476403424

   
      
   
   Using JTAG to single step through the `nxsem_wait` function, it shows that it's not an alignment issue, but the `s32c1i` instruction caused the exception.
   
   ```
      0x400f0468 <+196>:   or      a14, a13, a9
      0x400f046b <+199>:   or      a8, a9, a9
      0x400f046e <+202>:   wsr.scompare1   a14
   => 0x400f0471 <+205>:   s32c1i  a8, a12, 0
      0x400f0474 <+208>:   beq     a8, a14, 0x400f0480 <nxsem_wait+220>
      0x400f0477 <+211>:   or      a14, a9, a9
      0x400f047a <+214>:   and     a9, a8, a11
      0x400f047d <+217>:   bne     a14, a9, 0x400f0468 <nxsem_wait+196>
   ```
      
   At this point, the register values are as expection:
   
   ```
   (gdb) p/x $a14
   $3 = 0x40001
   (gdb) p/x $a12
   $4 = 0x40085fd0
   (gdb) p/x $a8
   $5 = 0x40000
   ```
   The sem value is `1`, and here the code wants to write `0` to it.
   
   But the problem might be that the iram is not compatiable with `s32c1i` instruction. 
   @tmedicci  you may need to check this with the IC designer.
   
   It this is the case, one solution might be: 
   - in `esp32_iramheap_initialize`, not directly use `mm_initialize`, since `mm_initialize` will put the memory manager struct to the memory header, i.e. a sem will be in iram;
   - but allocate the memory manager struct from another data heap, such as `Umem`, then use that memory manager struct to manage iram heap.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812161905


##########
sched/semaphore/semaphore.h:
##########
@@ -31,10 +31,17 @@
 #include <nuttx/compiler.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/sched.h>
+#include <nuttx/atomic.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount)

Review Comment:
   Should semcount be atomic_short to begin with ?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "nuttxpr (via GitHub)" <gi...@apache.org>.
nuttxpr commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2430640628

   [**\[Experimental Bot, please feedback here\]**](https://github.com/search?q=repo%3Aapache%2Fnuttx+13552&type=issues)
   
   
   
   The PR summary is somewhat informative, but the rest of the information is insufficient to determine if it meets NuttX requirements.  Here's a breakdown:
   
   **What's Good:**
   
   * **Summary:**  Clearly states the technical changes made. The performance improvement mentioned is a good addition.
   * **Testing:** Mentions specific boards used for testing.
   
   **What's Missing:**
   
   * **Summary:**
       *  **Why?**  No explanation of the problem the PR solves. Why were the original semaphore operations slow?  Why is atomicity important in this context?
       * **Issue reference:** Is there a related NuttX issue? 
   * **Impact:**
       * **User Impact:**  While the summary mentions semaphore changes, it doesn't explain if users need to adapt their code. Will existing semaphore usage still work correctly?
       * **Other Impacts:** The PR lacks details about potential impacts on build systems, hardware, documentation, security, and compatibility.
   * **Testing:**
       * **Incomplete Information:** The PR needs to specify the host operating system, CPU architecture, and compiler used for testing. 
       * **Vague Descriptions:** "bes board with monkey test pass" and "sabre-6quad:smp with ostest pass" are too vague. Provide specific details about the tests performed and what "pass" means in each context. 
       * **Missing Logs:**  The PR should include actual testing logs from before and after the changes, as the template requests. 
   
   **Conclusion:**
   
   The PR needs significant improvements to meet NuttX requirements.  It needs to be more descriptive, particularly in the "Impact" section and provide specific evidence of testing. 
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812161905


##########
sched/semaphore/semaphore.h:
##########
@@ -31,10 +31,17 @@
 #include <nuttx/compiler.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/sched.h>
+#include <nuttx/atomic.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount)

Review Comment:
   Should semcount be atomic_short to begin with ? What happens if the compiler / architecture cannot handle datatypes that are not of natural width atomically without locking ?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2451477049

   @tmedicci We cannot reproduce this issue with other boards and qemu, and we also do not have an ESP32 board. Could you provide the ELF file, or could you help debug using J-Link to gather more information? Thanks.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2452092699

   > @tmedicci We cannot reproduce this issue with other boards and qemu which use xtensa arch, and we also do not have an ESP32 board. Could you provide the ELF file, or could you help debug using J-Link to gather more information? Thanks.
   
   Hi! Of course, check the backtrace using the J-Link:
   
   ```
   #0  nxsem_wait (sem=0x40086140) at semaphore/sem_wait.c:263
   #1  0x400e3e0a in nxmutex_lock (mutex=0x40086140) at misc/lib_mutex.c:253
   #2  0x400e54b4 in mm_lock (heap=0x40086140) at mm_heap/mm_lock.c:97
   #3  0x400e5330 in mm_addregion (heap=0x40086140, heapstart=0x400862b8, heapsize=105800)
       at mm_heap/mm_initialize.c:112
   #4  0x400e5471 in mm_initialize (name=<optimized out>, heapstart=0x400862b8, heapsize=105800)
       at mm_heap/mm_initialize.c:287
   #5  0x400e64b9 in esp32_iramheap_initialize () at chip/esp32_iramheap.c:62
   #6  0x400e64a1 in up_extraheaps_init () at chip/esp32_extraheaps.c:66
   #7  0x400e1b6a in nx_start () at init/nx_start.c:603
   #8  0x4008291a in __esp32_start () at chip/esp32_start.c:293
   #9  __start () at chip/esp32_start.c:358
   ```
   
   It fails to run `atomic_compare_exchange_weak_explicit` when adding the IRAM heap. Pay attention that this heap region is accessible through the instruction bus and any non-word-aligned access would trigger an exception. If the exception triggers, it's treated [here](https://github.com/apache/incubator-nuttx/blob/18718316dcddd93b0326da977acdabd9207f73b4/arch/xtensa/src/esp32/esp32_user.c#L352) and the execution is supposed to return from the moment it was firstly triggered. This function, somehow, makes this mechanism break.
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812582686


##########
sched/semaphore/sem_wait.c:
##########
@@ -224,6 +213,65 @@ int nxsem_wait(FAR sem_t *sem)
   return ret;
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_wait
+ *
+ * Description:
+ *   This function attempts to lock the semaphore referenced by 'sem'.  If
+ *   the semaphore value is (<=) zero, then the calling task will not return
+ *   until it successfully acquires the lock.
+ *
+ *   This is an internal OS interface.  It is functionally equivalent to
+ *   sem_wait except that:
+ *
+ *   - It is not a cancellation point, and
+ *   - It does not modify the errno value.
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor.
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *   Possible returned errors:
+ *
+ *   - EINVAL:  Invalid attempt to get the semaphore
+ *   - EINTR:   The wait was interrupted by the receipt of a signal.
+ *
+ ****************************************************************************/
+
+int nxsem_wait(FAR sem_t *sem)
+{
+  /* This API should not be called from interrupt handlers & idleloop */
+
+  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
+  DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
+
+  /* If this is a mutex, we can try to get the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)

Review Comment:
   Yes, fast path cannot used when priority inheritance enabled, because holder function need enter critical section



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "yamt (via GitHub)" <gi...@apache.org>.
yamt commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2478034941

   > > But the problem might be that the iram is not compatiable with `s32c1i` instruction. @tmedicci you may need to check this with the IC designer.
   > 
   > @tmedicci Found this statement in "Xtensa ® LX7 MicroprocessorData Book"
   > 
   > ```
   > S32C1I instructions may target cached, cache-bypass, and data RAM memory locations. 
   > S32C1I instructions are not permitted to access memory addresses in data ROM,
   > instruction memory or the address region allocated to the XLMI port. Attempts to direct
   > the S32C1I at these addresses will cause an exception.
   > ```
   
   depending on how the instruction is actually used, it might or might not easy to
   implement enough emulation in the trap handler.
   it might be difficult if the same memory can be modified with non-trapping instruction (s32i) as well.
   maybe someone needs to make a feasibility studf by reading the disassembly of the relevant code.
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2444829110

   > @pussuw should we merge this patch and optimize priority inheritance and semaphore later?
   
   Fine by me


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #14465:
URL: https://github.com/apache/nuttx/pull/14465


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2450804245

   Hi @zyfeier , this PR broke `esp32-devkitc:sotest` . The device can't boot anymore:
   
   ## Steps to reproduce
   
   ```
   make -j distclean && ./tools/configure.sh esp32-devkitc:sotest &&  make -j bootloader &&  make flash EXTRAFLAGS="-Wno-cpp -Werror" ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BINDIR=./ -s -j$(nproc) && minicom -D /dev/ttyUSB0
   ```
   
   Output:
   ```
   rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
   configsip: 0, SPIWP:0xee
   clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
   mode:DIO, clock div:2
   load:0x3ffb20a0,len:3604
   load:0x40080000,len:24576
   entry 0x400827ac
   *** Booting NuttX ***
   I (27) boot: chip revision: v3.0
   I (28) boot.esp32: SPI Speed      : 40MHz
   I (28) boot.esp32: SPI Mode       : DIO
   I (29) boot.esp32: SPI Flash Size : 8MB
   I (33) boot: Enabling RNG early entropy source...
   dram: lma 0x00001020 vma 0x3ffb20a0 len 0xe14    (3604)
   iram: lma 0x00001e3c vma 0x40080000 len 0x6000   (24576)
   padd: lma 0x00007e48 vma 0x00000000 len 0x81b0   (33200)
   imap: lma 0x00010000 vma 0x400e0000 len 0x17804  (96260)
   padd: lma 0x0002780c vma 0x00000000 len 0x880c   (34828)
   dmap: lma 0x00030020 vma 0x3f400020 len 0x7f20   (32544)
   total segments stored 6
   A__esp32_start: ESP32 chip revision is v3.0
   Bxtensa_user_panic: User Exception: EXCCAUSE=0003 task: Idle_Task
   dump_assert_info: Current Version: NuttX  10.4.0 befe29801f Oct 31 2024 17:56:57 xtensa
   dump_assert_info: Assertion failed user panic: at file: common/xtensa_assert.c:180 task: Idle_Task process: Kernel 0x400e15d8
   up_dump_register:    PC: 400f0a59    PS: 00060d30
   up_dump_register:    A0: 800e392d    A1: 3ffb0af0    A2: 40086000    A3: 00040000
   up_dump_register:    A4: 00040000    A5: 40086000    A6: 00040001    A7: 00040001
   up_dump_register:    A8: 00000000    A9: ffff0000   A10: 00000001   A11: 00000000
   up_dump_register:   A12: 3ffb0cc4   A13: 00000000   A14: 00000000   A15: 00000001
   up_dump_register:   SAR: 00000020 CAUSE: 00000003 VADDR: 40086000
   up_dump_register:  LBEG: 400e4f50  LEND: 400e4f5d  LCNT: 00000000
   dump_stacks: ERROR: Stack pointer is not within the stack
   dump_stackinfo: User Stack:
   dump_stackinfo:   base: 0
   dump_stackinfo:   size: 00000000
   stack_dump: 0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE   COMMAND
   ```
   
   The crash's stack call is not useful. Can you please take a look?
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812176461


##########
sched/semaphore/sem_wait.c:
##########
@@ -69,17 +68,12 @@
  *
  ****************************************************************************/
 
-int nxsem_wait(FAR sem_t *sem)
+static int nxsem_wait_slow(FAR sem_t *sem)
 {
   FAR struct tcb_s *rtcb = this_task();
   irqstate_t flags;
   int ret;
 
-  /* This API should not be called from interrupt handlers & idleloop */
-
-  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);

Review Comment:
   Why are these not relevant anymore?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812534128


##########
sched/semaphore/sem_destroy.c:
##########
@@ -72,10 +74,18 @@ int nxsem_destroy(FAR sem_t *sem)
    * leave the count unchanged but still return OK.
    */
 
-  if (sem->semcount >= 0)
+  do
     {
-      sem->semcount = 1;

Review Comment:
   Yes, this patch only optimizes the mutex performance of the kernel, while the performance optimization of the userspace will be implemented in subsequent patches.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812206869


##########
sched/semaphore/sem_destroy.c:
##########
@@ -72,10 +74,18 @@ int nxsem_destroy(FAR sem_t *sem)
    * leave the count unchanged but still return OK.
    */
 
-  if (sem->semcount >= 0)
+  do
     {
-      sem->semcount = 1;

Review Comment:
   If fast mutexes are implemented the implementation should be in user space (i.e. libc) for it to benefit memory protected builds as well. There taking the lock (in our case, semaphore) is a very expensive operation via syscall.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812585535


##########
sched/semaphore/sem_wait.c:
##########
@@ -224,6 +213,65 @@ int nxsem_wait(FAR sem_t *sem)
   return ret;
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsem_wait
+ *
+ * Description:
+ *   This function attempts to lock the semaphore referenced by 'sem'.  If
+ *   the semaphore value is (<=) zero, then the calling task will not return
+ *   until it successfully acquires the lock.
+ *
+ *   This is an internal OS interface.  It is functionally equivalent to
+ *   sem_wait except that:
+ *
+ *   - It is not a cancellation point, and
+ *   - It does not modify the errno value.
+ *
+ * Input Parameters:
+ *   sem - Semaphore descriptor.
+ *
+ * Returned Value:
+ *   This is an internal OS interface and should not be used by applications.
+ *   It follows the NuttX internal error return policy:  Zero (OK) is
+ *   returned on success.  A negated errno value is returned on failure.
+ *   Possible returned errors:
+ *
+ *   - EINVAL:  Invalid attempt to get the semaphore
+ *   - EINTR:   The wait was interrupted by the receipt of a signal.
+ *
+ ****************************************************************************/
+
+int nxsem_wait(FAR sem_t *sem)
+{
+  /* This API should not be called from interrupt handlers & idleloop */
+
+  DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
+  DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());
+
+  /* If this is a mutex, we can try to get the mutex in fast mode,
+   * else try to get it in slow mode.
+   */
+
+#if !defined(CONFIG_PRIORITY_INHERITANCE) && !defined(CONFIG_PRIORITY_PROTECT)

Review Comment:
   For semaphores this is true, as semaphores can have multiple holders, but for mutexes you can set PID atomically without locking / critical section, as mutexes will only have 1 holder.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "pussuw (via GitHub)" <gi...@apache.org>.
pussuw commented on code in PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#discussion_r1812583298


##########
sched/semaphore/semaphore.h:
##########
@@ -31,10 +31,17 @@
 #include <nuttx/compiler.h>
 #include <nuttx/semaphore.h>
 #include <nuttx/sched.h>
+#include <nuttx/atomic.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define NXSEM_COUNT(s) ((FAR atomic_short *)&(s)->semcount)

Review Comment:
   Yes but my point is, is short guaranteed to be atomic without locking ? atomic_short can be forwarded to stdatomic which can use locks to implement the read-modify-write. On some architectures only the natural datawidth can be handled atomically by the hardware.
   
   So should we use u64 as semcount for 64-bit architectures, u32 for 32-bit architectures etc?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2444657762

   @pussuw should we merge this patch and optimize priority inheritance and semaphore later?


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] sem: change sem wait to atomic operation [nuttx]

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2451282738

   > Hi @zyfeier , this PR broke `esp32-devkitc:sotest` . The device can't boot anymore:
   > 
   > ## Steps to reproduce
   > ```
   > make -j distclean && ./tools/configure.sh esp32-devkitc:sotest &&  make -j bootloader &&  make flash EXTRAFLAGS="-Wno-cpp -Werror" ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BINDIR=./ -s -j$(nproc) && minicom -D /dev/ttyUSB0
   > ```
   > 
   > Output:
   > 
   > ```
   > rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
   > configsip: 0, SPIWP:0xee
   > clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
   > mode:DIO, clock div:2
   > load:0x3ffb20a0,len:3604
   > load:0x40080000,len:24576
   > entry 0x400827ac
   > *** Booting NuttX ***
   > I (27) boot: chip revision: v3.0
   > I (28) boot.esp32: SPI Speed      : 40MHz
   > I (28) boot.esp32: SPI Mode       : DIO
   > I (29) boot.esp32: SPI Flash Size : 8MB
   > I (33) boot: Enabling RNG early entropy source...
   > dram: lma 0x00001020 vma 0x3ffb20a0 len 0xe14    (3604)
   > iram: lma 0x00001e3c vma 0x40080000 len 0x6000   (24576)
   > padd: lma 0x00007e48 vma 0x00000000 len 0x81b0   (33200)
   > imap: lma 0x00010000 vma 0x400e0000 len 0x17804  (96260)
   > padd: lma 0x0002780c vma 0x00000000 len 0x880c   (34828)
   > dmap: lma 0x00030020 vma 0x3f400020 len 0x7f20   (32544)
   > total segments stored 6
   > A__esp32_start: ESP32 chip revision is v3.0
   > Bxtensa_user_panic: User Exception: EXCCAUSE=0003 task: Idle_Task
   > dump_assert_info: Current Version: NuttX  10.4.0 befe29801f Oct 31 2024 17:56:57 xtensa
   > dump_assert_info: Assertion failed user panic: at file: common/xtensa_assert.c:180 task: Idle_Task process: Kernel 0x400e15d8
   > up_dump_register:    PC: 400f0a59    PS: 00060d30
   > up_dump_register:    A0: 800e392d    A1: 3ffb0af0    A2: 40086000    A3: 00040000
   > up_dump_register:    A4: 00040000    A5: 40086000    A6: 00040001    A7: 00040001
   > up_dump_register:    A8: 00000000    A9: ffff0000   A10: 00000001   A11: 00000000
   > up_dump_register:   A12: 3ffb0cc4   A13: 00000000   A14: 00000000   A15: 00000001
   > up_dump_register:   SAR: 00000020 CAUSE: 00000003 VADDR: 40086000
   > up_dump_register:  LBEG: 400e4f50  LEND: 400e4f5d  LCNT: 00000000
   > dump_stacks: ERROR: Stack pointer is not within the stack
   > dump_stackinfo: User Stack:
   > dump_stackinfo:   base: 0
   > dump_stackinfo:   size: 00000000
   > stack_dump: 0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
   > dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE   COMMAND
   > ```
   > 
   > The crash's stack call is not useful. Can you please take a look?
   
   OK, I'll check.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org