Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
kernel: ring_buffer: remove volatile reads #991
Pull Request Overview
This removes the need for unsafe in
This pull request was tested by running the hail app.
TODO or Help Wanted
Anyone know if those volatile reads and writes are still useful?
left a comment
The volatile reads/writes are needed because the variables (well, tail) are modified in interrupt context. I.e., with inlining, it's possible that a loop on has_elements might read the variables once and then either return or loop forever.
Or is there some way the compiler knows enqueue might be called preemptively?
@brghena is correct. We stopped using ring buffers for interrupts pre-1.0 and now the ring buffer is only used in the main kernel thread (e.g. for process callbacks). I think it's probably good practice to separate data structures that we use and provide for "normal" kernel code, vs those that we use in special cases like interrupt contexts (currently none).