jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8325821: [REDO] use "dmb.ishst+dmb.ishld" for release barrier

Open kuaiwei opened this issue 1 year ago • 4 comments
trafficstars

he origin patch for https://bugs.openjdk.org/browse/JDK-8324186 has 2 issues: 1 It show regression in some platform, like Apple silicon in mac os 2 Can not handle instruction sequence like "dmb.ishld; dmb.ishst; dmb.ishld; dmb.ishld"

It can be fixed by: 1 Enable AlwaysMergeDMB by default, only disable it in architecture we can see performance improvement (N1 or N2) 2 Check the special pattern and merge the subsequent dmb.

It also fix a bug when code buffer is expanding, st/ld/dmb can not be merged. I added unit tests for these.

This patch still has a unhandled case. Insts like "dmb.ishld; dmb.ishst; dmb.ish", it will merge the last 2 instructions and can not merge all three. Because when emitting dmb.ish, if merge all previous dmbs, the code buffer will shrink the size. I think it may break some resumption and think it's not a common pattern.

In previous PR https://github.com/openjdk/jdk/pull/18467 , I tried an implementation to use state machine for merging. But it looks risky to pending instruction during emitting.


Progress

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

Issue

  • JDK-8325821: [REDO] use "dmb.ishst+dmb.ishld" for release barrier (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19278

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

Using diff file

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

Webrev

Link to Webrev Comment

kuaiwei avatar May 17 '24 08:05 kuaiwei

:wave: Welcome back kuaiwei! 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.

bridgekeeper[bot] avatar May 17 '24 08:05 bridgekeeper[bot]

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

8325821: [REDO] use "dmb.ishst+dmb.ishld" for release barrier

Reviewed-by: shade, aph

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

  • e7dc76b5776e05082281fb640d1592479cfe9e6b: 8333849: (dc) DatagramChannel send/receive fails with UOE if buffer backed by memory segment allocated from shared arena
  • ec1664e8c9413890ce2dae5c2dbbce3449d67882: 8333804: java/net/httpclient/ForbiddenHeadTest.java threw an exception with 0 failures
  • e22fc121aed56dad2eedfdc3a53f2a655c3b200b: 8333775: Small improvement to outputStream auto-indentation mode
  • 7b43a8cd7c663facbe490f889838d7ead0eba0f9: 8333824: Unused ClassValue in VarHandles
  • 5f9d3e3af8342592242cb304b2c219508d56ed3a: 8333722: Fix CompilerDirectives for non-compiler JVM variants
  • 83b34410e326c47f357a37c3a337b7dedb8cbbda: 8322811: jcmd System.dump_map help info has conflicting statements
  • 8aa35cacfcc94d261de102b628eb954c71eae98e: 8333833: Remove the use of ByteArrayLittleEndian from UUID::toString
  • de55db2352f84c101f8197ee7aca80d72807fbc5: 8333522: JFR SwapSpace event might read wrong free swap space size
  • a941397327972f130e683167a1b429f17603df46: 8329031: CPUID feature detection for Advanced Performance Extensions (Intel® APX)
  • 8d2f9e57c3797c01c84df007f4d2bfdcd645d0c0: 8333749: Consolidate ConstantDesc conversion in java.base
  • ... and 71 more: https://git.openjdk.org/jdk/compare/d826127970bd2ae8bf4cacc3c55634dc5af307c4...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev, @theRealAph) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

openjdk[bot] avatar May 17 '24 08:05 openjdk[bot]

@kuaiwei 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[bot] avatar May 17 '24 08:05 openjdk[bot]

This looks ready to me. I think we need jcstress with C1 and C2, and we should be done. @shipilev , do you agree?

theRealAph avatar May 29 '24 11:05 theRealAph

This looks ready to me. I think we need jcstress with C1 and C2, and we should be done. @shipilev , do you agree?

Yes. Just run jcstress with defaults, maybe limiting the time budget to about 24 hours, and we are done. Default configuration would work through different combinations of C1/C2 compilations for all actors, which is what we want to check for this change: that we don't mess up the barrier emitting scheme in different compilers/interpreters.

shipilev avatar May 29 '24 11:05 shipilev

Note that current jcstress run would likely fail due to JDK-8332670.

shipilev avatar May 29 '24 11:05 shipilev

This looks ready to me. I think we need jcstress with C1 and C2, and we should be done. @shipilev , do you agree?

Yes. Just run jcstress with defaults, maybe limiting the time budget to about 24 hours, and we are done. Default configuration would work through different combinations of C1/C2 compilations for all actors, which is what we want to check for this change: that we don't mess up the barrier emitting scheme in different compilers/interpreters.

I can run the jcstress test. I will run fastdebug build with java -jar jcstress-latest.jar -tb 24h Is it the correct command ?

kuaiwei avatar May 30 '24 08:05 kuaiwei

I can run the jcstress test. I will run fastdebug build with java -jar jcstress-latest.jar -tb 24h Is it the correct command ?

Yes, I think so.

shipilev avatar May 30 '24 08:05 shipilev

I can run the jcstress test. I will run fastdebug build with java -jar jcstress-latest.jar -tb 24h Is it the correct command > Yes, I think so.

FTR, I ran Linux AArch64 server release on Graviton 3 instance (ergonomics selects -AlwaysMergeDMB there) for 12 hours. Apart from failures from JDK-8332670, I see no other trouble. Scheduled a quick run with +AlwaysMergeDMB as well.

shipilev avatar May 31 '24 08:05 shipilev

I can run the jcstress test. I will run fastdebug build with java -jar jcstress-latest.jar -tb 24h Is it the correct command > Yes, I think so.

FTR, I ran Linux AArch64 server release on Graviton 3 instance (ergonomics selects -AlwaysMergeDMB there) for 12 hours. Apart from failures from JDK-8332670, I see no other trouble. Scheduled a quick run with +AlwaysMergeDMB as well.

Thanks for testing. I'm running jcstress on a neoverse-n2 instance. I got some "soft errs" in console output. Are they real error?

kuaiwei avatar May 31 '24 10:05 kuaiwei

Thanks for testing. I'm running jcstress on a neoverse-n2 instance. I got some "soft errs" in console output. Are they real error?

Soft errors are API inconsistencies that jcstress harness handled. As long as you don't have new hard errors, you are fine.

shipilev avatar May 31 '24 11:05 shipilev

I can run the jcstress test. I will run fastdebug build with java -jar jcstress-latest.jar -tb 24h Is it the correct command > Yes, I think so.

FTR, I ran Linux AArch64 server release on Graviton 3 instance (ergonomics selects -AlwaysMergeDMB there) for 12 hours. Apart from failures from JDK-8332670, I see no other trouble. Scheduled a quick run with +AlwaysMergeDMB as well.

Thanks for testing. I'm running jcstress on a neoverse-n2 instance. I got some "soft errs" in console output. Are they real error?

My jcstress test is done and no error is reported.

kuaiwei avatar Jun 03 '24 06:06 kuaiwei

Thanks for your review.

kuaiwei avatar Jun 04 '24 02:06 kuaiwei

/integrate

kuaiwei avatar Jun 04 '24 02:06 kuaiwei

@kuaiwei Your change (at version 68c3018cf25c850dab7ab725135e784fa958b140) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Jun 04 '24 02:06 openjdk[bot]

@theRealAph @shipilev Could you help sponsor it ? Thanks.

kuaiwei avatar Jun 04 '24 11:06 kuaiwei

GH says the branch has conflicts that must be resolved. Merging from master is advisable anyway to avoid merge surprises. Let's do that before integrating.

shipilev avatar Jun 04 '24 17:06 shipilev

Given that the first version of the patch had some issues, I would recommend waiting for the fork tomorrow and only integrating this into JDK 24.

TobiHartmann avatar Jun 05 '24 05:06 TobiHartmann

I'll run this through our correctness and performance testing and report back once it passed.

TobiHartmann avatar Jun 05 '24 05:06 TobiHartmann

I'll run this through our correctness and performance testing and report back once it passed.

How was it, Tobias? Any surprises?

shipilev avatar Jun 07 '24 09:06 shipilev

Sorry for the delay, I had to re-run a subset of the benchmarks due to high variance. All green now.

TobiHartmann avatar Jun 10 '24 09:06 TobiHartmann

Sorry for the delay, I had to re-run a subset of the benchmarks due to high variance. All green now.

Great, thanks for testing.

I think we are ready to integrate this now.

shipilev avatar Jun 10 '24 09:06 shipilev

/integrate

kuaiwei avatar Jun 10 '24 12:06 kuaiwei

@kuaiwei Your change (at version 0afa69325052643dbf3b0bd752d822ee062884bb) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Jun 10 '24 12:06 openjdk[bot]

/sponsor

shipilev avatar Jun 10 '24 12:06 shipilev

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

  • e7dc76b5776e05082281fb640d1592479cfe9e6b: 8333849: (dc) DatagramChannel send/receive fails with UOE if buffer backed by memory segment allocated from shared arena
  • ec1664e8c9413890ce2dae5c2dbbce3449d67882: 8333804: java/net/httpclient/ForbiddenHeadTest.java threw an exception with 0 failures
  • e22fc121aed56dad2eedfdc3a53f2a655c3b200b: 8333775: Small improvement to outputStream auto-indentation mode
  • 7b43a8cd7c663facbe490f889838d7ead0eba0f9: 8333824: Unused ClassValue in VarHandles
  • 5f9d3e3af8342592242cb304b2c219508d56ed3a: 8333722: Fix CompilerDirectives for non-compiler JVM variants
  • 83b34410e326c47f357a37c3a337b7dedb8cbbda: 8322811: jcmd System.dump_map help info has conflicting statements
  • 8aa35cacfcc94d261de102b628eb954c71eae98e: 8333833: Remove the use of ByteArrayLittleEndian from UUID::toString
  • de55db2352f84c101f8197ee7aca80d72807fbc5: 8333522: JFR SwapSpace event might read wrong free swap space size
  • a941397327972f130e683167a1b429f17603df46: 8329031: CPUID feature detection for Advanced Performance Extensions (Intel® APX)
  • 8d2f9e57c3797c01c84df007f4d2bfdcd645d0c0: 8333749: Consolidate ConstantDesc conversion in java.base
  • ... and 71 more: https://git.openjdk.org/jdk/compare/d826127970bd2ae8bf4cacc3c55634dc5af307c4...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Jun 10 '24 12:06 openjdk[bot]

@shipilev @kuaiwei Pushed as commit 2a242db01ed1d502affa4a954e601266fa98dfbe.

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

openjdk[bot] avatar Jun 10 '24 12:06 openjdk[bot]