fix(std_common): handle NUM_READY_WORKER correctly#270
Merged
Conversation
Signed-off-by: koichiimai <kotty.0704@gmail.com>
Signed-off-by: koichiimai <kotty.0704@gmail.com>
Signed-off-by: koichiimai <kotty.0704@gmail.com>
Signed-off-by: koichiimai <kotty.0704@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The following three points were fixed in kernel/src/main.rs because the shell would not start when executing std_common with make run-std:
I added wait_microsec(100) before num_cpu() to avoid this. Ideally, we'd reference the CPU count obtained in each kernel/src/arch/ARCH/kernel_main.rs, but since this would require significant changes, I've decided not to include it in this PR.
Non-primary CPUs should only decrement NUM_READY_WORKER after PRIMARY_READY becomes true in std-common, as it is in other architectures. Therefore, I modified std_common to also check that PRIMARY_READY is TRUE before decrementing.
Replaced fetch_sub with fetch_update to prevent underflow when num_cpu is less than the actual number of CPU. Added a panic when NUM_READY_WORKER can't be decremented (already 0) as this indicates an unexpected state.
Related links
How was this PR tested?
Verified that the shell correctly enters the wait state by executing 'make run-std RELEASE=1' more than 10 times
Notes for reviewers