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

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

commit 20b357abde74917aaae580f3e1786054b3d38555
Author: yinshengkai <[email protected]>
AuthorDate: Thu Jan 11 11:35:27 2024 +0800

    assert: pause all other CPUs when assert
    
    Signed-off-by: yinshengkai <[email protected]>
---
 sched/misc/assert.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 6d17472b6e..ea0910046e 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -522,6 +522,25 @@ static void dump_deadlock(void)
 }
 #endif
 
+/****************************************************************************
+ * Name: pause_all_cpu
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+static void pause_all_cpu(void)
+{
+  int cpu;
+
+  for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
+    {
+      if (cpu != this_cpu())
+        {
+          up_cpu_pause(cpu);
+        }
+    }
+}
+#endif
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -556,6 +575,13 @@ void _assert(FAR const char *filename, int linenum,
       goto reset;
     }
 
+  if (fatal)
+    {
+#ifdef CONFIG_SMP
+      pause_all_cpu();
+#endif
+    }
+
   /* try to save current context if regs is null */
 
   if (regs == NULL)

Reply via email to