xiaoxiang781216 commented on a change in pull request #4020:
URL: https://github.com/apache/incubator-nuttx/pull/4020#discussion_r662700570



##########
File path: sched/Kconfig
##########
@@ -268,13 +268,25 @@ 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
        ---help---
                Enables support for Symmetric Multi-Processing (SMP) on a 
multi-CPU
                platform.
 
+               SMP mode must work with ARCH_INTERRUPTSTACK, here is the fail 
case:
+
+               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 curroption.

Review comment:
       It's important to document this fact, but it's more important to express 
the fact by contract and then avoid the wrong config in the future. It's a good 
to add a select/depend ARCH_INTERRUPTSTACK here.




-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to