-
-
Couldn't load subscription status.
- Fork 780
kernel: make HAVE_WORK a member variable #1044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I think @alevy should look it over before merging too.
I think once upon a time, top-half interrupt handlers incremented HAVE_WORK, but that's not the case any more, so I think it's safe to no longer be volatile
6d679ea to
2aa2bc0
Compare
Also move the schedule function to a be a class function.
2aa2bc0 to
34261e0
Compare
|
(Pushed a fix for the formatting, was an extra blank line) |
|
I want to note that this PR is in service to tracking issue #1043. |
This seems to be important for the compiler to elide writes to static mutables that are not read within the same crate. Or at least was. So it was a hack, and I don't think we should need it if it's a member field. |
|
In the spirit of our last weekly call, I think it's important to describe how these changes impact interfaces elsewhere. I think given that #1043 is a tracking issue, it's good to work on these kinds of incremental changes, but would also just be good to document what someone getting an external port or capsule up to speed with a recent Tock version might need to change. In this case, I believe the only required change is in the board configuration, where instead of calling let board_kernel = static_init!(kernel::Kernel, kernel::Kernel::new());
board_kernel.kernel_loop(&tm4c1294, &mut chip, &mut PROCESSES, Some(&tm4c1294.ipc));the arguments to |
|
These changes have the In general, my intuition is that parameterizing lifetimes will give us more flexibility to eventually take out shared static variables (this is an intuition, I don't have a good argument for why that is). I think it's fine to leave this as-is, if we convince ourselves that clients of this interface (board |
|
I added a CHANGELOG file with the changes I think matter for external projects. I'm approving with this addition, but leaving the final word on this to @bradjc. I'm also marking this P-Significant, which gives it another day for someone to raise the alarm bells. |
CHANGELOG.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't like like GH auto-links numbers in generic markdown files :(
https://github.com/tock/tock/blob/kernel-oop-just-work/CHANGELOG.md
|
Looks good to me :) |
02e6538 to
3a6c9e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the link that was bugging me. Last call was a day ago, I think this is good to merge.
HAVE_WORKis currently a process.rs global static variable. This is probably not what we really want, as it requiresunsafeto use. This creates aKernelstruct and stores the number of callbacks waiting as a member variable in that struct. In the process, I counted 5 uses ofunsafethat are now gone.Now, before HAVE_WORK was a
VolatileCell. I'm not sure why that is needed, so I made it aNumCellinstead (essentially just aCell). If someone knows why it must be volatile then it can be changed back.Also, this moves the schedule function to a be a class function of
Process, where it probably should have been anyway.Testing Strategy
This pull request was tested by running hail on hail.
TODO or Help Wanted
n/a
Documentation Updated
/docs, or no updates are required.Formatting
make formatall.