Fix kernel work counting when processes are stopped or faulted #2117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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>
calledProcessStateCell
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 crashesfaulting the
whileone
app while it is executing and verifying that doing so does not freeze a simultaneously runningblink
appstopping the
whileone
app while it is executing and verifying that doing so does not freeze a simultaneously runningblink
app, and then starting the app again and verifying that works correctlyall 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
Formatting
make prepush
.