You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/03 10:17:27 UTC

[nuttx] branch master updated (b10d6be17a -> f2dc9402f6)

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

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


    from b10d6be17a net:Add check for address binding
     new 9b6e5f22f9 assert: thread assert don't interrupt by IRQ
     new ef48dec9f9 assert: Stop scheduling when an assert is invoked to prevent running task change
     new bfab486611 assert: add panic notifier data for notify more information
     new 3aa2aa4703 assert: add more information to panic notifier
     new f2dc9402f6 assert: Remove unnecessary disable interrupts code

The 5 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:
 include/assert.h               |  4 ----
 include/nuttx/panic_notifier.h | 12 ++++++++++++
 sched/misc/assert.c            | 38 ++++++++++++++++++++++----------------
 3 files changed, 34 insertions(+), 20 deletions(-)


[nuttx] 05/05: assert: Remove unnecessary disable interrupts code

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

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

commit f2dc9402f695f8cb6f6023f6b1f1885d8137cac5
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Mon Jun 19 14:54:10 2023 +0800

    assert: Remove unnecessary disable interrupts code
    
    Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
 sched/misc/assert.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 478f42beef..1cbe45aef7 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -672,16 +672,6 @@ void _assert(FAR const char *filename, int linenum,
 #if CONFIG_BOARD_RESET_ON_ASSERT >= 1
       board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE);
 #else
-      /* Disable interrupts on this CPU */
-
-      up_irq_save();
-
-#  ifdef CONFIG_SMP
-      /* Try (again) to stop activity on other CPUs */
-
-      spin_trylock(&g_cpu_irqlock);
-#  endif
-
       for (; ; )
         {
           up_mdelay(250);


[nuttx] 02/05: assert: Stop scheduling when an assert is invoked to prevent running task change

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

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

commit ef48dec9f9251a231a2bfc3a99c280058756a733
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Thu Jun 15 10:34:41 2023 +0800

    assert: Stop scheduling when an assert is invoked to prevent running task change
    
    Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
 sched/misc/assert.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 8c29e471eb..ac17b3460b 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -559,6 +559,8 @@ void _assert(FAR const char *filename, int linenum,
 
   flags = enter_critical_section();
 
+  sched_lock();
+
   /* try to save current context if regs is null */
 
   if (regs == NULL)
@@ -680,5 +682,7 @@ void _assert(FAR const char *filename, int linenum,
 #endif
     }
 
+  sched_unlock();
+
   leave_critical_section(flags);
 }


[nuttx] 01/05: assert: thread assert don't interrupt by IRQ

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

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

commit 9b6e5f22f95b4fd7fa108ab061dc548f163c735e
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Jun 12 13:25:49 2023 +0800

    assert: thread assert don't interrupt by IRQ
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 sched/misc/assert.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 357ad7b814..8c29e471eb 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -555,6 +555,9 @@ void _assert(FAR const char *filename, int linenum,
   FAR struct tcb_s *rtcb = running_task();
   struct utsname name;
   bool fatal = true;
+  int flags;
+
+  flags = enter_critical_section();
 
   /* try to save current context if regs is null */
 
@@ -676,4 +679,6 @@ void _assert(FAR const char *filename, int linenum,
         }
 #endif
     }
+
+  leave_critical_section(flags);
 }


[nuttx] 03/05: assert: add panic notifier data for notify more information

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

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

commit bfab486611fb9dba2efcab3262ace9f281876521
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Thu Jun 15 11:12:58 2023 +0800

    assert: add panic notifier data for notify more information
    
    Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
 include/assert.h               | 4 ----
 include/nuttx/panic_notifier.h | 9 +++++++++
 sched/misc/assert.c            | 8 ++++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/assert.h b/include/assert.h
index 8cd1fa3531..6a2d8bca34 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -140,10 +140,6 @@
 
 #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
 
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
diff --git a/include/nuttx/panic_notifier.h b/include/nuttx/panic_notifier.h
index 2e6553d2ef..525e68dd4f 100644
--- a/include/nuttx/panic_notifier.h
+++ b/include/nuttx/panic_notifier.h
@@ -27,6 +27,7 @@
 
 #include <nuttx/config.h>
 #include <nuttx/notifier.h>
+#include <nuttx/sched.h>
 
 #include <sys/types.h>
 
@@ -41,6 +42,14 @@ enum panic_type_e
   PANIC_KERNEL_FINAL   =  2,
 };
 
+/* Notifier data for panic */
+
+struct panic_notifier_s
+{
+  FAR struct tcb_s  *rtcb;
+  FAR void          *regs;
+};
+
 /****************************************************************************
  * Public Function
  ****************************************************************************/
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index ac17b3460b..74c1c231b1 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -553,6 +553,7 @@ void _assert(FAR const char *filename, int linenum,
              FAR const char *msg, FAR void *regs)
 {
   FAR struct tcb_s *rtcb = running_task();
+  struct panic_notifier_s notifier_data;
   struct utsname name;
   bool fatal = true;
   int flags;
@@ -581,7 +582,10 @@ void _assert(FAR const char *filename, int linenum,
     }
 #endif
 
-  panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK, rtcb);
+  notifier_data.rtcb = rtcb;
+  notifier_data.regs = regs;
+  panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK,
+                            &notifier_data);
 
   uname(&name);
   _alert("Current Version: %s %s %s %s %s\n",
@@ -658,7 +662,7 @@ void _assert(FAR const char *filename, int linenum,
       /* Flush any buffered SYSLOG data */
 
       syslog_flush();
-      panic_notifier_call_chain(PANIC_KERNEL_FINAL, rtcb);
+      panic_notifier_call_chain(PANIC_KERNEL_FINAL, &notifier_data);
 
       reboot_notifier_call_chain(SYS_HALT, NULL);
 


[nuttx] 04/05: assert: add more information to panic notifier

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

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

commit 3aa2aa4703b95dbc7fe2287ff755e3b5e3d752d9
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Sat Jun 17 09:29:42 2023 +0800

    assert: add more information to panic notifier
    
    Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
 include/nuttx/panic_notifier.h |  7 +++++--
 sched/misc/assert.c            | 11 +++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/nuttx/panic_notifier.h b/include/nuttx/panic_notifier.h
index 525e68dd4f..a3679d9c49 100644
--- a/include/nuttx/panic_notifier.h
+++ b/include/nuttx/panic_notifier.h
@@ -46,8 +46,11 @@ enum panic_type_e
 
 struct panic_notifier_s
 {
-  FAR struct tcb_s  *rtcb;
-  FAR void          *regs;
+  FAR struct tcb_s *rtcb;
+  FAR void         *regs;
+  FAR const char   *msg;
+  FAR const char   *filename;
+  int               linenum;
 };
 
 /****************************************************************************
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 74c1c231b1..478f42beef 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -570,10 +570,6 @@ void _assert(FAR const char *filename, int linenum,
       regs = g_last_regs;
     }
 
-  /* Flush any buffered SYSLOG data (from prior to the assertion) */
-
-  syslog_flush();
-
 #if CONFIG_BOARD_RESET_ON_ASSERT < 2
   if (!up_interrupt_context() &&
       (rtcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
@@ -584,9 +580,16 @@ void _assert(FAR const char *filename, int linenum,
 
   notifier_data.rtcb = rtcb;
   notifier_data.regs = regs;
+  notifier_data.filename = filename;
+  notifier_data.linenum = linenum;
+  notifier_data.msg = msg;
   panic_notifier_call_chain(fatal ? PANIC_KERNEL : PANIC_TASK,
                             &notifier_data);
 
+  /* Flush any buffered SYSLOG data (from prior to the assertion) */
+
+  syslog_flush();
+
   uname(&name);
   _alert("Current Version: %s %s %s %s %s\n",
          name.sysname, name.nodename,