ALTracer commented on PR #6631:
URL: https://github.com/apache/incubator-nuttx/pull/6631#issuecomment-1186977386

   > We can refine how to trigger the check. But irq_dispatch is the best place 
to get the reliable result since if kmm_checkforcorruption report the error, we 
can ascertain that the interrupted thread corrupt the memory. On the another 
hand, even LP work detect the memory corruption, it's still hard to identify 
which thread corrupt the memory.
   
   Okay, can someone launch SEGGER SystemView and verify the board spends a 
reasonable amount of time checking all the heaps on every context switch? What 
if a heap is located in slow external SDRAM?
   LPWORK thread, on the other hand, runs once a second or slower. I'd change 
the Kconfig setting from seconds to milliseconds, though. (Or microseconds, to 
be consistent with other apps)
   And there's always KAsan, which is designed to catch heap access errors with 
its guard pages.
   
   > It's better to enable STACK_CANARIES, ARMV8M_STACKCHECK_HARDWARE or 
ARMV[7|8]M_STACKCHECK, since they can report the stack overflow immediately.
   
   Yes, on armv8-m stackcheck_hardware is essentially free. However, on 
armv6/7-m it reserves a register (r10), requires userspace be compiled with 
additional CFLAGS, and checks stacks on function exits (not on context switch, 
which might be more often) IIRC. Again, that doesn't let us set a safety margin 
of e.g. 90%, like in this PR.
   
   


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