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

8288282: Zero-release build is broken after JDK-8279047 due to UseHeavyMonitors is read-only #9138

Closed
wants to merge 4 commits into from

Conversation

DamonFool
Copy link
Member

@DamonFool DamonFool commented Jun 11, 2022

Hi all,

Zero-release build is broken after JDK-8279047.
After JDK-8279047, UseHeavyMonitors becomes read-only in PRODUCT VMs.

But for Zero, UseHeavyMonitors needs to be reset if DiagnoseSyncOnValueBasedClasses != 0.

  // If lock diagnostics is needed, always call to runtime
  if (DiagnoseSyncOnValueBasedClasses != 0) {
    FLAG_SET_DEFAULT(UseHeavyMonitors, true);
  }

I never hear that people would DiagnoseSyncOnValueBasedClasses with zero vms.
So in order to expire UseHeavyMonitors for all PRODUCT VMs, I suggest disabling lock diagnostics for zero vms.

Thanks.
Best regards,
Jie


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8288282: Zero-release build is broken after JDK-8279047 due to UseHeavyMonitors is read-only

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9138/head:pull/9138
$ git checkout pull/9138

Update a local copy of the PR:
$ git checkout pull/9138
$ git pull https://git.openjdk.org/jdk pull/9138/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9138

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9138.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 11, 2022

👋 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 Pull request is ready for review label Jun 11, 2022
@openjdk
Copy link

openjdk bot commented Jun 11, 2022

@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 hotspot-dev@openjdk.org label Jun 11, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 11, 2022

Webrevs

@dholmes-ora
Copy link
Member

@DamonFool , sorry I missed this when expiring UseHeavyMonitors in product mode. The Zero code should have been fixed long before now. But why not make keep the diagnostics available in the debug VM?

@DamonFool
Copy link
Member Author

But why not make keep the diagnostics available in the debug VM?

Updated.
What do you think of this version?
Thanks.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Thanks

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, that would break:

CONF=linux-x86_64-zero-release make exploded-test TEST=runtime/Monitor/SyncOnValueBasedClassTest.java

java.lang.RuntimeException: 'fatal error: Synchronizing on object' missing from stdout/stderr 

I think the patch should just be:

diff --git a/src/hotspot/cpu/zero/vm_version_zero.cpp b/src/hotspot/cpu/zero/vm_version_zero.cpp
index 5c2a0a3d5d2..df6c7f0eba2 100644
--- a/src/hotspot/cpu/zero/vm_version_zero.cpp
+++ b/src/hotspot/cpu/zero/vm_version_zero.cpp
@@ -47,7 +47,8 @@ void VM_Version::initialize() {
 
   // If lock diagnostics is needed, always call to runtime
   if (DiagnoseSyncOnValueBasedClasses != 0) {
-    FLAG_SET_DEFAULT(UseHeavyMonitors, true);
+    warning("Lock diagnostics is not available on this CPU");
+    FLAG_SET_DEFAULT(DiagnoseSyncOnValueBasedClasses, 0);
   }
 
   if (UseAESIntrinsics) {
diff --git a/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java
index 394a92c0398..1793ba2e0d7 100644
--- a/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java
+++ b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java
@@ -31,6 +31,7 @@ import java.util.stream.*;
  * @bug 8242263
  * @summary Exercise DiagnoseSyncOnValueBasedClasses diagnostic flag
  * @requires vm.flagless
+ * @requires vm.flavor != "zero"
  * @library /test/lib
  * @run driver/timeout=180000 SyncOnValueBasedClassTest
  */

@DamonFool
Copy link
Member Author

Unfortunately, that would break:

CONF=linux-x86_64-zero-release make exploded-test TEST=runtime/Monitor/SyncOnValueBasedClassTest.java

java.lang.RuntimeException: 'fatal error: Synchronizing on object' missing from stdout/stderr 

Good catch.
So let's disable the test for zero-release VMs.

I think it's fine to keep the diagnostics for zero debug VM in case someone might use it while debugging.
Thanks.

@shipilev
Copy link
Member

I think it's fine to keep the diagnostics for zero debug VM in case someone might use it while debugging. Thanks.

Let's not force VM into different option settings in release and fastdebug, that's just calling for trouble. Disable DiagnoseSyncOnValueBasedClasses wholesale for Zero and disable the test, like my patch did.

@DamonFool
Copy link
Member Author

Let's not force VM into different option settings in release and fastdebug, that's just calling for trouble.

So what's the trouble would be?

There are many VM flags which are only available for debug VMs.

./share/runtime/globals.hpp:  develop(bool, LargePagesIndividualAllocationInjectError, false,           \
./share/runtime/globals.hpp:  develop(bool, TracePcPatching, false,                                     \
./share/runtime/globals.hpp:  develop(bool, TraceRelocator, false,                                      \
./share/runtime/globals.hpp:  develop(bool, VerifyStack, false,                                         \
./share/runtime/globals.hpp:  develop(bool, TraceDerivedPointers, false,                                \
./share/runtime/globals.hpp:  develop(bool, TraceCallFixup, false,                                      \
./share/runtime/globals.hpp:  develop(bool, DeoptimizeALot, false,                                      \
./share/runtime/globals.hpp:  develop(bool, DeoptimizeRandom, false,                                    \
./share/runtime/globals.hpp:  develop(bool, DeoptimizeObjectsALot, false,                               \
./share/runtime/globals.hpp:  develop(uint64_t, DeoptimizeObjectsALotInterval, 5,                       \
./share/runtime/globals.hpp:  develop(int, DeoptimizeObjectsALotThreadCountSingle, 1,                   \
./share/runtime/globals.hpp:  develop(int, DeoptimizeObjectsALotThreadCountAll, 1,                      \
./share/runtime/globals.hpp:  develop(bool, VerifyStackAtCalls, false,                                  \
./share/runtime/globals.hpp:  develop(bool, TraceJavaAssertions, false,                                 \
./share/runtime/globals.hpp:  develop(bool, UseMallocOnly, false,                                       \
./share/runtime/globals.hpp:  develop(bool, ZapResourceArea, trueInDebug,                               \
./share/runtime/globals.hpp:  develop(bool, ZapUnusedHeapArea, trueInDebug,                             \
./share/runtime/globals.hpp:  develop(bool, CheckZapUnusedHeapArea, false,                              \
./share/runtime/globals.hpp:  develop(bool, ZapFillerObjects, trueInDebug,                              \
./share/runtime/globals.hpp:  develop(uintx, ErrorHandlerTest, 0,                                       \
./share/runtime/globals.hpp:  develop(uintx, TestCrashInErrorHandler, 0,                                \
./share/runtime/globals.hpp:  develop(bool, TestSafeFetchInErrorHandler, false   ,                      \
./share/runtime/globals.hpp:  develop(bool, TestUnresponsiveErrorHandler, false,                        \
./share/runtime/globals.hpp:  develop(bool, Verbose, false,                                             \
./share/runtime/globals.hpp:  develop(bool, PrintMiscellaneous, false,                                  \
./share/runtime/globals.hpp:  develop(bool, WizardMode, false,                                          \
./share/runtime/globals.hpp:  develop(bool, VerifyAdapterSharing, false,                                \
./share/runtime/globals.hpp:  develop(bool, PrintDebugInfo, false,                                      \
./share/runtime/globals.hpp:  develop(bool, PrintRelocations, false,                                    \
./share/runtime/globals.hpp:  develop(bool, PrintDependencies, false,                                   \
./share/runtime/globals.hpp:  develop(bool, PrintExceptionHandlers, false,                              \
./share/runtime/globals.hpp:  develop(bool, StressCompiledExceptionHandlers, false,                     \
./share/runtime/globals.hpp:  develop(bool, InterceptOSException, false,                                \
./share/runtime/globals.hpp:  develop(bool, PrintCodeCache2, false,                                     \
./share/runtime/globals.hpp:  develop(bool, RegisterReferences, true,                                   \
./share/runtime/globals.hpp:  develop(bool, PrintCodeCacheExtension, false,                             \
./share/runtime/globals.hpp:  develop(bool, UsePrivilegedStack, true,                                   \
./share/runtime/globals.hpp:  develop(bool, LoadLineNumberTables, true,                                 \
./share/runtime/globals.hpp:  develop(bool, LoadLocalVariableTables, true,                              \
./share/runtime/globals.hpp:  develop(bool, LoadLocalVariableTypeTables, true,                          \
./share/runtime/globals.hpp:  develop(uintx, PreallocatedOutOfMemoryErrorCount, 4,                      \
./share/runtime/globals.hpp:  develop(bool, StressRewriter, false,                                      \
./share/runtime/globals.hpp:  develop(bool, TraceBytecodes, false,                                      \
./share/runtime/globals.hpp:  develop(bool, TraceICs, false,                                            \
./share/runtime/globals.hpp:  develop(bool, TraceInlineCacheClearing, false,                            \
./share/runtime/globals.hpp:  develop(bool, TraceDependencies, false,                                   \
./share/runtime/globals.hpp:  develop(bool, VerifyDependencies, trueInDebug,                            \
./share/runtime/globals.hpp:  develop(bool, TraceNewOopMapGeneration, false,                            \
./share/runtime/globals.hpp:  develop(bool, TraceNewOopMapGenerationDetailed, false,                    \
./share/runtime/globals.hpp:  develop(bool, TimeOopMap, false,                                          \
./share/runtime/globals.hpp:  develop(bool, TimeOopMap2, false,                                         \
./share/runtime/globals.hpp:  develop(bool, TraceOopMapRewrites, false,                                 \
./share/runtime/globals.hpp:  develop(bool, TraceICBuffer, false,                                       \
./share/runtime/globals.hpp:  develop(bool, TraceCompiledIC, false,                                     \
./share/runtime/globals.hpp:  develop(bool, FLSVerifyDictionary, false,                                 \
./share/runtime/globals.hpp:  develop(bool, TraceFinalizerRegistration, false,                          \
./share/runtime/globals.hpp:  develop(bool, InjectCompilerCreationFailure, false,                       \
./share/runtime/globals.hpp:  develop(bool, GenerateSynchronizationCode, true,                          \
./share/runtime/globals.hpp:  develop(bool, GenerateRangeChecks, true,                                  \
./share/runtime/globals.hpp:  develop(bool, UseCHA, true,                                               \
./share/runtime/globals.hpp:  develop(bool, TraceMethodReplacement, false,                              \
./share/runtime/globals.hpp:  develop(bool, PrintMethodFlushing, false,                                 \
./share/runtime/globals.hpp:  develop(bool, StressCodeBuffers, false,                                   \
./share/runtime/globals.hpp:  develop(bool, UseHeavyMonitors, false,                                    \
./share/runtime/globals.hpp:  develop(bool, VerifyHeavyMonitors, false,                                 \
./share/runtime/globals.hpp:  develop(bool, DebugVtables, false,                                        \
./share/runtime/globals.hpp:  develop(bool, TraceCreateZombies, false,                                  \
./share/runtime/globals.hpp:  develop(bool, TypeProfileCasts,  true,                                    \
./share/runtime/globals.hpp:  develop(bool, TraceLivenessGen, false,                                    \
./share/runtime/globals.hpp:  develop(intx, FastAllocateSizeLimit, 128*K,                               \
./share/runtime/globals.hpp:  develop(bool, CountCompiledCalls, false,                                  \
./share/runtime/globals.hpp:  develop(bool, UseFastSignatureHandlers, true,                             \
./share/runtime/globals.hpp:  develop(bool, CountBytecodes, false,                                      \
./share/runtime/globals.hpp:  develop(bool, PrintBytecodeHistogram, false,                              \
./share/runtime/globals.hpp:  develop(bool, PrintBytecodePairHistogram, false,                          \
./share/runtime/globals.hpp:  develop(bool, VerifyOops, false,                                          \
./share/runtime/globals.hpp:  develop(bool, CheckUnhandledOops, false,                                  \
./share/runtime/globals.hpp:  develop(bool, VerifyJNIFields, trueInDebug,                               \
./share/runtime/globals.hpp:  develop(bool, VerifyFPU, false,                                           \
./share/runtime/globals.hpp:  develop(bool, VerifyThread, false,                                        \
./share/runtime/globals.hpp:  develop(bool, VerifyActivationFrameSize, false,                           \
./share/runtime/globals.hpp:  develop(bool, TraceFrequencyInlining, false,                              \
./share/runtime/globals.hpp:  develop(bool, VerifyDataPointer, trueInDebug,                             \
./share/runtime/globals.hpp:  develop(intx, CounterHalfLifeTime,    30,                                 \
./share/runtime/globals.hpp:  develop(intx, CounterDecayMinIntervalLength,   500,                       \
./share/runtime/globals.hpp:  develop(bool, PrintDeoptimizationDetails, false,                          \
./share/runtime/globals.hpp:  develop(bool, DebugDeoptimization, false,                                 \
./share/runtime/globals.hpp:  develop(intx, MallocCatchPtr, -1,                                         \
./share/runtime/globals.hpp:  develop(intx, StackPrintLimit, 100,                                       \
./share/runtime/globals.hpp:  develop(intx, MaxForceInlineLevel, 100,                                   \
./share/runtime/globals.hpp:  develop(intx, MethodHistogramCutoff, 100,                                 \
./share/runtime/globals.hpp:  develop(intx, DontYieldALotInterval,    10,                               \
./share/runtime/globals.hpp:  develop(intx, BciProfileWidth,      2,                                    \
./share/runtime/globals.hpp:  develop(intx, InlineThrowCount,    50,                                    \
./share/runtime/globals.hpp:  develop(intx, InlineThrowMaxSize,   200,                                  \
./share/runtime/globals.hpp:  develop(size_t, CompressedClassSpaceBaseAddress, 0,                       \
./share/runtime/globals.hpp:  develop(bool, MetaspaceGuardAllocations, false,                           \
./share/runtime/globals.hpp:  develop(intx, BinarySwitchThreshold, 5,                                   \
./share/runtime/globals.hpp:  develop(intx, StopInterpreterAt, 0,                                       \
./share/runtime/globals.hpp:  develop(intx, TraceBytecodesAt, 0,                                        \
./share/runtime/globals.hpp:  develop(intx, NewCodeParameter,      0,                                   \
./share/runtime/globals.hpp:  develop(intx, MinOopMapAllocation,     8,                                 \
./share/runtime/globals.hpp:  develop(bool, LoomDeoptAfterThaw, false,                                  \
./share/runtime/globals.hpp:  develop(bool, LoomVerifyAfterThaw, false,                                 \
./share/runtime/globals.hpp:  develop(bool, VerifyContinuations, false,                                 \
./share/runtime/globals.hpp:  develop(bool, UseContinuationFastPath, true,                              \
./share/runtime/globals.hpp:  develop(int, VerifyMetaspaceInterval, DEBUG_ONLY(500) NOT_DEBUG(0),       \
./share/runtime/globals.hpp:  develop(bool, TraceMemoryWriteback, false,                                \
./share/runtime/globals.hpp:  develop(bool, VerifyCrossModifyFence,                                     \
./share/runtime/globals.hpp:  develop(bool, TraceOptimizedUpcallStubs, false,                              \

@shipilev
Copy link
Member

Let's not force VM into different option settings in release and fastdebug, that's just calling for trouble.

So what's the trouble would be?
There are many VM flags which are only available for debug VMs.

Those flags are usually having the same value for release and debug VMs. Your current patch changes the flag values depending on VM mode, which exposes potentially different behaviors depending on VM mode. Imagine chasing a bug in release VM that does not reproduce in debug VM, those are not fun. Let's not do that. It would be all around easier and safer. to just disable to flag in all VM modes.

The block your patch is modifying is added by me in JDK-8273486, I say we just redo it without involving UseHeavyMonitors at all, and just disable the test that is affected by it.

@DamonFool
Copy link
Member Author

DamonFool commented Jun 13, 2022

The block your patch is modifying is added by me in JDK-8273486, I say we just redo it without involving UseHeavyMonitors at all, and just disable the test that is affected by it.

Okay.
I didn't notice that you're the original author of the code.
Updated.
Thanks.

@dholmes-ora
Copy link
Member

It made more sense to me to keep what was the existing debug behaviour, but I don't have any interest in Zero at all, so whatever you want to do @shipilev is fine by me.

@DamonFool
Copy link
Member Author

Thanks @dholmes-ora and @shipilev for the review.
/integrate

@openjdk
Copy link

openjdk bot commented Jun 13, 2022

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

8288282: Zero-release build is broken after JDK-8279047 due to UseHeavyMonitors is read-only

Reviewed-by: dholmes, shade

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

  • 33ed036: 8283775: better dump: VM support for graph querying in debugger with BFS traversal and node filtering
  • ac28be7: 8283612: IGV: Remove Graal module
  • 0cb0ecf: 8209935: Test to cover CodeSource.getCodeSigners()

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Pull request is ready to be integrated label Jun 13, 2022
@DamonFool
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 13, 2022

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

  • 0207d76: 8287926: AArch64: intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long
  • 33ed036: 8283775: better dump: VM support for graph querying in debugger with BFS traversal and node filtering
  • ac28be7: 8283612: IGV: Remove Graal module
  • 0cb0ecf: 8209935: Test to cover CodeSource.getCodeSigners()

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 13, 2022
@openjdk openjdk bot closed this Jun 13, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 13, 2022
@openjdk
Copy link

openjdk bot commented Jun 13, 2022

@DamonFool Pushed as commit 4aede33.

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

@DamonFool DamonFool deleted the JDK-8288282 branch June 13, 2022 14:38
@openjdk
Copy link

openjdk bot commented Jun 13, 2022

@DamonFool The command integrate can only be used in open pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants