Conversation
b69fa10 to
7f9ab34
Compare
vtjnash
approved these changes
Aug 6, 2020
Comment on lines
+434
to
+437
| ifeq ($(LLVM_ASSERTIONS),0) | ||
| CXX_DISABLE_ASSERTION += -DNDEBUG | ||
| endif | ||
|
|
Member
There was a problem hiding this comment.
As this variable does not have the actual runtime value (which should get set from llvm-config), we have a header (julia_assert.h) that is supposed to already deal with this.
Member
Author
There was a problem hiding this comment.
Looks like llvm-config no longer sets NDEBUG, but it still needs to match what LLVM expects for ABI reasons.
| #ifdef JL_TSAN_ENABLED | ||
| if (t->ctx.tsan_state) { | ||
| t->ctx.tsan_state = NULL; | ||
| __tsan_destroy_fiber(t->ctx.tsan_state); |
Member
There was a problem hiding this comment.
This is a NULL pointer?
Suggested change
| __tsan_destroy_fiber(t->ctx.tsan_state); | |
| __tsan_destroy_fiber(NULL); |
src/task.c
Outdated
| } | ||
|
|
||
| #ifdef JL_TSAN_ENABLED | ||
| char tsan_state_corruption[] = "TSAN state corrupted. Exiting HARD!\n"; |
Member
There was a problem hiding this comment.
Suggested change
| char tsan_state_corruption[] = "TSAN state corrupted. Exiting HARD!\n"; | |
| const char tsan_state_corruption[] = "TSAN state corrupted. Exiting HARD!\n"; |
src/task.c
Outdated
| // Something went really wrong - don't even assume that we can | ||
| // use assert/abort which involve lots of signal handling that | ||
| // looks at the tsan state. | ||
| write(STDERR_FILENO, tsan_state_corruption, sizeof(tsan_state_corruption)); |
Member
There was a problem hiding this comment.
Suggested change
| write(STDERR_FILENO, tsan_state_corruption, sizeof(tsan_state_corruption)); | |
| write(STDERR_FILENO, tsan_state_corruption, sizeof(tsan_state_corruption) - 1); |
JeffBezanson
reviewed
Aug 6, 2020
src/task.c
Outdated
| tsan_destroy_ctx(ptls, &lastt->ctx); | ||
| jl_set_fiber(&t->ctx); // (doesn't return) | ||
| abort(); // unreachable | ||
| } else { |
Member
There was a problem hiding this comment.
Style: line break between } and else
In order for tsan to work, any setjmp/longjmp must be executed while that task's tsan state is active. As a result, we cannot switch the tsan state until said setjmp is completed, but need to do it (as basically the only thing happening) between the setjmp and the subsequent longjmp. To facilitate this without too much disruption, move the tsan state into the jl_ucontext_t, which seems appropriate since it's additional state that needs to be restored on context switch. Also forbid using TSAN from Clang < 11, where the runtime library has bugs that cause us to exhaust the maximum number of allowed mappings.
simeonschaub
pushed a commit
to simeonschaub/julia
that referenced
this pull request
Aug 11, 2020
In order for tsan to work, any setjmp/longjmp must be executed while that task's tsan state is active. As a result, we cannot switch the tsan state until said setjmp is completed, but need to do it (as basically the only thing happening) between the setjmp and the subsequent longjmp. To facilitate this without too much disruption, move the tsan state into the jl_ucontext_t, which seems appropriate since it's additional state that needs to be restored on context switch. Also forbid using TSAN from Clang < 11, where the runtime library has bugs that cause us to exhaust the maximum number of allowed mappings.
ararslan
added a commit
that referenced
this pull request
Feb 19, 2021
This a component of #36929 which happens to fix building on FreeBSD 11. Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Keno
added a commit
that referenced
this pull request
Oct 1, 2021
Looks like #36929 got reverted without comment. Not sure what happened there. Re-apply it to fix TSAN.
Keno
added a commit
that referenced
this pull request
Oct 1, 2021
Looks like #36929 got reverted without comment. Not sure what happened there. Re-apply it to fix TSAN.
Keno
added a commit
that referenced
this pull request
Oct 1, 2021
Looks like #36929 got reverted without comment. Not sure what happened there. Re-apply it to fix TSAN.
vtjnash
pushed a commit
that referenced
this pull request
Oct 3, 2021
Looks like #36929 got reverted without comment. Not sure what happened there. Re-apply it to fix TSAN.
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this pull request
Feb 22, 2022
This reverts commit 15772ba "Update references to tsan state (JuliaLang#42440)", and fixes integration. Looks like JuliaLang#36929 got reverted when trying to simplify the code, but it now isn't legal. Since these must be inlined in the right point in the runtime call/return context, use a macro to ensure that.
LilithHafner
pushed a commit
to LilithHafner/julia
that referenced
this pull request
Mar 8, 2022
This reverts commit 15772ba "Update references to tsan state (JuliaLang#42440)", and fixes integration. Looks like JuliaLang#36929 got reverted when trying to simplify the code, but it now isn't legal. Since these must be inlined in the right point in the runtime call/return context, use a macro to ensure that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order for tsan to work, any setjmp/longjmp must be executed while
that task's tsan state is active. As a result, we cannot switch the
tsan state until said setjmp is completed, but need to do it
(as basically the only thing happening) between the setjmp and the
subsequent longjmp. To facilitate this without too much disruption,
move the tsan state into the jl_ucontext_t, which seems appropriate
since it's additional state that needs to be restored on context
switch.
Also forbid using TSAN from Clang < 11, where the runtime library
has bugs that cause us to exhaust the maximum number of allowed
mappings.
With this, TSAN works, but obviously has a fairly large number of complaints.
For reference, here is my Make.user: