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 2021/04/20 02:46:46 UTC

[incubator-nuttx] branch master updated: smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE

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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a9e7ef  smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE
1a9e7ef is described below

commit 1a9e7efde521c23d69f268871ae0e3b6102b484b
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue Apr 20 06:47:11 2021 +0900

    smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE
    
    Summary:
    - The CONFIG_SMP_IDLETHREAD_STACKSIZE was introduced to optimize
      the idle stack size for other than CPU0
    - However, there are no big differences between the idle stacks.
    - This commit removes the config to simplify the kernel code
    
    Impact:
    - All SMP configurations
    
    Testing:
    - Tested with ostest with the following configs
    - spresense:smp, spresense:rndis_smp
    - esp32-devkitc:smp (QEMU), maix-bit:smp (QEMU)
    - sabre-6quad:smp (QEMU), sabre-6quad:netnsh_smp (QEMU)
    - raspberrypi-pico:smp, sim:smp (x86_64)
    
    Signed-off-by: Masayuki Ishikawa <as...@jp.sony.com>
---
 .../platforms/xtensa/esp32/boards/esp32-devkitc/index.rst      |  2 --
 Documentation/platforms/xtensa/esp32/index.rst                 |  1 -
 arch/arm/src/armv7-a/smp.h                                     |  2 +-
 arch/risc-v/src/k210/k210_cpuidlestack.c                       |  2 +-
 arch/sim/src/sim/up_cpuidlestack.c                             |  2 +-
 arch/xtensa/src/esp32/esp32_cpuidlestack.c                     |  2 +-
 arch/xtensa/src/esp32/esp32_smp.h                              | 10 +++++-----
 boards/arm/cxd56xx/spresense/configs/rndis_smp/defconfig       |  1 -
 boards/arm/imx6/sabre-6quad/README.txt                         |  1 -
 boards/arm/imx6/sabre-6quad/configs/netnsh_smp/defconfig       |  1 -
 boards/sim/sim/sim/README.txt                                  |  1 -
 boards/xtensa/esp32/esp32-devkitc/configs/smp/defconfig        |  1 -
 include/nuttx/arch.h                                           |  2 +-
 sched/Kconfig                                                  |  9 ---------
 sched/init/nx_smpstart.c                                       |  2 +-
 15 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst b/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst
index 97db6b1..cb7a113 100644
--- a/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst
+++ b/Documentation/platforms/xtensa/esp32/boards/esp32-devkitc/index.rst
@@ -163,7 +163,6 @@ additional settings:
 SMP is enabled::
 
   CONFIG_SMP=y
-  CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
   CONFIG_SMP_NCPUS=2
   CONFIG_SPINLOCK=y
 
@@ -182,7 +181,6 @@ architecture ports to assure a correct implementation of the OS.  The default
 version is for a single CPU but can be modified for an SMP test by adding::
 
   CONFIG_SMP=y
-  CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
   CONFIG_SMP_NCPUS=2
   CONFIG_SPINLOCK=y
 
diff --git a/Documentation/platforms/xtensa/esp32/index.rst b/Documentation/platforms/xtensa/esp32/index.rst
index 14dfad0..6124430 100644
--- a/Documentation/platforms/xtensa/esp32/index.rst
+++ b/Documentation/platforms/xtensa/esp32/index.rst
@@ -258,7 +258,6 @@ in :menuselection:`RTOS Features --> Tasks and Scheduling`, with::
     CONFIG_SPINLOCK=y
     CONFIG_SMP=y
     CONFIG_SMP_NCPUS=2
-    CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
 
 Debug Tip:  During debug session, OpenOCD may mysteriously switch from one
 CPU to another.  This behavior can be eliminated by uncommenting one of the
diff --git a/arch/arm/src/armv7-a/smp.h b/arch/arm/src/armv7-a/smp.h
index c4e86b2..4c530ba 100644
--- a/arch/arm/src/armv7-a/smp.h
+++ b/arch/arm/src/armv7-a/smp.h
@@ -40,7 +40,7 @@
 
 #define SMP_STACK_ALIGNMENT  8
 #define SMP_STACK_MASK       7
