Skip to content
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

8274527: Minimal VM build fails after JDK-8273459 #5764

Closed
wants to merge 2 commits into from

Conversation

DamonFool
Copy link
Member

@DamonFool DamonFool commented Sep 29, 2021

Hi all,

The broken was observed when

(gdb) bt
#0  MacroAssembler::align (this=0x7ffff0025b98, modulus=32) at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/macroAssembler_x86.cpp:1182
#1  0x00007ffff67fc6c5 in MacroAssembler::kernel_crc32 (this=0x7ffff0025b98, crc=0x7, buf=0x6, len=0x2, table=0x1, tmp=0xb)
    at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/macroAssembler_x86.cpp:6911
#2  0x00007ffff69a3555 in StubGenerator::generate_updateBytesCRC32 (this=0x7ffff5e9c900) at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp:6532
#3  0x00007ffff69a589b in StubGenerator::generate_initial (this=0x7ffff5e9c900) at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp:7583
#4  0x00007ffff69a6801 in StubGenerator::StubGenerator (this=0x7ffff5e9c900, code=0x7ffff5e9c9c0, all=false)
    at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp:7909
#5  0x00007ffff697fa21 in StubGenerator_generate (code=0x7ffff5e9c9c0, all=false) at /home/jvm/jiefu/docker/jdk/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp:7919
#6  0x00007ffff69a6c13 in StubRoutines::initialize1 () at /home/jvm/jiefu/docker/jdk/src/hotspot/share/runtime/stubRoutines.cpp:223
#7  0x00007ffff69a790d in stubRoutines_init1 () at /home/jvm/jiefu/docker/jdk/src/hotspot/share/runtime/stubRoutines.cpp:366
#8  0x00007ffff672044d in init_globals () at /home/jvm/jiefu/docker/jdk/src/hotspot/share/runtime/init.cpp:119
#9  0x00007ffff69fb39f in Threads::create_vm (args=0x7ffff5e9ce10, canTryAgain=0x7ffff5e9cd33) at /home/jvm/jiefu/docker/jdk/src/hotspot/share/runtime/thread.cpp:2827
#10 0x00007ffff6787879 in JNI_CreateJavaVM_inner (vm=0x7ffff5e9ce68, penv=0x7ffff5e9ce70, args=0x7ffff5e9ce10)
    at /home/jvm/jiefu/docker/jdk/src/hotspot/share/prims/jni.cpp:3616
#11 0x00007ffff6787a72 in JNI_CreateJavaVM (vm=0x7ffff5e9ce68, penv=0x7ffff5e9ce70, args=0x7ffff5e9ce10)
    at /home/jvm/jiefu/docker/jdk/src/hotspot/share/prims/jni.cpp:3704
#12 0x00007ffff79b8141 in InitializeJVM (pvm=0x7ffff5e9ce68, penv=0x7ffff5e9ce70, ifn=0x7ffff5e9cec0)
    at /home/jvm/jiefu/docker/jdk/src/java.base/share/native/libjli/java.c:1459
#13 0x00007ffff79b4f39 in JavaMain (_args=0x7fffffffb1a0) at /home/jvm/jiefu/docker/jdk/src/java.base/share/native/libjli/java.c:411
#14 0x00007ffff79bba79 in ThreadJavaMain (args=0x7fffffffb1a0) at /home/jvm/jiefu/docker/jdk/src/java.base/unix/native/libjli/java_md.c:651
#15 0x00007ffff779cea5 in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff72c19fd in clone () from /lib64/libc.so.6

In this case, modulus=32 and CodeEntryAlignment=16.

So this assert shouldn't be added in align since we may use it (modulus > CodeEntryAlignment) in highly optimized hand-crafted assembly code.

Thanks.
Best regards,
Jie


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8274527: Minimal VM build fails after JDK-8273459

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5764/head:pull/5764
$ git checkout pull/5764

Update a local copy of the PR:
$ git checkout pull/5764
$ git pull https://git.openjdk.java.net/jdk pull/5764/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5764

View PR using the GUI difftool:
$ git pr show -t 5764

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5764.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 29, 2021

👋 Welcome back jiefu! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Sep 29, 2021
@openjdk
Copy link

openjdk bot commented Sep 29, 2021

@DamonFool The following label will be automatically applied to this pull request:

  • hotspot

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.

@openjdk openjdk bot added the hotspot label Sep 29, 2021
@mlbridge
Copy link

mlbridge bot commented Sep 29, 2021

Webrevs

@asgibbons
Copy link
Contributor

asgibbons commented Sep 30, 2021

Hi, Jie. With a value of 16 for CodeEntryAlignment, there is no way to ensure that the address of the byte following the align(32) is, in fact, 32-byte aligned. This is the exact case that I found that caused me to file the bug. I would suggest you verify this with an assert following your align(32) verifying that the alignment is correct. I think you'll discover that it will be unaligned ~50% of the time.

