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



##########
File path: arch/sim/src/sim/up_usestack.c
##########
@@ -136,9 +136,12 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, 
size_t stack_size)
    * water marks.
    */
 
-  up_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
-                 sizeof(struct tls_info_s)),
-                 tcb->adj_stack_size - sizeof(struct tls_info_s));
+  if (tcb->pid != 0)

Review comment:
       Are you sure? we use simulator daily, the stack colorize is a key 
feature to estimate the stack usage:
   ```
   [    0.000000] TAPDEV: ioctl failed (can't add interface tap0 to bridge 
nuttx0): 1
   [    0.000000] NuttX  9.1.0 2ed7902240 Sep 15 2020 05:13:23 sim sim
   uorb [7:100]
   
   NuttShell (NSH) NuttX-9.1.0
   nsh> ps
     PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   
USED  FILLED COMMAND
       0     0   0 FIFO     Kthread N-- Ready              00000000 002048 
001720  83.9%! Idle Task
       1     1 224 FIFO     Kthread --- Waiting  Signal    00000000 008208 
001136  13.8%  hpwork
       2     1 100 FIFO     Kthread --- Waiting  Signal    00000000 015376 
001776  11.5%  lpwork
       3     1 100 FIFO     Task    --- Running            00000000 030736 
003724  12.1%  init
       4     4 100 FIFO     Task    --- Waiting  Semaphore 00000010 008176 
001440  17.6%  Telnet daemon 0xf378a200
       5     4 100 FIFO     Task    --- Waiting  Semaphore 00000010 008176 
001440  17.6%  Telnet daemon 0xf378c7f0
       8     1  80 FIFO     pthread --- Waiting  Semaphore 00000000 008224 
002192  26.6%  netinit 0x0
   nsh> 
   ```
   Do you see USED and FILLED column?

##########
File path: arch/avr/src/avr/up_usestack.c
##########
@@ -119,7 +111,10 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t 
stack_size)
    */
 
 #ifdef CONFIG_STACK_COLORATION
-  memset(tcb->stack_alloc_ptr, STACK_COLOR, stack_size);

Review comment:
       Why you have this assumption?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to