[10] RFR(XS): 8194494: SHA-512 stub uses AVX 2 instructions on non-supporting CPUs
Tobias Hartmann
tobias.hartmann at oracle.com
Fri Jan 5 08:20:16 UTC 2018
On 04.01.2018 19:06, matecs wrote:
>> How did you check that no SHA instructions are used?
> you're right, i just run a quick test on 2 boxes with the newly compiled jre,
> and my interpretation is completely based on guess: i'm used to see
> bigger numbers...:)
> now i've done a more extensive test, i involved more kind of cpus (*),
> some without avx, some with sha+avx, some without avs+sha, and i can
> confirm that when avx+sha both found in cpuid, then i can measure
> about two times more sha2 throughput without the -XX:-UseSHA option
> than with the default -XX:+UseSHA, so again, sha2 intrinsic works
> with the patch as expected...
Okay, thanks a lot for verifying!
Best regards,
Tobias
> *: these cpus were involved:
>
> Intel(R) Xeon(R) CPU E5-2640 v3
> Intel(R) Xeon(R) CPU E5-2650 v2
> Intel(R) Xeon(R) CPU E5620
> Intel(R) Xeon(R) CPU L5640
> Intel(R) Xeon(R) CPU E5606
> Intel(R) Xeon(R) CPU E5-2650L v4
> Intel(R) Core(TM) i5-4200M
> Intel(R) Core(TM)2 Duo CPU E6400
> Intel(R) Celeron(R) 2955U
> Dual-Core AMD Opteron(tm) Processor 2216
> Intel(R) Celeron(R) CPU J3455
> Intel(R) Celeron(R) CPU N3350
>
> freerouter runs on these, and the autoupgrade uses both sha512
> and sha256 during it's operation, this is how i noticed the issue
> on celerons, the others works without the patch too.
>
> regards,
>
> csaba mate
>
>
>>
>> Best regards,
>> Tobias
>>> mc36 at player:~/jre/bin$ ./java -version
>>> openjdk version "9-internal"
>>> OpenJDK Runtime Environment (build 9-internal+0-adhoc.mc36.jdk9)
>>> OpenJDK 64-Bit Server VM (build 9-internal+0-adhoc.mc36.jdk9, mixed mode)
>>> mc36 at player:~/jre/bin$ ./java -jar /safe/src/src/rtr.jar test crypto
>>> aes: 618131 rnd, 632966144 bytes, 3 sec, 205975 pps, 1687mbps
>>> blowfish: 76307 rnd, 78138368 bytes, 3 sec, 25427 pps, 208mbps
>>> 3des: 13551 rnd, 13876224 bytes, 3 sec, 4515 pps, 36mbps
>>> des: 32947 rnd, 33737728 bytes, 3 sec, 10978 pps, 89mbps
>>> rc2: 43106 rnd, 44140544 bytes, 3 sec, 14363 pps, 117mbps
>>> md2: 12870 rnd, 13178880 bytes, 3 sec, 4288 pps, 35mbps
>>> md5: 49721 rnd, 50914304 bytes, 3 sec, 16568 pps, 135mbps
>>> sha1: 49745 rnd, 50938880 bytes, 3 sec, 16576 pps, 135mbps
>>> sha256: 50830 rnd, 52049920 bytes, 3 sec, 16937 pps, 138mbps
>>> sha384: 42972 rnd, 44003328 bytes, 3 sec, 14319 pps, 117mbps
>>> sha512: 42997 rnd, 44028928 bytes, 3 sec, 14327 pps, 117mbps
>>> hmac-md2: 10985 rnd, 11248640 bytes, 3 sec, 3660 pps, 29mbps
>>> hmac-md5: 41570 rnd, 42567680 bytes, 3 sec, 13852 pps, 113mbps
>>> hmac-sha1: 42608 rnd, 43630592 bytes, 3 sec, 14197 pps, 116mbps
>>> hmac-sha256: 40003 rnd, 40963072 bytes, 3 sec, 13329 pps, 109mbps
>>> hmac-sha384: 30728 rnd, 31465472 bytes, 3 sec, 10239 pps, 83mbps
>>> hmac-sha512: 30505 rnd, 31237120 bytes, 3 sec, 10164 pps, 83mbps
>>> error cfg.cfgInit.stopRouter:cfgInit.java:745 shutdown code=1 reason=finished
>>> mc36 at player:~/jre/bin$
>>>
>>>
>>> mc36 at mediapc:~/jre/bin$ ./java -jar /safe/src/src/rtr.jar test crypto
>>> aes: 340851 rnd, 349031424 bytes, 3 sec, 113579 pps, 930mbps
>>> blowfish: 47741 rnd, 48886784 bytes, 3 sec, 15908 pps, 130mbps
>>> 3des: 8761 rnd, 8971264 bytes, 3 sec, 2919 pps, 23mbps
>>> des: 24891 rnd, 25488384 bytes, 3 sec, 8294 pps, 67mbps
>>> rc2: 33098 rnd, 33892352 bytes, 3 sec, 11028 pps, 90mbps
>>> md2: 8770 rnd, 8980480 bytes, 3 sec, 2922 pps, 23mbps
>>> md5: 34564 rnd, 35393536 bytes, 3 sec, 11517 pps, 94mbps
>>> sha1: 36215 rnd, 37084160 bytes, 3 sec, 12067 pps, 98mbps
>>> sha256: 34091 rnd, 34909184 bytes, 3 sec, 11359 pps, 93mbps
>>> sha384: 31332 rnd, 32083968 bytes, 3 sec, 10440 pps, 85mbps
>>> sha512: 30960 rnd, 31703040 bytes, 3 sec, 10316 pps, 84mbps
>>> hmac-md2: 7952 rnd, 8142848 bytes, 3 sec, 2649 pps, 21mbps
>>> hmac-md5: 29842 rnd, 30558208 bytes, 3 sec, 9944 pps, 81mbps
>>> hmac-sha1: 30471 rnd, 31202304 bytes, 3 sec, 10153 pps, 83mbps
>>> hmac-sha256: 28544 rnd, 29229056 bytes, 3 sec, 9511 pps, 77mbps
>>> hmac-sha384: 22197 rnd, 22729728 bytes, 3 sec, 7396 pps, 60mbps
>>> hmac-sha512: 21893 rnd, 22418432 bytes, 3 sec, 7295 pps, 59mbps
>>> error cfg.cfgInit.stopRouter:cfgInit.java:745 shutdown code=1 reason=finished
>>> mc36 at mediapc:~/jre/bin$
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 01/03/2018 05:49 PM, Tobias Hartmann wrote:
>>>> Hi,
>>>>
>>>> please review the following patch:
>>>> https://bugs.openjdk.java.net/browse/JDK-8194494
>>>> http://cr.openjdk.java.net/~thartmann/8194494/webrev.00/
>>>>
>>>> The VM crashes with SIGILL on CPUs that have the SHA extension but no AVX 2 support because since JDK-8165381 the
>>>> SHA-512 stub uses AVX 2 instructions (for example, 'vpblendd'). In addition to UseSHA, we need to check for
>>>> supports_avx2() && supports_bmi2() on x86.
>>>>
>>>> I had no suitable machine available for testing but I was able to trigger the problem by enforcing
>>>> UseSHA512Intrinsics=true on my machine and disabling AVX 2 support (see comments in the bug for details).
>>>>
>>>> This problem was reported by Csaba Mate [1].
>>>>
>>>> Thanks,
>>>> Tobias
>>>>
>>>> [1] http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2018-January/028002.html
>>>>
More information about the hotspot-compiler-dev
mailing list