Comments (5)
(Just providing context:) glibc's low-level locking code seems to use CAS to acquire locks and swap to release them.
from riscv-isa-manual.
I think all there is to say in the spec is that some more complex locks will be implemented with LR/SC. The only interesting thing about those sequences is how to set the AQ/RL bits on the two operations; while I think it will suffice to set AQ on a lock-acquiring SC and RL on a lock-releasing SC, we'd rather wait til the memory model discussion is more complete before writing that up.
from riscv-isa-manual.
I think that lock elision isn't compatible with LR/SC mechanism. Elided store wouldn't invalidate reservations held by other harts after LC instruction and SC would succeed. It would made LR/SC suffer from ABA problem.
from riscv-isa-manual.
There are a lot of misconceptions about ABA problem. LR/SC only has an expressiveness advantage over CAS if unrelated memory accesses are allowed to occur between the LR and the SC; RISC-V forbids this so RISC-V LR/SC is already precisely equivalent to CAS..
from riscv-isa-manual.
Regarding ABA - in the case where there is a single word being accessed, then LR/SC will abort if a second hart rewrites the same value as is currently in memory to the single word under reservation by a first hart. CAS will not detect this. This is admittedly a limited case but does mean LR/SC is not equivalent to CAS for ABA.
from riscv-isa-manual.
Related Issues (20)
- Zicfiss/Zicfilp interaction with Zc extension HOT 2
- Clarification on tail elements for vector load fault-only-first HOT 2
- orc.b is listed with two operands in section 30.4 HOT 1
- Bump docs-resources ahead
- How to get the size of physical address and virtual address in RISCV? HOT 6
- Is the Length of the Guest Physical Address Implementation-Defined or Fixed to a Wider 2-Bit Format? HOT 4
- Formulas (images) not displayed in Apple Books v6.4 HOT 4
- Zcmt: clarify translation of jvt-based addresses in M-mode HOT 5
- Performance of misaligned loads HOT 7
- Include a sentence about being nondestructive to the stack pointer for C.ADDI4SPN HOT 1
- EPUB image not show HOT 2
- Clarify presence of mtval2 HOT 2
- Clarify xstatus.SDT and xenvcfg.DTE interactions HOT 2
- Figure caption for Figure 1 is in the wrong place. HOT 2
- Incorrect status of Public Review version HOT 2
- Wording problem in section 8.3 HOT 1
- Clarify Smdbltrp details HOT 3
- Which of RV64GBCV, RV64GCBV, and RV64GCVB is legal? HOT 1
- Zip and Unzip descriptions are reversed HOT 6
- C.ADDI16SP range clarification. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riscv-isa-manual.