-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_stack fail on linux/arm64 (clang) #45
Comments
Not reproduced locally with clang-12 (RPi4, Ubuntu 21.04/arm64) on latest master (1668e46), ~100 runs. |
Reproduced on Travis CI (latest master, commit 1668e46): https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/554045328 (1st test run) Compiler: clang version 3.8.0-2ubuntu4 Output (test_stack): |
Not reproduced w/o assertions or w/o (-O2 or -O3). Not reproduced with gcc. Not reproduced if AO_STACK_IS_LOCK_FREE. |
Reproduced on latest master (401f7b7) |
Build: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/559848368 |
Reproduced on gcc117 (farm). Also reproduced with: clang -O3 -D N_EXPERIMENTS=2 -I src tests/test_stack.c src/*.c -lpthread Output (test_stack): |
Also, maybe the existing fix is not correct: 7ce7da4 |
I've reviewed the code in test_stack.c - I don't see any bug with the test code. |
After preprocessing of atomic_ops_stack.c, the code looks like:
|
Hello @hboehm, Some questions (based on the preprocessed code above):
PS. I haven't looked into the generated code yet (unfortunately I managed to reproduced it only with clang 3.8). |
Removing this W/A (AO_load_acquire -> AO_load) in AO_stack_pop_explicit_aux_acquire leads to almost 100% violation in assert(*list != first). |
Issue #45 (libatomic_ops). Enforce proper alignment of AO_stack_t.AO_pa to avoid the structure value to cross the CPU cache line boundary. A workaround for almost-lock-free push/pop test failures on aarch64, at least. * src/atomic_ops_stack.h [!AO_STACK_ATTR_ALLIGNED] (AO_STACK_ATTR_ALLIGNED): Define. * src/atomic_ops_stack.h (AO_stack_t.AO_pa): Add AO_STACK_ATTR_ALLIGNED attribute.
No test failure after W/A commit c664a61 |
(a cherry-pick of commit c664a61 from 'master') Issue #45 (libatomic_ops). Enforce proper alignment of AO_stack_t.AO_ptr to avoid the structure value to cross the CPU cache line boundary. A workaround for almost-lock-free push/pop test failures on aarch64, at least. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE && !AO_STACK_ATTR_ALLIGNED] (AO_STACK_ATTR_ALLIGNED): Define. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE] (AO_stack_t.AO_ptr): Add AO_STACK_ATTR_ALLIGNED attribute.
(a cherry-pick of commit ed712f7 from 'release-7_6') Issue #45 (libatomic_ops). Enforce proper alignment of AO_stack_t.AO_ptr to avoid the structure value to cross the CPU cache line boundary. A workaround for almost-lock-free push/pop test failures on aarch64, at least. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE && !AO_STACK_ATTR_ALLIGNED] (AO_STACK_ATTR_ALLIGNED): Define. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE] (AO_stack_t.AO_ptr): Add AO_STACK_ATTR_ALLIGNED attribute.
(a cherry-pick of commit ed712f7 from 'release-7_6') Issue #45 (libatomic_ops). Enforce proper alignment of AO_stack_t.AO_ptr to avoid the structure value to cross the CPU cache line boundary. A workaround for almost-lock-free push/pop test failures on aarch64, at least. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE && !AO_STACK_ATTR_ALLIGNED] (AO_STACK_ATTR_ALLIGNED): Define. * src/atomic_ops_stack.h [AO_USE_ALMOST_LOCK_FREE] (AO_stack_t.AO_ptr): Add AO_STACK_ATTR_ALLIGNED attribute.
Hello @hboehm, |
Build: https://travis-ci.org/github/ivmai/libatomic_ops/jobs/670012675
Source: master (0cb2374)
Compiler: clang version 3.8.0-2ubuntu4
Target: Linux/arm64 (aarch64-unknown-linux-gnu)
How to reproduce: configure --enable-assertions && make -j check CFLAGS_EXTRA="-O3" CC=clang
Reproduction rate: ~1/20
The text was updated successfully, but these errors were encountered: