-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
RFC: standardize on a synchronization mechanism for device access #26073
Comments
While we're thinking about this topic, it looks the the PREEMPT_RT patch to Linux goes even further and replaces some usages of spinlocks with RT-mutexes. There are caveats and I'm not sure how applicable this is to Zephyr, but interesting nonetheless https://lwn.net/Articles/146861/ |
API meeting
|
I am against forcing it for all drivers APIs. |
When we need exclusive access to resources shared with interrupt context we need to lock interrupts to the level of the ISR(s) accessing it (or we need to disable the ISRs that access it - causing priority inversion). This cannot be done by a Also, don't forget about access in an SMP environment and any issues with access originating from User threads. |
There are three types of synchronization necessary for devices, several of which are considered in #22941 and its draft PRs particularly #24511:
The topic of this issue is access control, which historically has been implemented using
k_sem
. As originally raised in this comment I'd like to propose that was usek_mutex
instead, as this offers:The first question is whether this the right move. A follow-up question is whether the generic device API should provide support for any or all of the above synchronizations.
If we use
k_mutex
for access control we would need #25678 to be worked so its operations can be initiated from interrupt context, as is already allowed fork_sem
.The text was updated successfully, but these errors were encountered: