Comments (7)
So, in principle, these accesses being concurrent should be ok. The question is why our machinery based volatile *
accesses failed to make TSan see it that way. The incriminated read is a use of Tag_val
, which loads the least significant byte of a header word. My hypothesis is that because s390x is big-endian, the load is not aligned, and we currently consider unaligned volatile accesses to behave like plain accesses. (Tangent: this code I linked to seems to have an superfluous alignment check now that I’m looking at it.)
My feeling is that the unaligned nature of the load does not change anything to the fact that these accesses are safe In Practice™: the GC marking does not modify the tag. So the question is whether there is way to remove this false report.
from ocaml.
Well I'd argue that, on platforms requiring strict alignment of data such as s390x
(i.e. when allow_unaligned_access = false
in arch.ml
), loads smaller than the size of a register are atomic (the memory bus transaction is a machine word read, with the proper byte enables set or unset to only return the subset of the word the ALU is interested in).
from ocaml.
If I understand @dustanddreams' point, the recommend fix would be to change the definitions of the tsan_volatile_{read,write}
functions in tsan.c on certain architectures.
from ocaml.
Unsure if this is related, but 4 days ago I observed a crash in our Domain.DLS
trunk
tests (on 32-bit though):
ocaml-multicore/multicoretests#446
The striking thing to me was that this was in a sequential test even.
I've not had time to look more into reproducing and reporting it.
from ocaml.
Well I'd argue that, on platforms requiring strict alignment of data such as
s390x
(i.e. whenallow_unaligned_access = false
inarch.ml
), loads smaller than the size of a register are atomic (the memory bus transaction is a machine word read, with the proper byte enables set or unset to only return the subset of the word the ALU is interested in).
Interesting, I don’t know much about unaligned accesses. How are they different in, for instance, amd64?
from ocaml.
Interesting, I don’t know much about unaligned accesses. How are they different in, for instance, amd64?
I think we have a misunderstanding of what "unaligned access" means here.
An unaligned access is a memory access of width w
at address a
, where a
is not a multiple of w
. Depending on the hardware platform, such an operation may trap, behave differently (e.g. silently accessing a rounded-down address and thus not returning the expected data), or require multiple memory bus transactions to complete (and as such, hardly atomic).
Now if you consider atomicity, aligned read accesses not larger than the width of the memory bus (usually at least as wide as the machine register, but sometimes wider, e.g. the 88110 was a 32-bit processor with a 64-bit memory bus and able to perform atomic loads of 64-bit values into register pairs) are always atomic (well, except on alpha without the BWX extension, but these are not supported by the native compiler since 4.x).
On the other hands, aligned write accesses are atomic only if they have the same width as the memory bus, or if the hardware provides some atomicity guarantees, since smaller-than-width writes will be turned into a 3-step read, modify the subset bytes, write operation. (which is why the x86 architecture has the "LOCK" prefix to require the memory bus to not be released between these steps, in order to appear to be an atomic operation to other devices).
I will work on a relaxed version of __tsan_volatile_read*
to demonstrate this.
from ocaml.
Fixed by #13067.
from ocaml.
Related Issues (20)
- Ground coercion is not composable HOT 1
- Regression with default GC settings between `4.14.2` and `5.1.1` HOT 7
- Doc typo in `Printexc` HOT 2
- Abnormal exit after upgrading to OCaml 5 HOT 4
- Restore native armv7 support for NetBSD 10.0 HOT 7
- Missing warning when an attribute is ignored or makes no sense HOT 9
- Support parameter constraints in module signature type equalities HOT 5
- Update the effect handlers manual page to use syntax HOT 3
- Simplify effect handler closure and reperform by dropping the `last_fiber` argument
- Module type substitutions in signature of recursive modules are not checked for cyclicity
- Sub-module identities inside an applicative functor are actually generative, leading to invalid signatures
- Strange error message with trunk HOT 5
- "β t is less general than ∀α. α t" with trunk HOT 14
- Please provide guidance whether the static linking exception applies to distributions like DkML HOT 12
- Semantics of toplevel let-bindings in classes HOT 12
- Make extensible variants more efficient and mashalable. HOT 4
- Library archive name change in OCaml 5 (e.g libunix.a -> libunixbyt.a & libunixnat.a) HOT 3
- Type-level module alias for functor parameter accepted HOT 1
- Signal handler doesn't run if signal received at the wrong time HOT 5
- Stdlib: `Dynarray.insert` procedure HOT 23
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 ocaml.