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

What works as a data memory barrier?

We have a section of code that increments a variable shared among several threads. The code section is protected by a ldxr/stxr/dmb spin lock, and there is another dmb after the shared variable is updated. This code sequence is the body of a function that returns the shared variable's value before the update. The expectation is that no two calls to the function will return the same value. 

We start 8 threads running concurrently, calling the function 100 times each and record the results separately for each thread. Then we compare the sequences of values each thread received and check for duplications, where two threads got the same value. [EDIT: added: ] Our expectation is that there will be no duplicates. We find this is not the case.

Btw, we're on ARMv8 with CentOS 7.x (x = latest).

0