-
Notifications
You must be signed in to change notification settings - Fork 5.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
8347422: Crash during safepoint handler execution with -XX:+UseAPX #23035
Conversation
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
@jatin-bhateja 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 216 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. ➡️ To integrate this PR with the above commit message to the |
@jatin-bhateja The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Hi @jatin-bhateja, please see my questions in JBS. Should we add a regression test for this? |
Hi Tobias, To stress the validation I generally give preference to EGPRs by changing the static allocation order defined in AD file. We already have regressions in place for this in the following directory. |
Thanks Jatin. In this case I would suggest that we should add a VM stress flag to give preference to EGPRs, or maybe JDK-8343294 is good enough? Do the existing tests trigger this even without |
Technically, randomizing allocation sequence from the same register class is not very useful from the compiler standpoint as it simply ensures that an LRG corresponding to the definition MachOper is never assigned the same register which is already assigned to its neighbors in the interference graph, so it simply picks the next available free register while choosing the color, a change in allocation order will not impact the spilling behavior either, what I am doing is modifying the static allocation order so that we deterministically give preferences to EGPRs over GPRs, this will ensure that all our APX specific assembler support and special handling like the one extended by this patch as exercised throughly.
Yes, but with -XX:+SafepointALot crash hit early. |
It's definitely useful to catch bugs where silent register corruption is never detected because that exact register is not used anywhere else. Or for cases where a specific register is not saved although it should be but we don't notice because that register is not used anywhere else. And we had quite a few bugs like this in the past. Wouldn't such a random register selection also randomly prioritize EGPRs and therefore do the same thing that you did manually? And if not, doesn't that mean that we should definitely add such a stress flag?
Okay, good then. |
I see, Thanks @TobiHartmann, scope of JDK- 8343294 can be extended to cover EGPRs to catch such silent bugs, to stress validating all JVM components I am taking a brute force approach to begin with. You can assign JDK-8343294 to me if Daniel is not active on that.
Let me know if this looks ok for now. |
Hi @jatin-bhateja. Feel free to have a look at JDK-8343294 (and assign yourself). Please ping me for the review when the changeset is ready! |
Hi @TobiHartmann , Please let me know if fix looks ok, JDK-8343294 will be a separate RFE. |
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.
This looks reasonable to me but I'm not an expert in this area so I leave it to someone else to approve.
/reviewers 2
@TobiHartmann |
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 have few comments.
// is why two byte encoding is sufficient here. | ||
// o For safepoint polling instruction like "test %eax,(%r8)", register encoding of BASE | ||
// register of memory operand is 1000, thus we need additional REX prefix in this case, | ||
// there by adding additional byte to instruction encoding. | ||
// o In case BASE register is one of the 32 extended GPR registers available only on targets | ||
// supporting Intel APX extension, then we need to emit two byte REX2 prefix to hold | ||
// most significant two bits of 5 bit register encoding. |
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.
Change two byte
-> two bytes
in two places.
|
||
if (VM_Version::supports_apx_f()) { | ||
__ cmpb(Address(rbx, 0), Assembler::REX2); | ||
__ jcc(Assembler::notEqual, check_rex_prefix); |
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.
Why we not using short branch jccb
here and in following code? We skip only addptr
instruction.
On other hand jccb(Assembler::notEqual, no_adjust) at line 3093 above may be far from target after new code is added. May be use jcc there.
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.
yes, jccb seems more appropriate.
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.
Fixed, there were two other occurrences in near vicinity in the same stubs.
Unlike backward jumps, forward jumps are not auto demoted to short variants by assembler.
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.
Looks good.
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.
LGTM
/integrate |
Going to push as commit 6cc1c0a.
Your commit was automatically rebased without conflicts. |
@jatin-bhateja Pushed as commit 6cc1c0a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This bug fix patch fixes an internal error seen during safepoint handler execution.
The problem occurs due to missing handling for REX2 prefixed polling test instruction.
Manually verified the patch with the -XX:+SafepointALot runtime flag.
Best Regards,
Jatin
PS: Patch will be opened for review after some validation.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23035/head:pull/23035
$ git checkout pull/23035
Update a local copy of the PR:
$ git checkout pull/23035
$ git pull https://git.openjdk.org/jdk.git pull/23035/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23035
View PR using the GUI difftool:
$ git pr show -t 23035
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23035.diff
Using Webrev
Link to Webrev Comment