-#define SMP_STACK_SIZE       ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
+#define SMP_STACK_SIZE       ((CONFIG_IDLETHREAD_STACKSIZE + 7) & ~7)
 #define SMP_STACK_WORDS      (SMP_STACK_SIZE >> 2)
 
 /****************************************************************************
diff --git a/arch/risc-v/src/k210/k210_cpuidlestack.c b/arch/risc-v/src/k210/k210_cpuidlestack.c
index fa86480..bb6901e 100644
--- a/arch/risc-v/src/k210/k210_cpuidlestack.c
+++ b/arch/risc-v/src/k210/k210_cpuidlestack.c
@@ -35,7 +35,7 @@
 #ifdef CONFIG_SMP
 
 #define SMP_STACK_MASK       7
-#define SMP_STACK_SIZE       ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
+#define SMP_STACK_SIZE       ((CONFIG_IDLETHREAD_STACKSIZE + 7) & ~7)
 #define STACK_ISALIGNED(a)   ((uintptr_t)(a) & ~SMP_STACK_MASK)
 
 #if CONFIG_SMP_NCPUS > 1
diff --git a/arch/sim/src/sim/up_cpuidlestack.c b/arch/sim/src/sim/up_cpuidlestack.c
index ce9e7c1..981fbc9 100644
--- a/arch/sim/src/sim/up_cpuidlestack.c
+++ b/arch/sim/src/sim/up_cpuidlestack.c
@@ -72,7 +72,7 @@
  *   - tcb:         The TCB of new CPU IDLE task
  *   - stack_size:  The requested stack size for the IDLE task.  At least
  *                  this much must be allocated.  This should be
- *                  CONFIG_SMP_IDLETHREAD_STACKSIZE.
+ *                  CONFIG_IDLETHREAD_STACKSIZE.
  *
  ****************************************************************************/
 
diff --git a/arch/xtensa/src/esp32/esp32_cpuidlestack.c b/arch/xtensa/src/esp32/esp32_cpuidlestack.c
index a12d774..f5c14d5 100644
--- a/arch/xtensa/src/esp32/esp32_cpuidlestack.c
+++ b/arch/xtensa/src/esp32/esp32_cpuidlestack.c
@@ -82,7 +82,7 @@ uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS]
  *   - tcb:         The TCB of new CPU IDLE task
  *   - stack_size:  The requested stack size for the IDLE task.  At least
  *                  this much must be allocated.  This should be
- *                  CONFIG_SMP_IDLETHREAD_STACKSIZE.
+ *                  CONFIG_IDLETHREAD_STACKSIZE.
  *
  ****************************************************************************/
 
diff --git a/arch/xtensa/src/esp32/esp32_smp.h b/arch/xtensa/src/esp32/esp32_smp.h
index 08da8b8..dbb9ccd 100644
--- a/arch/xtensa/src/esp32/esp32_smp.h
+++ b/arch/xtensa/src/esp32/esp32_smp.h
@@ -35,13 +35,13 @@
 
 /* An IDLE thread stack size for CPU0 must be defined */
 
-#if !defined(CONFIG_SMP_IDLETHREAD_STACKSIZE)
-#  error CONFIG_SMP_IDLETHREAD_STACKSIZE is not defined
-#elif CONFIG_SMP_IDLETHREAD_STACKSIZE < 16
-#  error CONFIG_SMP_IDLETHREAD_STACKSIZE is to small
+#if !defined(CONFIG_IDLETHREAD_STACKSIZE)
+#  error CONFIG_IDLETHREAD_STACKSIZE is not defined
+#elif CONFIG_IDLETHREAD_STACKSIZE < 16
+#  error CONFIG_IDLETHREAD_STACKSIZE is to small
 #endif
 
