Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2117: Fix kernel work counting when processes are stopped or faulted r=bradjc a=hudson-ayers ### Pull Request Overview This pull request fixes a bug (identified by @bradjc ) where when a process in the Running state faults, the scheduler would hang, as the kernel work counter is not decremented appropriately. This bug existed prior to the new scheduling interface, but before manifested as the board never going to sleep, rather than hanging outright. It also fixes a similar set of bugs where a process being Stopped or terminated when in the `Running` state would cause the scheduler to hang, for basically the same reason. This PR introduces a new wrapper around `Cell<State>` called `ProcessStateCell` that takes care of incrementing and decrementing the kernel work counter based on the transitions between process states that occur. Hopefully, this should prevent similar bugs from cropping up in the future. ### Testing Strategy This pull request was tested by: - running the `crash_dummy` app and verifying that other apps + the process console work after the app crashes - faulting the `whileone` app while it is executing and verifying that doing so does not freeze a simultaneously running `blink` app - stopping the `whileone` app while it is executing and verifying that doing so does not freeze a simultaneously running `blink` app, and then starting the app again and verifying that works correctly all three of these cases fail on current master. I also ran 4 apps simultaneously just as a tiny stress test and that worked fine. ### TODO or Help Wanted Thoughts on naming? Should update be kept as set, so that the wrapper appears identical to a Cell? ### Documentation Updated - [x] No updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Hudson Ayers <hayers@stanford.edu>
- Loading branch information