nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btash...@apache.org
Subject [incubator-nuttx] branch master updated: sched/semaphore/sem_holder.c: Remove DEBUGPANIC
Date Mon, 04 May 2020 14:47:50 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 2d4a876  sched/semaphore/sem_holder.c:  Remove DEBUGPANIC
2d4a876 is described below

commit 2d4a8768c7e2f7737ae2fd5642b80b4cf0374810
Author: Gregory Nutt <gnutt@nuttx.org>
AuthorDate: Mon May 4 07:42:04 2020 -0600

    sched/semaphore/sem_holder.c:  Remove DEBUGPANIC
    
    There is a DEBUGPANIC in some logic.  This happens if a a task exists at certain points
with priority inheritance enabled.  This event was not expected in the original design (although
logic was provided to support it).  Since, apparently, it does happen, the DEBUGPANIC must
be removed.
    
    Noted by Brennan Ashton.
---
 sched/semaphore/sem_holder.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c
index 49a0002..c91ab6a 100644
--- a/sched/semaphore/sem_holder.c
+++ b/sched/semaphore/sem_holder.c
@@ -115,6 +115,11 @@ static inline FAR struct semholder_s *nxsem_allocholder(sem_t *sem)
 
 /****************************************************************************
  * Name: nxsem_findholder
+ *
+ * NOTE: htcb may be used only as a look-up key.  It certain cases, the task
+ * may have exited and htcb may refer to a stale memory.  It must not be
+ * dereferenced.
+ *
  ****************************************************************************/
 
 static FAR struct semholder_s *nxsem_findholder(sem_t *sem,
@@ -323,10 +328,7 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
 
   if (!sched_verifytcb(htcb))
     {
-#if 0  /* DSA: sometimes crashes when Telnet calls external cmd (i.e. 'i2c') */
-      serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
-      DEBUGPANIC();
-#endif
+      swarn("WARNING: TCB 0x%08x is a stale handle, counts lost\n", htcb);
       nxsem_freeholder(sem, pholder);
     }
 
@@ -490,8 +492,8 @@ static int nxsem_restoreholderprio(FAR struct tcb_s *htcb,
 
   if (!sched_verifytcb(htcb))
     {
-      serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
-      DEBUGPANIC();
+      swarn("WARNING: TCB 0x%08x is a stale handle, counts lost\n", htcb);
+
       pholder = nxsem_findholder(sem, htcb);
       if (pholder != NULL)
         {


Mime
View raw message