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

8255047: Add HotSpot UseDebuggerErgo flags #763

Closed
wants to merge 2 commits into from

Conversation

stefank
Copy link
Member

@stefank stefank commented Oct 20, 2020

Some debuggers don't work well with many threads, and/or incompletely restricts the number of used CPUs to one.

This flag is intended as a catch-all for HotSpot developers (not available in product builds) to allow us to more easily use those debuggers.

Currently, the proposal is to let the flag fix a few things:

  1. Turn down the number of JVM threads
  2. Turn off NUMA
  3. Force processor_id() to return 0 instead of values above processor_count()

(1) is purely ergonomics: gdb, rr, valgrind is faster and seems to work much better with fewer threads. The values would still be overridable by devs.

(2) and (3) deals with the fact that some debuggers change the reported processor count, but don't change the processor ids returned by sched_getcpu. This causes problems for ZGC and NUMA, that both assumes that they can rely on os::processor_id() < os::processor_count().

The current proposed flag name is -XX:+LimitedCPUsDebugging. I'm not entirely happy with that name, but I been able to find a better name.

An alternative to having one flag, is to split this into two flags, and maybe that would solve the naming problem. However, the usability aspects will be worse.

If we can't find a suitable name, I rather introduce a flag called:
-XX:DebuggerWorkarounds or -XX:DebuggerWorkaround1

Any suggestions / opinions? I really do want to at least fix the (2, 3) problem, because I keep having to add this to every single branch I'm working on.


Progress

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

Testing

Linux x32 Linux x64 Windows x64 macOS x64
Build ✔️ (1/1 passed) ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ❌ (1/9 failed) ✔️ (9/9 passed)

Failed test task

Issue

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/763/head:pull/763
$ git checkout pull/763

@stefank
Copy link
Member Author

stefank commented Oct 20, 2020

/label add hotspot

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 20, 2020

👋 Welcome back stefank! 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 rfr Pull request is ready for review hotspot hotspot-dev@openjdk.org labels Oct 20, 2020
@openjdk
Copy link

openjdk bot commented Oct 20, 2020

@stefank
The hotspot label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Oct 20, 2020

Webrevs

@dcubed-ojdk
Copy link
Member

dcubed-ojdk commented Oct 20, 2020

Perhaps: UseDebuggerErgo for the main option name with
UseDebuggerErgo1 ... UseDebuggerErgoN for the suboptions
where UseDebuggerErgo enables all the numbered
UseDebuggerErgo<X> options in one go.

Update: Yes, this is the way that I have always wished that
UseNewCode* worked.

@stefank
Copy link
Member Author

stefank commented Oct 21, 2020

@dcubed-ojdk Thanks for the suggestion. I like it.

@stefank
Copy link
Member Author

stefank commented Oct 21, 2020

I've updated the patch with the suggestion from Dan. The flags now work as follows:
-XX:+UseDebuggerErgo turns on all ergonomics / workarounds
-XX:-/+UseDebuggerErgo1 fixes processor id vs processor count problems
-XX:-/+UseDebuggerErgo2 limits the number of JVM threads and turns off NUMA

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

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

Thumbs up.

}
#endif

assert(id >= 0 && id < _processor_count, "Invalid processor id [%d]", id);
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding the bad id value to the assert() output.

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.

LGTM!

Thanks,
David

@stefank
Copy link
Member Author

stefank commented Oct 22, 2020

Thanks @dcubed-ojdk and @dholmes-ora!

@stefank
Copy link
Member Author

stefank commented Oct 22, 2020

/integrate

@openjdk
Copy link

openjdk bot commented Oct 22, 2020

@stefank This PR has not yet been marked as ready for integration.

@stefank stefank changed the title 8255047: Add HotSpot flag to use with debuggers that restrict the CPU… 8255047: Add HotSpot UseDebuggerErgo flags Oct 22, 2020
@openjdk
Copy link

openjdk bot commented Oct 22, 2020

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

8255047: Add HotSpot UseDebuggerErgo flags

Reviewed-by: dcubed, dholmes

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

  • 211bb62: 8255124: KeepAliveStreamCleaner may crash with java.lang.IllegalMonitorStateException: current thread is not owner
  • 299e115: 8198395: Test javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java fails in mach5
  • a5b7bc5: 7156347: javax/swing/JList/6462008/bug6462008.java fails
  • b25d894: 8252204: AArch64: Implement SHA3 accelerator/intrinsic
  • 7d3d4da: 8240709: Enable javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java on all L&F
  • 5d26229: 8255174: Vector API unit tests for missed public api code coverage
  • b9186be: 6606767: resexhausted00[34] fail assert(!thread->owns_locks(), "must release all locks when leaving VM")
  • 1191a63: 8199697: FIPS 186-4 RSA Key Generation
  • 60d3fa2: 8255022: Documentation missing for Vector API zero methods
  • 9ade94b: 8206311: Add docs-javase, docs-reference to CI build
  • ... and 63 more: https://git.openjdk.java.net/jdk/compare/21e67e54604e60f57106be32d48ba75ebf8c1130...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 Pull request is ready to be integrated label Oct 22, 2020
@stefank
Copy link
Member Author

stefank commented Oct 22, 2020

/integrate

@openjdk openjdk bot closed this Oct 22, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 22, 2020
@openjdk
Copy link

openjdk bot commented Oct 22, 2020

@stefank Since your change was applied there have been 73 commits pushed to the master branch:

  • 211bb62: 8255124: KeepAliveStreamCleaner may crash with java.lang.IllegalMonitorStateException: current thread is not owner
  • 299e115: 8198395: Test javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java fails in mach5
  • a5b7bc5: 7156347: javax/swing/JList/6462008/bug6462008.java fails
  • b25d894: 8252204: AArch64: Implement SHA3 accelerator/intrinsic
  • 7d3d4da: 8240709: Enable javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java on all L&F
  • 5d26229: 8255174: Vector API unit tests for missed public api code coverage
  • b9186be: 6606767: resexhausted00[34] fail assert(!thread->owns_locks(), "must release all locks when leaving VM")
  • 1191a63: 8199697: FIPS 186-4 RSA Key Generation
  • 60d3fa2: 8255022: Documentation missing for Vector API zero methods
  • 9ade94b: 8206311: Add docs-javase, docs-reference to CI build
  • ... and 63 more: https://git.openjdk.java.net/jdk/compare/21e67e54604e60f57106be32d48ba75ebf8c1130...master

Your commit was automatically rebased without conflicts.

Pushed as commit ae72b52.

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

@stefank stefank deleted the 8255047_debugger_workarounds branch October 22, 2020 13:09
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
3 participants