Fix SMP task self void run state change #984
Merged
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.
Description
PRs #958 and #959 introduced a problem - when a task attempts to delete/suspend a task running on another core, there is a time window in which the task being deleted or suspended can take an action which puts it back on the ready list, thereby nullifying the delete/suspend operation.
The following example explains the problem:
The root cause of the problem is that the task being deleted/suspended is evicted from the core after exiting the critical section. The task can put itself back on the ready list after we exit the critical section and before we evict it. This PR fixes the problem by evicting the task from within the critical section.
Test Steps
Before this PR, there are errors when running RP2040 standard SMP full demo.
After the PR, there are no errors.
Checklist:
Related Issue
#958, #959
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.