mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-04 04:27:34 +00:00
Atomic operations were previously broken. RISC-V breaks atomic operations into multiple instructions, and there is some state kept between those instructions. This state is not visible, and is internal to the processor. We were ignoring this state, which resulted in inconsistencies throughout the system. The following sequence was possible: 1. A thread loads a value, and obtains the `reservation set` 2. A context switch happens on the following instruction 3. A different thread loads the value, modifies it, and continues 4. A third thread (or a different process) loads a value and obtains the `reservation set` 5. The original thread runs, sees the `reservation set` is held, and updates the value, clobbering what the second thread did in #3 A workaround for this is to perform a dummy `sc` as part of the context switch. This invalidates any atomic operations that may be pending. Signed-off-by: Sean Cross <sean@xobs.io> |
||
|---|---|---|
| .. | ||
| riscv32i-unknown-none-elf.a | ||
| riscv32imac-unknown-none-elf.a | ||
| riscv32imac-unknown-xous-elf.a | ||
| riscv32imc-unknown-none-elf.a | ||
| riscv64gc-unknown-none-elf.a | ||
| riscv64imac-unknown-none-elf.a | ||