You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/06/16 23:05:14 UTC

[incubator-nuttx] branch master updated: sched: Avoid call up_initial_state for idle thread twice

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

gnutt 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 56fa98f  sched: Avoid call up_initial_state for idle thread twice
56fa98f is described below

commit 56fa98f3ea803f2a6144414683ca43d9901cad66
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jun 16 21:08:16 2020 +0800

    sched: Avoid call up_initial_state for idle thread twice
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Iaf5d4bcc915fbe842e9356ea6416f0af869ab116
---
 sched/init/nx_smpstart.c | 6 +-----
 sched/init/nx_start.c    | 9 +++++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sched/init/nx_smpstart.c b/sched/init/nx_smpstart.c
index 831dd44..20abe2c 100644
--- a/sched/init/nx_smpstart.c
+++ b/sched/init/nx_smpstart.c
@@ -168,11 +168,7 @@ int nx_smp_start(void)
           return ret;
         }
 
-      /* Reinitialize the processor-specific portion of the TCB.  This is
-       * the second time this has been called for this CPU, but the stack
-       * was not yet initialized on the first call so we need to do it
-       * again.
-       */
+      /* Initialize the processor-specific portion of the TCB */
 
       up_initial_state(tcb);
     }
diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index b1c4d46..d4dff07 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -528,9 +528,14 @@ void nx_start(void)
 
       g_running_tasks[cpu] = &g_idletcb[cpu].cmn;
 
-      /* Initialize the processor-specific portion of the TCB */
+      /* Initialize the 1st processor-specific portion of the TCB
+       * Note: other idle thread get initialized in nx_smpstart
+       */
 
-      up_initial_state(&g_idletcb[cpu].cmn);
+      if (cpu == 0)
+        {
+          up_initial_state(&g_idletcb[cpu].cmn);
+        }
     }
 
   /* Task lists are initialized */