Skip to content
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

Re-enable atomic loads and stores for all RISC-V targets #98333

Merged
merged 1 commit into from
Aug 5, 2023

Commits on Jun 21, 2022

  1. Re-enable atomic loads and stores for all RISC-V targets

    This roughly reverts PR rust-lang#66548
    
    Atomic "CAS" are still disabled for targets without the
    *“A” Standard Extension for Atomic Instructions*.
    However this extension only adds instructions for operations more complex
    than simple loads and stores, which are always atomic when aligned.
    
    In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/)
    section 2.6 *Load and Store Instructions* of
    chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine):
    
    > Even when misaligned loads and stores complete successfully,
    > these accesses might run extremely slowly depending on the implementation
    > (e.g., when implemented via an invisible trap). Further-more, whereas
    > **naturally aligned loads and stores are guaranteed to execute atomically**,
    > misaligned loads and stores might not, and hence require
    > additional synchronization to ensure atomicity.
    
    Unfortunately PR rust-lang#66548 did not provide
    much details on the bug that motivated it, but
    rust-lang#66240 and
    rust-lang#85736 appear related
    and happen with targets that do have the A extension.
    SimonSapin committed Jun 21, 2022
    Configuration menu
    Copy the full SHA
    20bd0c3 View commit details
    Browse the repository at this point in the history