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/02/17 13:53:06 UTC

[GitHub] [incubator-nuttx] no1wudi opened a new pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   ## Summary
   * Rename up_fault to riscv_fault as other arch does
   * risc-v/qemu-rv: Supports SMP up to 8 cores 
   ## Impact
   QEMU-RV
   ## Testing
   QEMU
   


-- 
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] masayuki2009 commented on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   @no1wudi 
   
   I tried this PR but  the `smp` application does not work.
   
   ```
   $ ~/opensource/QEMU/qemu-6.1.1/build/riscv64-softmmu/qemu-system-riscv64 -nographic -cpu rv64 -M virt -bios none -kernel ./nuttx
   qemu-system-riscv64: clint: invalid write: 00000004
   qemu-system-riscv64: clint: invalid write: 00000008
   qemu-system-riscv64: clint: invalid write: 0000000c
   qemu-system-riscv64: clint: invalid write: 00000010
   qemu-system-riscv64: clint: invalid write: 00000014
   qemu-system-riscv64: clint: invalid write: 00000018
   qemu-system-riscv64: clint: invalid write: 0000001c
   
   NuttShell (NSH) NuttX-10.2.0
   nsh> uname -a
   NuttX 10.2.0 ab18b7b3d3 Mar 23 2022 15:43:23 risc-v rv-virt
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 002000 001088  54.4%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU1 IDLE
       2     2   2   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU2 IDLE
       3     3   3   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU3 IDLE
       4     4   4   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU4 IDLE
       5     5   5   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU5 IDLE
       6     6   6   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU6 IDLE
       7     7   7   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU7 IDLE
       8     8   0 100 RR       Task    --- Running            00000000 002016 001952  96.8%! nsh_main
   nsh> free
                      total       used       free    largest  nused  nfree
           Umem:   33379360      13648   33365712   33365712     58      1
   nsh> help
   help usage:  help [-v] [<cmd>]
   
     ?      cat    cd     free   help   ls     mount  ps     uname  
   
   Builtin Apps:
     ostest  sh      nsh     smp     
   nsh> smp
     Main[0]: Running on CPU0
     Main[0]: Initializing barrier
   qemu-system-riscv64: clint: invalid write: 00000004
   ```
   


-- 
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] no1wudi edited a comment on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

Posted by GitBox <gi...@apache.org>.
no1wudi edited a comment on pull request #5529:
URL: https://github.com/apache/incubator-nuttx/pull/5529#issuecomment-1076123831


   > > I've never see this error on qemu 6.2 and above, could you try again with latest qemu ?
   > 
   > @no1wudi
   > 
   > The error disappeared but it seems that SMP still does not work.
   > 
   > ```
   > $ ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 --version
   > QEMU emulator version 6.2.0 (v6.2.0)
   > Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
   >  ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -nographic -cpu rv64 -M virt -bios none -kernel ./nuttx
   > 
   > NuttShell (NSH) NuttX-10.2.0
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 002000 000992  49.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU1 IDLE
   >     2     2   2   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU2 IDLE
   >     3     3   3   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU3 IDLE
   >     4     4   4   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU4 IDLE
   >     5     5   5   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU5 IDLE
   >     6     6   6   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU6 IDLE
   >     7     7   7   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU7 IDLE
   >     8     8   0 100 RR       Task    --- Running            00000000 002016 001936  96.0%! nsh_main
   > nsh> smp
   >   Main[0]: Running on CPU0
   >   Main[0]: Initializing barrier
   > QEMU: Terminated
   > ```
   
   Please add `-smp 8` to command line, you can specify the core number by this option, by default only one core will be used.


-- 
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] no1wudi edited a comment on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

Posted by GitBox <gi...@apache.org>.
no1wudi edited a comment on pull request #5529:
URL: https://github.com/apache/incubator-nuttx/pull/5529#issuecomment-1076123831


   > > I've never see this error on qemu 6.2 and above, could you try again with latest qemu ?
   > 
   > @no1wudi
   > 
   > The error disappeared but it seems that SMP still does not work.
   > 
   > ```
   > $ ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 --version
   > QEMU emulator version 6.2.0 (v6.2.0)
   > Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
   >  ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -nographic -cpu rv64 -M virt -bios none -kernel ./nuttx
   > 
   > NuttShell (NSH) NuttX-10.2.0
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 002000 000992  49.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU1 IDLE
   >     2     2   2   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU2 IDLE
   >     3     3   3   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU3 IDLE
   >     4     4   4   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU4 IDLE
   >     5     5   5   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU5 IDLE
   >     6     6   6   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU6 IDLE
   >     7     7   7   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU7 IDLE
   >     8     8   0 100 RR       Task    --- Running            00000000 002016 001936  96.0%! nsh_main
   > nsh> smp
   >   Main[0]: Running on CPU0
   >   Main[0]: Initializing barrier
   > QEMU: Terminated
   > ```
   
   Please add `-smp 8` to command line 


-- 
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] acassis commented on a change in pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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



##########
File path: arch/risc-v/src/qemu-rv/qemu_rv_start.c
##########
@@ -60,10 +60,15 @@ uintptr_t g_idle_topstack = QEMU_RV_IDLESTACK_TOP;
  * Name: qemu_rv_start
  ****************************************************************************/
 
