-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add priority-limited locks #2684
base: main
Are you sure you want to change the base?
Conversation
4989831
to
8f2075a
Compare
I haven't taken the time to see if it matters for this yet but just in case you figure it out before I do: Given priorities are being treated more granular-ly than just a binary on/off thing now, it might a good time to improve the priority restoration instruction here.
That should be restoring back to the original level rather than just zero. |
Oops I accidentally reverted that change... It's actually needed otherwise that restoration can release a lock by accident. |
9a373b5
to
ed34f6c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
269d71a
to
bae305e
Compare
Running
|
I see a similar enough crash on main, I don't think this is the PR's fault:
|
interesting - I haven't seen crashes on main but after a clean build it seems it's fine on this branch - so might be a red herring |
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.
LGTM
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.
Xtensa side LGTM. (I don't really know the RISCV aspects of this)
unsafe fn enter(&self) -> critical_section::RawRestoreState; | ||
unsafe fn exit(&self, token: critical_section::RawRestoreState); |
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.
At some point critical_section
should be treated like embedded_hal
, where it's a convenient add-on, rather that part of the inherent APIs of the hal.
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.
Is this comment about the use of critical_section::RawRestoreState
as a return value?
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.
Yes
However, when it does, we can use it in embassy-executor to lock certain resources without affecting higher priority levels. This will come in handy once we manage our own timer queue, which is only ever accessed from the executor's priority level, and the alarm's level (which we'll be able to reduce to executor+1). Priority-limiting access to the queue will result in less jitter in higher priority executors. Hopefully :)
skip-changelog is purposeful.
sync
is a hidden module, which needs to be public because embassy/wifi build on it, but this new addition is pretty experimental - API, documentation or functionality may still change I think.