anchao commented on code in PR #17337:
URL: https://github.com/apache/nuttx/pull/17337#discussion_r2533006127
##########
sched/init/nx_start.c:
##########
@@ -75,6 +75,146 @@
* Public Data
****************************************************************************/
+/* This is an array of task control block (TCB) for the IDLE thread of each
+ * CPU. For the non-SMP case, this is a a single TCB; For the SMP case,
+ * there is one TCB per CPU. NOTE: The system boots on CPU0 into the IDLE
+ * task. The IDLE task later starts the other CPUs and spawns the user
+ * initialization task. That user initialization task is responsible for
+ * bringing up the rest of the system.
+ */
+
+struct tcb_s g_idletcb[CONFIG_SMP_NCPUS] =
+{
+ {
+ .pid = 0,
+ .task_state = TSTATE_TASK_RUNNING,
+ .lockcount = 1,
+ .start = nx_start,
+ .entry.main = (main_t)nx_start,
+#if defined(CONFIG_SMP)
+ .flags = (TCB_FLAG_TTYPE_KERNEL | TCB_FLAG_CPU_LOCKED),
+ .affinity = (CONFIG_SMP_DEFAULT_CPUSET & SCHED_ALL_CPUS),
+#else
+ .flags = TCB_FLAG_TTYPE_KERNEL,
+#endif
+#if CONFIG_TASK_NAME_SIZE > 0
+ #if !defined(CONFIG_SMP)
+ .name = "Idle_Task",
+ #else
+ .name = "CPU0 IDLE",
+ #endif
+#endif
+ },
+#if CONFIG_SMP_NCPUS > 1
Review Comment:
The previous code did not limit the number of SMP cores. If the intention is
to improve SMP initialization speed, I don't think the functionality should be
degraded. We could try using input macros to implement multiple instance
definitions.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]