apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.86k stars 1.17k forks source link

Thread can be unexpectedly suspended within a critical section. #1138

Open patacongo opened 4 years ago

patacongo commented 4 years ago

Occasionally, you will see an odd behavior while within a critical section: A thread may be unexpectedly suspended.

The proposed solution to this problem is to lock the scheduler while within a critical section.

This solution, however, depends first on resolution of Issue #1137

@xiaoxiang781216 Can you clarify the circumstance under which this was recurring. My old, tired brain cannot recall the details. This problem was originally reported by Guiding Li. As I recall there were two scenarios where unexpected context switches occurred: One involved PM state changes and the other involved cancellation of wdog timer. It would be good to get those two failure scenarios detailed here.

xiaoxiang781216 commented 4 years ago

@liguiding please take took.

xiaoxiang781216 commented 4 years ago

@patacongo another issue related to crtical section: crtical section should be replaced with semphare or spinlock as much as we can to improve SMP performance.

patacongo commented 4 years ago

@patacongo another issue related to crtical section: crtical section should be replaced with semphare or spinlock as much as we can to improve SMP performance.

This would be a new, different issue.