Skip to content

Conversation

@anchao
Copy link
Contributor

@anchao anchao commented Apr 25, 2024

Summary

arch/riscv: replace atomic operations to AMO

RISC-V provided fetch-and-op style atomic primitives as they scale to highly parallel systems better than LR/SC or CAS. A simple microarchitecture can implement AMOs using the LR/SC primitives, provided the implementation can guarantee the AMO eventually completes. More complex implementations might also implement AMOs at memory controllers, and can optimize away fetching the original value when the destination is x0.

https://github.com/riscv/riscv-isa-manual/blob/main/src/a-st-ext.adoc

Signed-off-by: chao an anchao@lixiang.com
Co-authored-by: Petro Karashchenko petro.karashchenko@gmail.com

Impact

#6569
Closes #6569
N/A

Testing

rv-virt/smp64 rv-virt/smp

RISC-V provided fetch-and-op style atomic primitives as they scale
to highly parallel systems better than LR/SC or CAS. A simple
microarchitecture can implement AMOs using the LR/SC primitives,
provided the implementation can guarantee the AMO eventually
completes. More complex implementations might also implement AMOs
at memory controllers, and can optimize away fetching the original
value when the destination is x0.

Signed-off-by: chao an <anchao@lixiang.com>
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
@masayuki2009
Copy link
Contributor

@anchao
I will try this PR later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why RISC-V up_testset use lr/sc and not amoswap?

3 participants