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 <asayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2021-04-20 06:47:11 +09:00 committed by Xiang Xiao
parent f8e800765c
commit 1a9e7efde5
15 changed files with 11 additions and 28 deletions

View File

@ -163,7 +163,6 @@ additional settings:
SMP is enabled:: SMP is enabled::
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
CONFIG_SMP_NCPUS=2 CONFIG_SMP_NCPUS=2
CONFIG_SPINLOCK=y 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:: version is for a single CPU but can be modified for an SMP test by adding::
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
CONFIG_SMP_NCPUS=2 CONFIG_SMP_NCPUS=2
CONFIG_SPINLOCK=y CONFIG_SPINLOCK=y

View File

@ -258,7 +258,6 @@ in :menuselection:`RTOS Features --> Tasks and Scheduling`, with::
CONFIG_SPINLOCK=y CONFIG_SPINLOCK=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_NCPUS=2 CONFIG_SMP_NCPUS=2
CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
Debug Tip: During debug session, OpenOCD may mysteriously switch from one Debug Tip: During debug session, OpenOCD may mysteriously switch from one
CPU to another. This behavior can be eliminated by uncommenting one of the CPU to another. This behavior can be eliminated by uncommenting one of the

View File

@ -40,7 +40,7 @@
#define SMP_STACK_ALIGNMENT 8 #define SMP_STACK_ALIGNMENT 8
#define SMP_STACK_MASK 7 #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) #define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
/**************************************************************************** /****************************************************************************

View File

@ -35,7 +35,7 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define SMP_STACK_MASK 7 #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) #define STACK_ISALIGNED(a) ((uintptr_t)(a) & ~SMP_STACK_MASK)
#if CONFIG_SMP_NCPUS > 1 #if CONFIG_SMP_NCPUS > 1

View File

@ -72,7 +72,7 @@
* - tcb: The TCB of new CPU IDLE task * - tcb: The TCB of new CPU IDLE task
* - stack_size: The requested stack size for the IDLE task. At least * - stack_size: The requested stack size for the IDLE task. At least
* this much must be allocated. This should be * this much must be allocated. This should be
* CONFIG_SMP_IDLETHREAD_STACKSIZE. * CONFIG_IDLETHREAD_STACKSIZE.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -82,7 +82,7 @@ uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS]
* - tcb: The TCB of new CPU IDLE task * - tcb: The TCB of new CPU IDLE task
* - stack_size: The requested stack size for the IDLE task. At least * - stack_size: The requested stack size for the IDLE task. At least
* this much must be allocated. This should be * this much must be allocated. This should be
* CONFIG_SMP_IDLETHREAD_STACKSIZE. * CONFIG_IDLETHREAD_STACKSIZE.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -35,13 +35,13 @@
/* An IDLE thread stack size for CPU0 must be defined */ /* An IDLE thread stack size for CPU0 must be defined */
#if !defined(CONFIG_SMP_IDLETHREAD_STACKSIZE) #if !defined(CONFIG_IDLETHREAD_STACKSIZE)
# error CONFIG_SMP_IDLETHREAD_STACKSIZE is not defined # error CONFIG_IDLETHREAD_STACKSIZE is not defined
#elif CONFIG_SMP_IDLETHREAD_STACKSIZE < 16 #elif CONFIG_IDLETHREAD_STACKSIZE < 16
# error CONFIG_SMP_IDLETHREAD_STACKSIZE is to small # error CONFIG_IDLETHREAD_STACKSIZE is to small
#endif #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) #define CPU1_IDLETHREAD_STACKWORDS (CPU1_IDLETHREAD_STACKSIZE >> 2)
/**************************************************************************** /****************************************************************************

View File

@ -137,7 +137,6 @@ CONFIG_SMARTFS_ALIGNED_ACCESS=y
CONFIG_SMARTFS_MAXNAMLEN=30 CONFIG_SMARTFS_MAXNAMLEN=30
CONFIG_SMARTFS_MULTI_ROOT_DIRS=y CONFIG_SMARTFS_MULTI_ROOT_DIRS=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_IDLETHREAD_STACKSIZE=1024
CONFIG_SMP_NCPUS=2 CONFIG_SMP_NCPUS=2
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_SPRESENSE_EXTENSION=y CONFIG_SPRESENSE_EXTENSION=y

View File

@ -711,7 +711,6 @@ be enabled with the following configuration settings:
CONFIG_SPINLOCK=y CONFIG_SPINLOCK=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_NCPUS=4 CONFIG_SMP_NCPUS=4
CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
Open Issues: Open Issues:

View File

@ -75,7 +75,6 @@ CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPWORK=y CONFIG_SCHED_LPWORK=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_IDLETHREAD_STACKSIZE=1024
CONFIG_STACK_COLORATION=y CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=8 CONFIG_START_DAY=8
CONFIG_START_MONTH=3 CONFIG_START_MONTH=3

View File

@ -315,7 +315,6 @@ SMP
+CONFIG_SPINLOCK=y +CONFIG_SPINLOCK=y
+CONFIG_SMP=y +CONFIG_SMP=y
+CONFIG_SMP_NCPUS=2 +CONFIG_SMP_NCPUS=2
+CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
You also must enable near-realtime-performance otherwise even long timeouts You also must enable near-realtime-performance otherwise even long timeouts
will expire before a CPU thread even has a chance to execute. will expire before a CPU thread even has a chance to execute.

View File

@ -41,7 +41,6 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
CONFIG_SDCLONE_DISABLE=y CONFIG_SDCLONE_DISABLE=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_SMP_IDLETHREAD_STACKSIZE=3072
CONFIG_SMP_NCPUS=2 CONFIG_SMP_NCPUS=2
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_START_DAY=6 CONFIG_START_DAY=6

View File

@ -1871,7 +1871,7 @@ int up_cpu_index(void);
* - tcb: The TCB of new CPU IDLE task * - tcb: The TCB of new CPU IDLE task
* - stack_size: The requested stack size for the IDLE task. At least * - stack_size: The requested stack size for the IDLE task. At least
* this much must be allocated. This should be * this much must be allocated. This should be
* CONFIG_SMP_IDLETHREAD_STACKSIZE. * CONFIG_IDLETHREAD_STACKSIZE.
* *
****************************************************************************/ ****************************************************************************/

View File

@ -291,15 +291,6 @@ config SMP_NCPUS
SMP configuration. However, running the SMP logic in a single CPU SMP configuration. However, running the SMP logic in a single CPU
configuration is useful during certain testing. 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 endif # SMP
choice choice

View File

@ -120,7 +120,7 @@ int nx_smp_start(void)
FAR struct tcb_s *tcb = current_task(cpu); FAR struct tcb_s *tcb = current_task(cpu);
DEBUGASSERT(tcb != NULL); 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) if (ret < 0)
{ {
serr("ERROR: Failed to allocate stack for CPU%d\n", cpu); serr("ERROR: Failed to allocate stack for CPU%d\n", cpu);