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/06/05 05:33:53 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request, #6365: Revert "sched/tls: Don't compensate the tls size to the stack size"

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

   ## Summary
   Keep the stack consumption as before
   
   ## Impact
   Report here: https://github.com/apache/incubator-nuttx/pull/6337
   
   ## Testing
   
   


-- 
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 #6365: sched/tls: Compensate the tls size to the stack size

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

   Ok, I will repo locally later.


-- 
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 #6365: sched/tls: Wrap up_info_size into tls_info_size

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

   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] masayuki2009 commented on pull request #6365: sched/tls: Compensate the tls size to the stack size

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

   >@masayuki2009 fixed, please try again.
   
   @xiaoxiang781216 
   Hmm, the issue still happens.
   
   ```
   $ qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -semihosting -nographic -cpu rv64 -smp 8 -M virt -bios none -kernel ./nuttx
   ABC
   NuttShell (NSH) NuttX-3.6.1
   nsh> uname -a
   NuttX 3.6.1 3e4e5e0b82-dirty Jun  6 2022 08:11:36 risc-v rv-virt
   nsh> hello
   Hello, World!!
   [    0.000000] riscv_exception: EXCEPTION: Store/AMO access fault. MCAUSE: 0000000000000007
   [    0.000000] riscv_exception: PANIC!!! Exception = 0000000000000007
   [    0.000000] up_assert: Assertion failed at file:common/riscv_exception.c line: 89 task: hello
   [    0.000000] riscv_registerdump: EPC: 0000000080005c66
   [    0.000000] riscv_registerdump: A0: 0000000000000001 A1: 0000000080208038 A2: 0000000000000019 A3: 0000000080206c38
   [    0.000000] riscv_registerdump: A4: 0000000080208018 A5: 0000000080208058 A6: 0000000000000101 A7: 0000000000000000
   [    0.000000] riscv_registerdump: T0: 00000000800039c6 T1: 0000000000000000 T2: 0000000000000000 T3: 0000000000000000
   [    0.000000] riscv_registerdump: T4: 0000000000000000 T5: 0000000000000000 T6: 0000000000000000
   [    0.000000] riscv_registerdump: S0: 0000000080208040 S1: 0000000080206c00 S2: ffffffffffffffe0 S3: fffffffffffffff8
   [    0.000000] riscv_registerdump: S4: ffffffffffffffe0 S5: 0000000000000000 S6: 0000000000000000 S7: 0000000000000000
   [    0.000000] riscv_registerdump: S8: 0000000000000000 S9: 0000000000000000 S10: 0000000000000000 S11: 0000000000000000
   [    0.000000] riscv_registerdump: SP: 0000000080209d90 FP: 0000000080208040 TP: 0000000000000000 RA: 0000000080005b8a
   [    0.000000] riscv_dumpstate: sp:     0000000080200830
   [    0.000000] riscv_dumpstate: IRQ stack:
   [    0.000000] riscv_dumpstate:   base: 00000000802000f0
   [    0.000000] riscv_dumpstate:   size: 0000000000000800
   [    0.000000] riscv_stackdump: 0000000080200820: 802000f0 00000000 80006ce6 00000000 00000059 00000000 80014ed8 00000000
   [    0.000000] riscv_stackdump: 0000000080200840: deadbeef deadbeef 00000000 00000000 ffffffe0 ffffffff fffffff8 ffffffff
   [    0.000000] riscv_stackdump: 0000000080200860: ffffffe0 ffffffff 80209c88 00000000 00000007 00000000 800043d6 00000000
   [    0.000000] riscv_stackdump: 0000000080200880: 00000009 00000000 80001464 00000000 00000000 00000000 80201050 00000000
   [    0.000000] riscv_stackdump: 00000000802008a0: 80209c88 00000000 80001bb8 00000000 c0003200 00000000 80000f98 00000000
   [    0.000000] riscv_stackdump: 00000000802008c0: 80209d58 00000000 80206c00 00000000 00000007 00000000 80000dfe 00000000
   [    0.000000] riscv_dumpstate: sp:     0000000080209d90
   [    0.000000] riscv_dumpstate: User stack:
   [    0.000000] riscv_dumpstate:   base: 00000000c0004050
   [    0.000000] riscv_dumpstate:   size: 00000000000007e0
   [    0.000000] riscv_dumpstate: Kernel stack:
   [    0.000000] riscv_dumpstate:   base: 0000000080209260
   [    0.000000] riscv_dumpstate:   size: 0000000000000c00
   [    0.000000] riscv_dumpstate: Kernel Stack
   [    0.000000] riscv_stackdump: 0000000080209d80: 00000000 00000000 00040120 00000000 fffffff8 ffffffff 80209120 00000000
   [    0.000000] riscv_stackdump: 0000000080209da0: fffffff8 ffffffff 80007a7c 00000000 00000000 00000000 00000000 00000000
   [    0.000000] riscv_stackdump: 0000000080209dc0: 802090c2 00000000 80208f00 00000000 802090a0 00000000 800127d8 00000000
   [    0.000000] riscv_stackdump: 0000000080209de0: 80207ec0 00000000 80010cba 00000000 802090c2 00000000 802090a0 00000000
   [    0.000000] riscv_stackdump: 0000000080209e00: 80208f00 00000000 800119b2 00000000 00000000 00000000 00000000 00000000
   [    0.000000] riscv_stackdump: 0000000080209e20: 00000000 00000000 80011c84 00000000 00000000 00000000 800039d2 00000000
   [    0.000000] riscv_stackdump: 0000000080209e40: 00000000 00000000 800015bc 00000000 c00014de 00000000 00040020 00000000
   [    0.000000] riscv_showtasks:    PID    PRI      USED     STACK   FILLED    COMMAND
   [    0.000000] riscv_showtasks:   ----   ----       776      2048    37.8%    irq
   [    0.000000] riscv_dump_task:      0      0      1328      3024    43.9%    Idle Task
   [    0.000000] riscv_dump_task:      1    100      2000      2000   100.0%!   /system/bin/init
   [    0.000000] riscv_dump_task:      2    100       536      2016    26.5%    hello
   
   ```


