fjpanag opened a new pull request, #8937:
URL: https://github.com/apache/nuttx/pull/8937

   ## Summary
   
   I noticed that `boardctl(BOARDIOC_RESET, 0)` calls 
`reboot_notifier_call_chain()` before the reset.  
   The operations of `reboot_notifier_call_chain()` are happening within a 
critical section.
   
   The reboot notifier will typically cause a `sync()` to be executed for all 
open files (at least on my system).
   
   But, after `reboot_notifier_call_chain()` returns, there is nothing ensuring 
that the reset will be executed immediately.  
   At this point, this task may be preempted, and new writes to the files may 
be performed. A new `sync()` would be needed but it will not happen.
   
   Wrapping everything in a critical section ensures that when the notifier 
completes, the system will immediately reset, without leaving room for other 
tasks to spoil the ready-to-reset state of the system.
   
   ## Impact
   
   The reset procedure is executed correctly.
   
   ## Testing
   
   Tested on a custom target based on the STM32F427.  
   Reboot is being executed correctly, without any issues or side-effects.
   
   


-- 
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: [email protected]

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

Reply via email to