8373630: r18_tls should not be modified on Windows AArch64#28808
8373630: r18_tls should not be modified on Windows AArch64#28808swesonga wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back swesonga! A progress list of the required criteria for merging this PR into |
|
@swesonga This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 39 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@pchilano, @theRealAph) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
|
Shouldn't the #ifdef be using R18_RESERVED? |
|
Nice find. It would be really useful to have a test case that reproduces the problem, and also some idea of how likely it is. I bumped the bug to P1 for now. |
Yes, I have changed the condition to R18_RESERVED |
The virtual threads MonitorEnterExit test has a 100% failure repro rate on Windows AArch64 without this change (but it does not fail on macosx-aarch64 without this change, even though x18 is also reserved on macosx-aarch64). I was specifically running the testMutualExclusion parametized test with 0 platform threads and at least 2 virtual threads when investigating this behavior. |
|
I think this is OK for a quick fix for the upcoming release, but in future save/restore should be fixed so that they exclude |
|
/integrate |
|
/sponsor |
|
Going to push as commit a0dd66f.
Your commit was automatically rebased without conflicts. |
|
@theRealAph @swesonga Pushed as commit a0dd66f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
What a bug! @swesonga, are you handling backports? |
Yes, I'm preparing the jdk26u backport this afternoon |
You want to backport to the jdk26 branch not the 26u repo. |
On Windows, r18_tls is used to store the pointer to the current thread's TEB. Therefore, this register should never be modified (see details in register_aarch64.hpp). One scenario that results in the modification of r18_tls involves virtual threads on Windows. Frames are frozen by Continuation::try_preempt on one carrier thread whose registers are saved. When the frame is thawed, execution can continue on a different carrier thread. When this happens, rthread (x28) is fixed to point to the new carrier thread. The continuation then results in restore_live_registers restoring all the saved registers (including the fixed rthread register). However, this also restores x18, which was the TEB pointer for the previous carrier thread, causing the new carrier thread to execute with the TLS of the previous carrier thread. This causes hangs and occasional crashes in the virtual threads jtreg tests on Windows AArch64 that are resolved by this fix.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28808/head:pull/28808$ git checkout pull/28808Update a local copy of the PR:
$ git checkout pull/28808$ git pull https://git.openjdk.org/jdk.git pull/28808/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28808View PR using the GUI difftool:
$ git pr show -t 28808Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28808.diff
Using Webrev
Link to Webrev Comment