-#define CPU1_IDLETHREAD_STACKSIZE ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 15) & ~15)
+#define CPU1_IDLETHREAD_STACKSIZE ((CONFIG_IDLETHREAD_STACKSIZE + 15) & ~15)
 #define CPU1_IDLETHREAD_STACKWORDS (CPU1_IDLETHREAD_STACKSIZE >> 2)
 
 /****************************************************************************
diff --git a/boards/arm/cxd56xx/spresense/configs/rndis_smp/defconfig b/boards/arm/cxd56xx/spresense/configs/rndis_smp/defconfig
index 0b179bd..ca1edd5 100644
--- a/boards/arm/cxd56xx/spresense/configs/rndis_smp/defconfig
+++ b/boards/arm/cxd56xx/spresense/configs/rndis_smp/defconfig
@@ -137,7 +137,6 @@ CONFIG_SMARTFS_ALIGNED_ACCESS=y
 CONFIG_SMARTFS_MAXNAMLEN=30
 CONFIG_SMARTFS_MULTI_ROOT_DIRS=y
 CONFIG_SMP=y
-CONFIG_SMP_IDLETHREAD_STACKSIZE=1024
 CONFIG_SMP_NCPUS=2
 CONFIG_SPI=y
 CONFIG_SPRESENSE_EXTENSION=y
diff --git a/boards/arm/imx6/sabre-6quad/README.txt b/boards/arm/imx6/sabre-6quad/README.txt
index 0157104..e0cfea0 100644
--- a/boards/arm/imx6/sabre-6quad/README.txt
+++ b/boards/arm/imx6/sabre-6quad/README.txt
@@ -711,7 +711,6 @@ be enabled with the following configuration settings:
     CONFIG_SPINLOCK=y
     CONFIG_SMP=y
     CONFIG_SMP_NCPUS=4
-    CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
 
 Open Issues:
 
diff --git a/boards/arm/imx6/sabre-6quad/configs/netnsh_smp/defconfig b/boards/arm/imx6/sabre-6quad/configs/netnsh_smp/defconfig
index 3fd87d5..d971874 100644
--- a/boards/arm/imx6/sabre-6quad/configs/netnsh_smp/defconfig
+++ b/boards/arm/imx6/sabre-6quad/configs/netnsh_smp/defconfig
@@ -75,7 +75,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SMP=y
-CONFIG_SMP_IDLETHREAD_STACKSIZE=1024
 CONFIG_STACK_COLORATION=y
 CONFIG_START_DAY=8
 CONFIG_START_MONTH=3
diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt
index 69388d0..51520cb 100644
--- a/boards/sim/sim/sim/README.txt
+++ b/boards/sim/sim/sim/README.txt
@@ -315,7 +315,6 @@ SMP
     +CONFIG_SPINLOCK=y
     +CONFIG_SMP=y
     +CONFIG_SMP_NCPUS=2
-    +CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
 
   You also must enable near-realtime-performance otherwise even long timeouts
   will expire before a CPU thread even has a chance to execute.
diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/smp/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/smp/defconfig
index 32dec99..d3cf21c 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/smp/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/smp/defconfig
@@ -41,7 +41,6 @@ CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_RR_INTERVAL=200
 CONFIG_SDCLONE_DISABLE=y
 CONFIG_SMP=y
-CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
 CONFIG_SMP_NCPUS=2
 CONFIG_SPI=y
 CONFIG_START_DAY=6
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index f9e5bda..d8abee4 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -1871,7 +1871,7 @@ int up_cpu_index(void);
  *   - tcb:         The TCB of new CPU IDLE task
  *   - stack_size:  The requested stack size for the IDLE task.  At least
  *                  this much must be allocated.  This should be
- *                  CONFIG_SMP_IDLETHREAD_STACKSIZE.
+ *                  CONFIG_IDLETHREAD_STACKSIZE.
  *
  ****************************************************************************/
 
diff --git a/sched/Kconfig b/sched/Kconfig
index 2025a40..65b2a5c 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -291,15 +291,6 @@ config SMP_NCPUS
 		SMP configuration.  However, running the SMP logic in a single CPU
 		configuration is useful during certain testing.
 
-config SMP_IDLETHREAD_STACKSIZE
-	int "CPU IDLE stack size"
-	default DEFAULT_TASK_STACKSIZE
-	---help---
-		Each CPU will have its own IDLE task.  System initialization occurs
-		on CPU0 and uses CONFIG_IDLETHREAD_STACKSIZE which will probably be
-		larger than is generally needed.  This setting provides the stack
-		size for the IDLE task on CPUS 1 through (CONFIG_SMP_NCPUS-1).
-
 endif # SMP
 
 choice
diff --git a/sched/init/nx_smpstart.c b/sched/init/nx_smpstart.c
index 39b8f58..ae45a07 100644
--- a/sched/init/nx_smpstart.c
+++ b/sched/init/nx_smpstart.c
@@ -120,7 +120,7 @@ int nx_smp_start(void)
       FAR struct tcb_s *tcb = current_task(cpu);
       DEBUGASSERT(tcb != NULL);
 
-      ret = up_cpu_idlestack(cpu, tcb, CONFIG_SMP_IDLETHREAD_STACKSIZE);
+      ret = up_cpu_idlestack(cpu, tcb, CONFIG_IDLETHREAD_STACKSIZE);
       if (ret < 0)
         {
           serr("ERROR: Failed to allocate stack for CPU%d\n", cpu);