fix(dmac): Use inline asm for compiler fences in DMAC#985
Open
jbeaurivage wants to merge 3 commits intoatsamd-rs:masterfrom
Open
fix(dmac): Use inline asm for compiler fences in DMAC#985jbeaurivage wants to merge 3 commits intoatsamd-rs:masterfrom
jbeaurivage wants to merge 3 commits intoatsamd-rs:masterfrom
Conversation
f24948e to
563cf3d
Compare
Contributor
|
Looks good @jbeaurivage , but maybe, its best to put the fence functions near the crate root for future use by other peripherals should we need to in future? - Or is this specific to DMAC? |
Contributor
Author
|
I think this should remain a DMAC-specific thing, as peripherals are expected to control DMA through the DMAC API. |
Signed-off-by: Justin Beaurivage <code@beaurivage.io>
0a76657 to
68d478e
Compare
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.
Summary
According to this discussion, it seems
core::sync::atomic::{fence, compiler_fence}aren't a strong guarantee that the compiler won't reorder memory accesses beyond the fence. The suggested fix is to add an inline assembly call, which apparently guarantees there won't be any memory accesses beyond the asm call.