-
Notifications
You must be signed in to change notification settings - Fork 236
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
8271567: AArch64: AES Galois CounterMode (GCM) interleaved implementation using vector instructions #410
Conversation
👋 Welcome back aph! A progress list of the required criteria for merging this PR into |
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
I have no problem with you smoking whatsoever you like :) But more serious. This isn't a full review but from a quick check it looks like this feature can easily turned off with Thanks for implementing this intrinsic and dowporting to 11u. It closes a real gap between x64 and aarch64, |
I hadn't considered that idea, but it makes sense to turn it off by default. The problem is, I guess, that many customers won't know about it, would have poor performance, and maybe blame AArch64 servers. |
Since this is math-heavy crypto code, I would rather wait for somebody to use/real-test the upstream implementation first. Unfortunately, timing is against us for JDK 18, as it would release only in March, and so if we want JDK 18 to be proven to work first, this would mean slipping the 11u backport to July 2022. So I would propose this: wait another 6..8 weeks to see if AArch64 regressions are reported in mainline, then backport this to 11u for January 2022, disabled by default. Have a 11u-specific issue to remember enabling it by default after JDK 18 graduates and people get exposed to this code by default in JDK 18. This way we could also see some opt-in 11u testing (which is presumably a larger population than JDK 18 adopters). It would also help if we were able to throw some targeted testing for mainline code. Are there known good crypto test suites that could poke the holes in this implementation? |
Now that I wrote this, another question: what about 17u? I think it is easier/cleaner to backport there first. |
OK. I'm not sure that disabling by default much reduces risk, because this patch does a fair bit of refactoring and commoning, even if the fast paths aren't enabled.
Seems reasonable.
Authenticated encryption is mostly self-testing: that's the idea.
The upper layers are passed the auth data, which they check, and the jtreg tests run the intrinsic against the pure-Java code. That should be enough to make sure we don't have an incorrect (but self-consistent) implementation. External test suites might not run for long enough to test the intrinsic. I'll have a look at Wycheproof. |
Mailing list message from Andrew Haley on jdk-updates-dev: On 10/5/21 09:42, Aleksey Shipilev wrote:
https://github.com/openjdk/jdk17u/pull/87 |
I've reworked this to leave the existing code, so that unless |
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 fine to me.
if (FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { | ||
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); | ||
} |
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.
UseAESCTRIntrinsics
is already false
by default, so this seems to be excessive. No harm doing this anyway.
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.
+1
@theRealAph This change now passes all automated pre-integration checks. 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 243 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 |
@theRealAph, could you trigger a GHA run by first checking that it is enabled here - https://github.com/theRealAph/jdk11u-dev/actions - and then merging in current master branch? |
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.
LGTM.
I wish this is on by default, but I understand your concern. UseAESCTRIntrinsics
is a diagnostic parameter. At least, it will allow bravehearts to try it out.
/integrate |
Going to push as commit b3ef0ea.
Your commit was automatically rebased without conflicts. |
@theRealAph Pushed as commit b3ef0ea. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR adds options -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics to the jvm.config files to enable intrinsic support for AES CTR/GCM on ARM64. It improves performance of network communication with S3 a lot on graviton instances. It's enabled in Java 18 by default, which is already released. Therefore risk is minimal. In latest Java (OpenJDK) versions the performance of AES CTR/GCM for AARCH64 was significally improved and it was backported to OpenJDK 11. Backport PR: openjdk/jdk11u-dev#410. Some additional explanation is here: aws/aws-graviton-getting-started#110 (comment) The original OpenJDK issue is here: https://bugs.openjdk.java.net/browse/JDK-8267993 To use that backport we need to enable it explicitly by enabling -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics. It was not enabled by default in the backport because of conservative approach.
This PR adds options -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics to the JVM's options to enable intrinsic support for AES CTR/GCM on ARM64. It improves performance of network communication with S3 a lot on graviton instances. It's enabled in Java 18 by default, which is already released. Therefore risk is minimal. In latest Java (OpenJDK) versions the performance of AES CTR/GCM for AARCH64 was significally improved and it was backported to OpenJDK 11. Backport PR: openjdk/jdk11u-dev#410. Some additional explanation is here: aws/aws-graviton-getting-started#110 (comment) The original OpenJDK issue is here: https://bugs.openjdk.java.net/browse/JDK-8267993 To use that backport we need to enable it explicitly by enabling -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics. It was not enabled by default in the backport because of conservative approach.
This PR adds options -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics to the jvm.config files to enable intrinsic support for AES CTR/GCM on ARM64. It improves performance of network communication with S3 a lot on graviton instances. It's enabled in Java 18 by default, which is already released. Therefore risk is minimal. In latest Java (OpenJDK) versions the performance of AES CTR/GCM for AARCH64 was significally improved and it was backported to OpenJDK 11. Backport PR: openjdk/jdk11u-dev#410. Some additional explanation is here: aws/aws-graviton-getting-started#110 (comment) The original OpenJDK issue is here: https://bugs.openjdk.java.net/browse/JDK-8267993 To use that backport we need to enable it explicitly by enabling -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics. It was not enabled by default in the backport because of conservative approach.
This PR adds options -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics to the JVM's options to enable intrinsic support for AES CTR/GCM on ARM64. It improves performance of network communication with S3 a lot on graviton instances. It's enabled in Java 18 by default, which is already released. Therefore risk is minimal. In latest Java (OpenJDK) versions the performance of AES CTR/GCM for AARCH64 was significally improved and it was backported to OpenJDK 11. Backport PR: openjdk/jdk11u-dev#410. Some additional explanation is here: aws/aws-graviton-getting-started#110 (comment) The original OpenJDK issue is here: https://bugs.openjdk.java.net/browse/JDK-8267993 To use that backport we need to enable it explicitly by enabling -XX:+UnlockDiagnosticVMOptions and -XX:+UseAESCTRIntrinsics. It was not enabled by default in the backport because of conservative approach.
This is a backport of the big AES/GCM patch from JDK head. It's a
major change and it's had very little time (almost a day) to mature in
head, so perhaps it shouldn't be backported to 11 for some time; I
wouldn't be at all surprised if some reviewers' reaction was "What
have you been smoking?" However, there is a good reason for a
backport: OpenJDK on x86 has a major advantage. AES/GCM is an
important cipher, the current AArch64 implementation is much slower
than x86, and some workloads are severely impacted.
I'm open to all arguments about why this should or shouldn't be pushed,
and I'm quite happy to wait for another release cycle or two if people
think that's the best course of action.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk11u-dev pull/410/head:pull/410
$ git checkout pull/410
Update a local copy of the PR:
$ git checkout pull/410
$ git pull https://git.openjdk.java.net/jdk11u-dev pull/410/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 410
View PR using the GUI difftool:
$ git pr show -t 410
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk11u-dev/pull/410.diff