This is because align() uses the offset from the beginning of the segment to determine the number of nops to emit. If the segment has the starting address 0xXXXXXX10 (16-byte aligned), align(32) will calculate the offset() and align the pc to a multiple of 32 bytes from this starting address. This means that the address after the align(32) has the possibility of being 0xXXXXXX30 about half the time.

I would suggest that if you absolutely require 32-byte alignment, you take a similar path that I took for 64-byte alignment. That is, to create align32() and have it call align(32, pc()). This will ensure (for stub code) that the alignment is correct.

@DamonFool
Copy link
Member Author

DamonFool commented Sep 30, 2021

Hi, Jie. With a value of 16 for CodeEntryAlignment, there is no way to ensure that the address of the byte following the align(32) is, in fact, 32-byte aligned. This is the exact case that I found that caused me to file the bug. I would suggest you verify this with an assert following your align(32) verifying that the alignment is correct. I think you'll discover that it will be unaligned ~50% of the time.

This is because align() uses the offset from the beginning of the segment to determine the number of nops to emit. If the segment has the starting address 0xXXXXXX10 (16-byte aligned), align(32) will calculate the offset() and align the pc to a multiple of 32 bytes from this starting address. This means that the address after the align(32) has the possibility of being 0xXXXXXX30 about half the time.

I would suggest that if you absolutely require 32-byte alignment, you take a similar path that I took for 64-byte alignment. That is, to create align32() and have it call align(32, pc()). This will ensure (for stub code) that the alignment is correct.

Ah, you are right.
I missed that align is with the offset() not the pc().
So the assert should make sense.

Updated.
Thanks.

@asgibbons
Copy link
Contributor

asgibbons commented Sep 30, 2021

Looks good to me.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

@openjdk
Copy link

openjdk bot commented Sep 30, 2021

@DamonFool 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:

8274527: Minimal VM build fails after JDK-8273459

Reviewed-by: kvn

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 15 new commits pushed to the master branch:

  • 7326481: 8274393: Suppress more warnings on non-serializable non-transient instance fields in security libs
  • 8215b2e: 8274398: Suppress more warnings on non-serializable non-transient instance fields in management libs
  • 9573022: 8253197: vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java fails with "ERROR: DebuggeeSleepingThread: ThreadDeath lost"
  • f08180f: 8274501: c2i entry barriers read int as long on AArch64
  • c57ed22: 8274528: Add comment to explain an HKDF optimization in SSLSecretDerivation
  • 9180d9a: 8273216: JCMD does not work across container boundaries with Podman
  • 3e0d7c3: 8270290: NTLM authentication fails if HEAD request is used
  • bfd6163: 8274196: Crashes in VM_HeapDumper::work after JDK-8252842
  • bb95dda: 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
  • 2f955d6: 8273142: Remove dependancy of TestHttpServer, HttpTransaction, HttpCallback from open/test/jdk/sun/net/www/protocol/http/ tests
  • ... and 5 more: https://git.openjdk.java.net/jdk/compare/355356c405adb9287b786b0b045c2eb974d2ffca...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Sep 30, 2021
@DamonFool
Copy link
Member Author

DamonFool commented Sep 30, 2021

Thanks @asgibbons and @vnkozlov for your review.
/integrate

@openjdk
Copy link

openjdk bot commented Sep 30, 2021

Going to push as commit a8edd1b.
Since your change was applied there have been 15 commits pushed to the master branch:

  • 7326481: 8274393: Suppress more warnings on non-serializable non-transient instance fields in security libs
  • 8215b2e: 8274398: Suppress more warnings on non-serializable non-transient instance fields in management libs
  • 9573022: 8253197: vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java fails with "ERROR: DebuggeeSleepingThread: ThreadDeath lost"
  • f08180f: 8274501: c2i entry barriers read int as long on AArch64
  • c57ed22: 8274528: Add comment to explain an HKDF optimization in SSLSecretDerivation
  • 9180d9a: 8273216: JCMD does not work across container boundaries with Podman
  • 3e0d7c3: 8270290: NTLM authentication fails if HEAD request is used
  • bfd6163: 8274196: Crashes in VM_HeapDumper::work after JDK-8252842
  • bb95dda: 8248001: javadoc generates invalid HTML pages whose ftp:// links are broken
  • 2f955d6: 8273142: Remove dependancy of TestHttpServer, HttpTransaction, HttpCallback from open/test/jdk/sun/net/www/protocol/http/ tests
  • ... and 5 more: https://git.openjdk.java.net/jdk/compare/355356c405adb9287b786b0b045c2eb974d2ffca...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 30, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 30, 2021
@openjdk
Copy link

openjdk bot commented Sep 30, 2021

@DamonFool Pushed as commit a8edd1b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@DamonFool DamonFool deleted the JDK-8274527 branch Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot integrated
3 participants