You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/18 15:58:11 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

xiaoxiang781216 opened a new pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264


   ## Summary
   to simplify the SMP related code logic
   
   ## Impact
   SMP
   
   ## Testing
   Pass CI and ostest in sim:nsh/smp
   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r787750272



##########
File path: sched/Kconfig
##########
@@ -282,11 +282,10 @@ config SMP
 		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

Review comment:
       @gustavonihei after discuss in https://github.com/apache/incubator-nuttx/pull/5247, this change just ensure CONFIG_SMP_NCPUS equal 1 in no SMP case to avoid #ifdef/#else/#endif spread in the code base, but don't allow the user to select value > 1. So I think we can keep it as CONFIG_SMP_NCPUS.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r786989501



##########
File path: sched/Kconfig
##########
@@ -282,11 +282,10 @@ config SMP
 		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

Review comment:
       For consistency to the adopted naming template, we should remove the `SMP_`  prefix, since it is no longer strictly related to SMP.
   
   We should rename the config to just `NCPUS`, or maybe `NUM_CPUS`.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r787030552



##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,7 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
   DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);

Review comment:
       Yes, you are right.  `cpu` here is used to index the CPU interrupts array.  @xiaoxiang781216 can you please apply @gustavonihei's suggestion and also fix the same assertion in `up_disable_irq` in line 532.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r786986988



##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,7 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
   DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);

Review comment:
       ```suggestion
     DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS);
   ```
   Not related to the change proposed in this PR, but since `cpu` is the CPU ID, it can't be equal to 1 in a single CPU scenario.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#issuecomment-1017095859


   @eenurkka  do you know why opensbi fail to compile?
   https://github.com/apache/incubator-nuttx/runs/4872097845?check_suite_focus=true
   ```
   Error: /github/workspace/sources/nuttx/arch/risc-v/src/opensbi/opensbi-3rdparty/include/sbi/sbi_types.h:47:15: error: conflicting types for '_Bool8'
    typedef int   bool;
                  ^~~~
   /github/workspace/sources/nuttx/include/stdbool.h:100:17: note: previous declaration of '_Bool8' was here
    typedef uint8_t _Bool8;
                    ^~~~~~
   In file included from chip/mpfs_opensbi.c:45:
   /github/workspace/sources/nuttx/arch/risc-v/src/opensbi/opensbi-3rdparty/include/sbi/sbi_types.h:59: error: "true" redefined [-Werror]
    #define true   TRUE
   ```
   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r786989501



##########
File path: sched/Kconfig
##########
@@ -282,11 +282,10 @@ config SMP
 		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

Review comment:
       For consistency to the adopted naming template, we should remove the `SMP_`  prefix, since it is strictly related to SMP.
   
   We should rename the config to just `NCPUS`.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r787070840



##########
File path: sched/Kconfig
##########
@@ -282,11 +282,10 @@ config SMP
 		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

Review comment:
       Ok, let me do the rename in the next PR.

##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,7 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
   DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);

Review comment:
       Done.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r787308011



##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,11 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
+<<<<<<< HEAD

Review comment:
       Yes, my fault. Fixed.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r786986988



##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,7 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
   DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);

Review comment:
       ```suggestion
     DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS);
   ```
   Not related to the change proposed in this PR, but since `cpu` is the CPU ID, it can't be equal to 1 in a single CPU scenario.
   @Ouss4, PTAL.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r786989501



##########
File path: sched/Kconfig
##########
@@ -282,11 +282,10 @@ config SMP
 		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

Review comment:
       For consistency to the adopted naming template, we should remove the `SMP_`  prefix, since it is strictly related to SMP.
   
   We should rename the config to just `NCPUS`, or maybe `NUM_CPUS`.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#issuecomment-1017096624


   Look like we need define OPENSBI_EXTERNAL_SBI_TYPES to avoid the dup error:
   https://github.com/riscv-software-src/opensbi/blob/master/include/sbi/sbi_types.h#L13
   @eenurkka could you provide a patch fix it?


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#discussion_r787073341



##########
File path: arch/xtensa/src/esp32/esp32_irq.c
##########
@@ -595,11 +580,11 @@ void up_enable_irq(int irq)
   int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
 
   DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-#ifdef CONFIG_SMP
+<<<<<<< HEAD

Review comment:
       Is it a result of unresolved merge conflict?




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] eenurkka commented on pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
eenurkka commented on pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#issuecomment-1017272905


   Just created PR#5287.


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] eenurkka commented on pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
eenurkka commented on pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264#issuecomment-1017221334


   @xiaoxiang781216, I will have a look


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5264: sched: Define SMP_NCPUS to 1 in no SMP case

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5264:
URL: https://github.com/apache/incubator-nuttx/pull/5264


   


-- 
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-unsubscribe@nuttx.apache.org

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