-- 
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 #6365: sched/tls: Wrap up_info_size into tls_info_size

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

   @masayuki2009 Fix is here: https://github.com/apache/incubator-nuttx/pull/6377
   I retitle this PR to refactor tls code during the review.


-- 
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 #6365: sched/tls: Wrap up_info_size into tls_info_size

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

   @masayuki2009 how about this patch?


-- 
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 #6365: sched/tls: Wrap up_info_size into tls_info_size

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

   >@masayuki2009 how about this patch?
   
   Could you rebase this PR to the latest master?
   


-- 
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 #6365: sched/tls: Compensate the tls size to the stack size

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

   >Could you tell me how to generate hello and init elf in the kernel mode?
   
   Please try the following commands.
   
   ```
   $ cd nuttx                                                                                                                                                                                                                               
   $ ./tools/configure.sh rv-virt:knsh64
   $ make V=1 -j7                                                                                                                                                                                                                           
   $ make export V=1                                                                                                                                                                                                                        
   $ cd ../apps                                                                                                                                                                                                                             
   $ ./tools/mkimport.sh -x ../nuttx/nuttx-export-*.zip                                                                                                                                                                                     
   $ make import V=1                                                                                                                                                                                                                        
   $ cd ../nuttx
   $ qemu-system-riscv64 -semihosting -nographic -cpu rv64 -smp 8 -M virt -bios none -kernel ./nuttx
   ```
   
   >BTW, is it right to set CONFIG_SYSTEM_NSH=y here?
   
   Yes.
   


-- 
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 #6365: sched/tls: Compensate the tls size to the stack size

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

   > > @masayuki2009 fixed, please try again.
   > 
   > @xiaoxiang781216 Hmm, the issue still happens.
   > 
   > ```
   > $ qemu-6.2/build/riscv64-softmmu/qemu-system-riscv64 -semihosting -nographic -cpu rv64 -smp 8 -M virt -bios none -kernel ./nuttx
   > ABC
   > NuttShell (NSH) NuttX-3.6.1
   > nsh> uname -a
   > NuttX 3.6.1 3e4e5e0b82-dirty Jun  6 2022 08:11:36 risc-v rv-virt
   > nsh> hello
   > Hello, World!!
   > [    0.000000] riscv_stackdump: 0000000080209e40: 00000000 00000000 800015bc 00000000 c00014de 00000000 00040020 00000000
   > [    0.000000] riscv_showtasks:    PID    PRI      USED     STACK   FILLED    COMMAND
   > [    0.000000] riscv_showtasks:   ----   ----       776      2048    37.8%    irq
   > [    0.000000] riscv_dump_task:      0      0      1328      3024    43.9%    Idle Task
   > [    0.000000] riscv_dump_task:      1    100      2000      2000   100.0%!   /system/bin/init
   > [    0.000000] riscv_dump_task:      2    100       536      2016    26.5%    hello
   > ```
   
   init task restore the stack to the original size(2000), but the consumption is still higher than the capacity. 
   All patch in PR #6337 is the code refactor and the stack consumption should be same as before except:
   https://github.com/apache/incubator-nuttx/pull/6337/commits/48a0a2ebf3c927c7374b226ac45394df4b877dbe
   
   @masayuki2009 the follow command look like just generate the kernel binary:
   ```
   ./tools/configure.sh rv-virt:knsh64
   make -j8
   ```
   Could you tell me how to generate hello and init elf in the kernel mode?
   BTW,  is it right to set CONFIG_SYSTEM_NSH=y here? 
   https://github.com/apache/incubator-nuttx/blob/master/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig#L93
   
   


-- 
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 #6365: sched/tls: Compensate the tls size to the stack size

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

   @masayuki2009 fixed, please try again.


-- 
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 #6365: Revert "sched/tls: Don't compensate the tls size to the stack size"

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

   ```
   
   In file included from pthread/pthread_create.c:39:
   pthread/pthread_create.c: In function 'nx_pthread_create':
   Error: pthread/pthread_create.c:294:29: error: invalid application of 'sizeof' to incomplete type 'struct tls_info_s'
     294 |                             up_tls_size() + attr->stacksize,
         |                             ^~~~~~~~~~~
   make[1]: *** [Makefile:58: pthread_create.o] Error 1
   In file included from task/task_init.c:34:
   task/task_init.c: In function 'nxtask_init':
   Error: task/task_init.c:134:29: error: invalid application of 'sizeof' to incomplete type 'struct tls_info_s'
     134 |                             up_tls_size() + stack_size,
         |                             ^~~~~~~~~~~
   make[1]: *** [Makefile:58: task_init.o] Error 1
   make[1]: Target 'libsched.a' not remade because of errors.
   make: *** [tools/LibTargets.mk:59: sched/libsched.a] Error 2
   make: Target 'all' not remade because of errors.
   ```
   


-- 
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 merged pull request #6365: sched/tls: Wrap up_info_size into tls_info_size

Posted by GitBox <gi...@apache.org>.
masayuki2009 merged PR #6365:
URL: https://github.com/apache/incubator-nuttx/pull/6365


-- 
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 #6365: sched/tls: Compensate the tls size to the stack size

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

   @masayuki2009 the crash is made by: https://github.com/apache/incubator-nuttx/pull/6337/commits/11313e170a7fc83ea0901b931239990b0c2429ea
   but the change only contain the code refactor, it will compare the generated code to find the real difference.


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