-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Enable TLS on linux/arm64 only for static resolver #106052
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have the same problem on native aot too. It can be looked at in separate PR.
Also, the new test may need disabling for native aot.
thread_local int tls16; | ||
|
||
extern "C" DLLEXPORT void initializeTLS() { | ||
tls0=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the unused thread locals get optimized out? Do we need to access them to prevent them from being optimized out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, I didn't see them getting optimized out with a chk build, which is where this test really works, but setting every value is trivial to add to the test, so I'll do that.
Co-authored-by: Jan Kotas <[email protected]>
/backport to release/8.0-staging |
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/10292791888 |
@davidwrighton backporting to release/8.0-staging failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Enable TLS on linux/arm64 only for static resolver
Using index info to reconstruct a base tree...
M src/coreclr/vm/arm64/asmhelpers.S
M src/coreclr/vm/threadstatics.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/threadstatics.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/threadstatics.cpp
Auto-merging src/coreclr/vm/arm64/asmhelpers.S
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Enable TLS on linux/arm64 only for static resolver
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@davidwrighton an error occurred while backporting to release/8.0-staging, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
I have checked the native aot code and it seems to be fine (details of what we generate are at |
Fix arm64 behavior around assuming that a static resolver is possible for Arm64 TLS at all times.
Instead, detect whether the static resolver path was taken, and if it was, use the static path.
In addition, this change adds a new config variable DOTNET_DisableOptimizedThreadStaticAccess which can be used to mitigate this issue in case issues are found in other optimized thread static access paths.
Finally, the test for this relies on adding a new switch to the corerun utility, which can pre-load a set of .so files into the process.
This is an evolution of PR #104408.