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/07/03 12:02:42 UTC

[incubator-nuttx] 01/03: sched: add depends on ARCH_INTERRUPTSTACK to SMP

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

commit a96cab58ad7cc50af21547d02408ef758c0d1da5
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Jun 28 16:57:19 2021 +0800

    sched: add depends on ARCH_INTERRUPTSTACK to SMP
    
    Change-Id: I7edbbcf314045c5567e30b39b0693672e5d10e9a
    Signed-off-by: ligd <li...@xiaomi.com>
---
 sched/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sched/Kconfig b/sched/Kconfig
index 644f0cb..e12767c 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -268,6 +268,7 @@ config SMP
 	default n
 	depends on ARCH_HAVE_MULTICPU
 	depends on ARCH_HAVE_TESTSET
+	depends on ARCH_INTERRUPTSTACK != 0
 	select SPINLOCK
 	select SCHED_RESUMESCHEDULER
 	select IRQCOUNT
@@ -275,6 +276,17 @@ config SMP
 		Enables support for Symmetric Multi-Processing (SMP) on a multi-CPU
 		platform.
 
+		N.B. SMP mode requires the use of ARCH_INTERRUPTSTACK:
+
+		CPU0 thread0  ->  IRQ enter -> add thread0 to block_list -> IRQ leave(crash)
+		                                                        ||
+		                                                        /\
+		                                                       /  \
+		CPU1 thread1  ->  block_task -> take thread0 from block_list -> run thread0
+
+		CPU0 IRQ handler use thread0's stack, but thread0 may switch to CPU1, that
+		will caused IRQ handler stack corruption.
+
 if SMP
 
 config SMP_NCPUS