-
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
[Release/6.0] Backporting recent fixes related to AVX and suspension. #66120
Conversation
* Use CopyContext to restore saved context on X86 * PR feedback * more PR feedback
…net#65825) * Do not copy XState other than AVX * #if defined(TARGET_X86) || defined(TARGET_AMD64) * mask XState unconditionally * Ensure XSTATE_MASK_AVX is set before calling EEGetThreadContext * redundant supportsAVX, more clear comment * PR feedback
* null-check the redirect context before using. * tweak the comment * do not allocate context if InitializeContext has unexpected results.
…net#65878) * RestoreContextSimulated * probe for RtlRestoreContext * ntdll.dll * restore self-trap sequence * PR feedback * Clarify CopyContext in RedirectedHandledJITCaseExceptionFilter * simpler indentation. * restore last error on the legacy path. * Update src/coreclr/vm/threads.h Co-authored-by: Dan Moseley <[email protected]>
CC:@agocke |
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.
Approved. We should take for consideration in 6.0.x
/backport to release/5.0 |
Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/1929796872 |
@agocke backporting to release/5.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Use CopyContext to restore saved context on X86 (#65490)
Using index info to reconstruct a base tree...
A src/coreclr/vm/threadsuspend.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/src/vm/threadsuspend.cpp
Applying: Do not copy XState other than AVX when redirecting for GC stress (#65825)
.git/rebase-apply/patch:53: trailing whitespace.
//
.git/rebase-apply/patch:55: trailing whitespace.
//
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
A src/coreclr/vm/threadsuspend.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/src/vm/threadsuspend.cpp
Applying: null-check the redirect context before using. (#65910)
Using index info to reconstruct a base tree...
A src/coreclr/vm/threadsuspend.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/src/vm/threadsuspend.cpp
CONFLICT (content): Merge conflict in src/coreclr/src/vm/threadsuspend.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 null-check the redirect context before using. (#65910)
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@agocke your backport attempt to 5.0 failed. Just to make sure I'm understanding it correctly, this error does not affect the ability to merge this PR, correct? Can I already merge this since it is already |
Yup, this one can be merged. I'll do the backport for 5.0 and 3.1 manually. |
* Use CopyContext to restore saved context on X86 (#65490) * Use CopyContext to restore saved context on X86 * PR feedback * more PR feedback * Do not copy XState other than AVX when redirecting for GC stress (#65825) * Do not copy XState other than AVX * #if defined(TARGET_X86) || defined(TARGET_AMD64) * mask XState unconditionally * Ensure XSTATE_MASK_AVX is set before calling EEGetThreadContext * redundant supportsAVX, more clear comment * PR feedback * null-check the redirect context before using. (#65910) * null-check the redirect context before using. * tweak the comment * do not allocate context if InitializeContext has unexpected results. * EE Suspension on x86 should use RtlRestoreContext when available (#65878) * RestoreContextSimulated * probe for RtlRestoreContext * ntdll.dll * restore self-trap sequence * PR feedback * Clarify CopyContext in RedirectedHandledJITCaseExceptionFilter * simpler indentation. * restore last error on the legacy path. * Update src/coreclr/vm/threads.h Co-authored-by: Dan Moseley <[email protected]> Co-authored-by: Vladimir Sadov <[email protected]> Co-authored-by: Dan Moseley <[email protected]>
Port of a fix for #65292 and issues found along the way related to AVX registers and EE suspension.
Customer Impact
It is relatively easy to end up running AVX-accelerated code nowdays. Copying or comparing arrays or spans, using buffered IO are just some examples.
Issues with storing/restoring AVX context during EE suspension could result in:
Testing
Regular test passes.
Risk
Medium.
The code involved is fairly old. We keep discovering assumptions that may no longer hold. We have seen cases where fixing one bug exposes another. To our knowledge these fixes are robust, but this is a delicate area.