Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
LL/SC exclusive access by register width or cache line width?
Jump...
Cancel
Locked
Locked
Replies
4 replies
Subscribers
119 subscribers
Views
3965 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
LL/SC exclusive access by register width or cache line width?
Toebs Douglass
over 12 years ago
Note: This was originally posted on 30th May 2012 at
http://forums.arm.com
Hi.
I'm working on the next release of my lock-free data structure library.
I'm using LL/SC on ARM.
To use LL/SC as LL/SC (rather than emulating CAS) there has to be a single STR between the LDREX and STREX.
Now, I've written the code and this works.
What concerns me however is the possibility it may not work.
I've read on PowerPC if you access the same cache line as the LL/SC target, you break the LL/SC.
So I'm thinking if my STR target is on the same cache line as my LL/SC target, then pow, I'm dead.
Now, the LL/SC target and STR targets are always in different malloc()s so the chance of them being directly in the same cache line is probably small (and I can guarantee this by padding the LL/SC target so it begins on a cache line boundary and fills that cache line).
But there coud be false sharing, if the STR target is in just the right (wrong!) place in memory.
Looking at the LDREX/STREX documentation, this descriibes exclusive access in terms of "the physical address". This implies register width granularity, not cache line width granularity.
And that's my question - is LDREX/STREX sensitivity to memory access using register width granularity or cache line width granularity?
Parents
Peter Harris
over 12 years ago
Note: This was originally posted on 30th May 2012 at
http://forums.arm.com
Purely from the idealized architecture point of view the ARM ARM defines the size being tracked for exclusive access as "a small block" - but the size of that is implementation defined (and has varied across a number of ARM core implementations). The exclusive monitor spec in the ARM ARM defines a normal store outside of "this block" between two exclusives will work fine, but within it the behaviour is implementation defined (may clear the exclusive monitor, may not).
So yes, if you can guarantee that your "normal store" hits a different "small block" to the exclusives I think you are OK. However I don't know of a programmatic way to determine the monitor block size ...
Cancel
Vote up
0
Vote down
Cancel
Reply
Peter Harris
over 12 years ago
Note: This was originally posted on 30th May 2012 at
http://forums.arm.com
Purely from the idealized architecture point of view the ARM ARM defines the size being tracked for exclusive access as "a small block" - but the size of that is implementation defined (and has varied across a number of ARM core implementations). The exclusive monitor spec in the ARM ARM defines a normal store outside of "this block" between two exclusives will work fine, but within it the behaviour is implementation defined (may clear the exclusive monitor, may not).
So yes, if you can guarantee that your "normal store" hits a different "small block" to the exclusives I think you are OK. However I don't know of a programmatic way to determine the monitor block size ...
Cancel
Vote up
0
Vote down
Cancel
Children
No data