-void qemu_rv_start(void)
+void qemu_rv_start(int mhartid)
 {
   uint32_t *dest;
 
+  if (0 < mhartid)

Review comment:
       ```suggestion
    if (mhartid > 0)
   ```
   I think for equal comparison if (0 == ...) it is ok, but for greater/lower comparison it doesn't help and make more difficult to read




-- 
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] no1wudi commented on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   > > I've never see this error on qemu 6.2 and above, could you try again with latest qemu ?
   > 
   > @no1wudi
   > 
   > The error disappeared but it seems that SMP still does not work.
   > 
   > ```
   > $ ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 --version
   > QEMU emulator version 6.2.0 (v6.2.0)
   > Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
   >  ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -nographic -cpu rv64 -M virt -bios none -kernel ./nuttx
   > 
   > NuttShell (NSH) NuttX-10.2.0
   > nsh> ps
   >   PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
   >     0     0   0   0 FIFO     Kthread N-- Assigned           00000000 002000 000992  49.6%  CPU0 IDLE
   >     1     1   1   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU1 IDLE
   >     2     2   2   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU2 IDLE
   >     3     3   3   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU3 IDLE
   >     4     4   4   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU4 IDLE
   >     5     5   5   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU5 IDLE
   >     6     6   6   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU6 IDLE
   >     7     7   7   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU7 IDLE
   >     8     8   0 100 RR       Task    --- Running            00000000 002016 001936  96.0%! nsh_main
   > nsh> smp
   >   Main[0]: Running on CPU0
   >   Main[0]: Initializing barrier
   > QEMU: Terminated
   > ```
   
   Please add -smp 8 to command line 


-- 
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] no1wudi commented on a change in pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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



##########
File path: arch/risc-v/src/qemu-rv/qemu_rv_start.c
##########
@@ -60,10 +60,15 @@ uintptr_t g_idle_topstack = QEMU_RV_IDLESTACK_TOP;
  * Name: qemu_rv_start
  ****************************************************************************/
 
-void qemu_rv_start(void)
+void qemu_rv_start(int mhartid)
 {
   uint32_t *dest;
 
+  if (0 < mhartid)

Review comment:
       Thanks




-- 
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 #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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



##########
File path: arch/risc-v/src/qemu-rv/qemu_rv_irq_dispatch.c
##########
@@ -67,6 +67,11 @@ void *riscv_dispatch_irq(uintptr_t vector, uintptr_t *regs)
   uintptr_t irq = (vector >> RV_IRQ_MASK) | (vector & 0xf);
   uintptr_t *mepc = regs;
 
+  if (vector < RISCV_IRQ_ECALLM)
+    {
+      riscv_fault((int)irq, regs);

Review comment:
       don't need cast

##########
File path: boards/risc-v/qemu-rv/rv-virt/README.txt
##########
@@ -22,14 +22,14 @@
 
 4. Run the nuttx with qemu
 
-  $ qemu-system-riscv32 -M virt -cpu rv32 -bios none -kernel nuttx -nographic
+  $ qemu-system-riscv32 -M virt -cpu rv32 -smp 8 -bios none -kernel nuttx -nographic
 
   or
 
-  $ qemu-system-riscv64 -M virt -cpu rv64 -bios none -kernel nuttx -nographic
+  $ qemu-system-riscv64 -M virt -cpu rv64 -smp 8-bios none -kernel nuttx -nographic
 
 5. TODO
 
-  Support FPU
+  Support FPU (Done)

Review comment:
       remove




-- 
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] no1wudi commented on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   @masayuki2009 It seems the CPU1~CPU7 don't works, and I see:
   ```
   qemu-system-riscv64: clint: invalid write: 00000004
   ```
   I've never see this error on qemu 6.2 and above, could you try again with latest qemu ?


-- 
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 #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   


-- 
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] masayuki2009 commented on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   >Please add -smp 8 to command line, you can specify the core number by this option, by default only one core will be used.
   
   Thanks, it works now.
   


-- 
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] masayuki2009 commented on pull request #5529: risc-v/qemu-rv: Supports SMP up to 8 cores and other minor changes

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


   >I've never see this error on qemu 6.2 and above, could you try again with latest qemu ?
   
   @no1wudi 
   
   The error disappeared but it seems that SMP still does not work.
   
   ```
   $ ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 --version
   QEMU emulator version 6.2.0 (v6.2.0)
   Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
    ~/opensource/QEMU/qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -nographic -cpu rv64 -M virt -bios none -kernel ./nuttx
   
   NuttShell (NSH) NuttX-10.2.0
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 002000 000992  49.6%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU1 IDLE
       2     2   2   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU2 IDLE
       3     3   3   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU3 IDLE
       4     4   4   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU4 IDLE
       5     5   5   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU5 IDLE
       6     6   6   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU6 IDLE
       7     7   7   0 FIFO     Kthread N-- Running            00000000 002000 002000 100.0%! CPU7 IDLE
       8     8   0 100 RR       Task    --- Running            00000000 002016 001936  96.0%! nsh_main
   nsh> smp
     Main[0]: Running on CPU0
     Main[0]: Initializing barrier
   QEMU: Terminated
   ``` 
   


-- 
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