-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8367325: [s390x] build failure due to JDK-8361376 #27213
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
Conversation
|
👋 Welcome back amitkumar! A progress list of the required criteria for merging this PR into |
|
@offamitkumar 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 111 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 |
|
@offamitkumar 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
|
|
I think |
|
|
||
| void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) { | ||
| BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); | ||
| __ align(8); // must align the following block which requires atomic updates |
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.
Thanks for fixing this. Rather than aligning at the start, wouldn't it be more maintainable to do
__ align(4, offset() + 2);
before the z_cfi?
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.
That would require much more changes. The barrier sequence is expected to have a fixed size.
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.
OK, then how about we align the beginning using
__ align(4, offset() + 3*6 + 2);
to make it more self-documenting?
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.
Or better: define a constant for 3*6 + 2 and reuse it in class NativeMethodBarrier.
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 updated the code, please have a look now
| OptoReg::Name opto_reg) const; | ||
| #endif // COMPILER2 | ||
|
|
||
| static const int PATCHABLE_INSTRUCTION_OFFSET = 3 * 6 + 2; |
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.
Maybe better call it PATCHABLE_BARRIER_VALUE_OFFSET?
It's no longer the instruction start address.
Or even better: define 2 constants. The version without the +2 is still needed below.
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 given name as PATCHABLE_SEQ_START_OFFSET and PATCHABLE_BARRIER_VALUE_OFFSET. Please let me know if there is better option :)
| #include "code/nativeInst.hpp" | ||
| #include "code/nmethod.hpp" | ||
| #include "gc/shared/barrierSetNMethod.hpp" | ||
| #include "gc/shared/barrierSetAssembler.hpp" |
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.
Should be sorted alphabetically.
| address inst_addr = get_barrier_start_address() + PATCHABLE_INSTRUCTION_OFFSET; | ||
| address inst_addr = get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_INSTRUCTION_OFFSET; | ||
|
|
||
| DEBUG_ONLY(Assembler::is_z_cfi(*((long*)inst_addr))); |
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.
The cfi check needs an adjustment to point to the instruction start, right?
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.
Now It is pointing to z_cfi:
(gdb) x/i inst_addr
0x3ffe500017a: cfi %r0,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.
This line looks broken (already before this PR). Shouldn't it be something like assert(Assembler::is_z_cfi...)?
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.
Will it be good to do something like this and get rid of PATCHABLE_SEQ_START_OFFSET ?:
diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
index 4dc50232c17..807d3cdd899 100644
--- a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
+++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp
@@ -38,10 +38,11 @@ class NativeMethodBarrier: public NativeInstruction {
}
address get_patchable_data_address() const {
+#ifdef ASSERT
address inst_addr = get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_SEQ_START_OFFSET;
-
- DEBUG_ONLY(Assembler::is_z_cfi(*((long*)inst_addr)));
- return inst_addr + 2;
+ assert(Assembler::is_z_cfi(*((long*)inst_addr)), "should be");
+#endif // ASSERT
+ return get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_BARRIER_VALUE_OFFSET;
}
public:|
|
||
| public: | ||
| static const int BARRIER_TOTAL_LENGTH = PATCHABLE_INSTRUCTION_OFFSET + 2*6 + 2; // bytes | ||
| static const int BARRIER_TOTAL_LENGTH = BarrierSetAssembler::PATCHABLE_INSTRUCTION_OFFSET + 2*6; // bytes |
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.
Same here.
|
|
||
| public: | ||
| static const int BARRIER_TOTAL_LENGTH = PATCHABLE_INSTRUCTION_OFFSET + 2*6 + 2; // bytes | ||
| static const int BARRIER_TOTAL_LENGTH = BarrierSetAssembler::PATCHABLE_BARRIER_VALUE_OFFSET + 2*6; // bytes |
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 is very confusing. There are 2 instructions with 6 Bytes and one instruction with 2 Bytes after PATCHABLE_SEQ_START_OFFSET.
| address inst_addr = get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_SEQ_START_OFFSET; | ||
|
|
||
| DEBUG_ONLY(Assembler::is_z_cfi(*((long*)inst_addr))); | ||
| return inst_addr + 2; |
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.
Maybe use get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_BARRIER_VALUE_OFFSET? inst_addr could be removed.
| address inst_addr = get_barrier_start_address() + PATCHABLE_INSTRUCTION_OFFSET; | ||
| address inst_addr = get_barrier_start_address() + BarrierSetAssembler::PATCHABLE_INSTRUCTION_OFFSET; | ||
|
|
||
| DEBUG_ONLY(Assembler::is_z_cfi(*((long*)inst_addr))); |
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 line looks broken (already before this PR). Shouldn't it be something like assert(Assembler::is_z_cfi...)?
| void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) { | ||
| BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); | ||
| __ align(4, __ offset() + PATCHABLE_BARRIER_VALUE_OFFSET); // must align the following block which requires atomic updates | ||
| __ align(4, __ offset() + BARRIER_TOTAL_LENGTH); // must align the following block which requires atomic updates |
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.
Now, this is confusing. We don't want to align the end of the barrier. We need to align the patchable field which is the immediate field of the cfi instruction.
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 couldn't find out better way to keep the main code free from magic numbers, so now there are three constants:
- holding offset to the instruction (cfi)
- holding the offset the the patchable data
- total barrier length.
I guess explanation in .hpp is enough to explain the usecase.
TheRealMDoerr
left a comment
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 correct to me. I only have some minor comments.
|
|
||
| // first 2 bytes are for cfi instruction opcode and next 4 bytes will be the value/data to be patched, | ||
| // so we are skipping first 2 bytes and returning the address of value/data field | ||
| static const int OFFSET_TO_PATCHABLE_DATA = 6 + 6 + 6 + 2; // iihf(6) + iilf(6) + lg(6) + CFI_OPCODE(2) |
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.
OFFSET_TO_PATCHABLE_DATA_INSTRUCTION could be used, here.
|
|
||
| public: | ||
| static const int BARRIER_TOTAL_LENGTH = PATCHABLE_INSTRUCTION_OFFSET + 2*6 + 2; // bytes | ||
| static const int BARRIER_TOTAL_LENGTH = BarrierSetAssembler::BARRIER_TOTAL_LENGTH; |
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.
Is it necessary to replicate it?
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.
It is being used with NativeMethodBarrier, yes I can change it and technically it wouldn't affect anything, but just to keep code change bit shorter, I left it as it is.
| offset += Assembler::instr_len(&start[offset]); | ||
|
|
||
| Assembler::is_z_cfi(*((long*)(start + offset))); | ||
| // it will be assignment operation, So it doesn't matter what value is already present in instr |
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 don't understand what you mean by "it will be assignment operation".
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.
it is just a assignment being done in that method, i.e. instr variable will be just overwritten straightly. So currently whatever value instr holds, it wouldn't not affect the returned-value.
|
@dean-long would it be possible for you to have another look at the latest changes ? |
dean-long
left a comment
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 reasonable to me.
|
thank you so much for the reviews. |
|
Going to push as commit 898fcff.
Your commit was automatically rebased without conflicts. |
|
@offamitkumar Pushed as commit 898fcff. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fixes the SIGLL caused after JDK-8361376.
Issue was with
csinstruction, which requires the address to be aligned. And after this change address at which operating was not aligned.Wisdom from Principle of Z Operations:
Sytax: CS R1,R3,D2(B2)
Sytax: CSY R1,R3,D2(B2)
The second operand of COMPARE AND SWAP (CS, CSY) must be designated on a word boundary.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27213/head:pull/27213$ git checkout pull/27213Update a local copy of the PR:
$ git checkout pull/27213$ git pull https://git.openjdk.org/jdk.git pull/27213/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27213View PR using the GUI difftool:
$ git pr show -t 27213Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27213.diff
Using Webrev
Link to Webrev Comment