Skip to content

x86:add detection of instruction set on Zhaoxin CPU

zzjianhui requested to merge (removed):fix-padlock into master

Add detection of extended instruction set on Zhaoxin cpu,e.g:ssse3,sha,avx,etc. Set the priority of the algorithm according to the benchmark test result on Zhaoxin cpu.

This is the test result generated using make check.test-suite.log

fixes #1079 (closed)

Benchmark result

CPU: KX-U6780A 2.7GHz 8cores
RAM: 16GB
OS: ubuntu 20.04

Execute gnutls-cli --benchmark-ciphers command. Environment variable GNUTLS_CPUID_OVERRIDE is set to 0x0.

Before the change:

Checking AEAD ciphers, payload size: 16384
            AES-128-GCM 114.81 MB/sec
            AES-128-CCM 60.20 MB/sec
      CHACHA20-POLY1305 132.45 MB/sec

Checking cipher-MAC combinations, payload size: 16384
       SALSA20-256-SHA1 126.70 MB/sec
       AES-128-CBC-SHA1 0.21 GB/sec
       AES-128-CBC-SHA256 102.64 MB/sec
GOST28147-TC26Z-CNT-GOST28147-TC26Z-IMIT 27.41 MB/sec

Checking MAC algorithms, payload size: 16384
           SHA1 0.71 GB/sec
         SHA256 0.63 GB/sec
         SHA512 165.10 MB/sec

GOST28147-TC26Z-IMIT 85.16 MB/sec
    GOSTR341194 33.85 MB/sec
   STREEBOG-512 47.16 MB/sec

Checking ciphers, payload size: 16384
               3DES-CBC 14.74 MB/sec
            AES-128-CBC 1.59 GB/sec
            AES-128-XTS 106.26 MB/sec
            AES-256-XTS 82.00 MB/sec
            SALSA20-256 0.27 GB/sec
                   NULL 8.45 GB/sec
    GOST28147-TC26Z-CNT 40.30 MB/sec

And after applying the changes:

Checking AEAD ciphers, payload size: 16384
            AES-128-GCM 1.00 GB/sec
            AES-128-CCM 0.31 GB/sec
      CHACHA20-POLY1305 132.30 MB/sec

Checking cipher-MAC combinations, payload size: 16384
       SALSA20-256-SHA1 0.23 GB/sec
       AES-128-CBC-SHA1 0.77 GB/sec
       AES-128-CBC-SHA256 0.70 GB/sec
GOST28147-TC26Z-CNT-GOST28147-TC26Z-IMIT 27.36 MB/sec

Checking MAC algorithms, payload size: 16384
           SHA1 1.38 GB/sec
         SHA256 1.11 GB/sec
         SHA512 0.72 GB/sec

GOST28147-TC26Z-IMIT 85.25 MB/sec
    GOSTR341194 33.88 MB/sec
   STREEBOG-512 47.16 MB/sec

Checking ciphers, payload size: 16384
               3DES-CBC 14.76 MB/sec
            AES-128-CBC 1.58 GB/sec
            AES-128-XTS 2.10 GB/sec
            AES-256-XTS 1.68 GB/sec
            SALSA20-256 0.27 GB/sec
                   NULL 8.14 GB/sec
    GOST28147-TC26Z-CNT 40.36 MB/sec

The performance of algorithms AES_128_GCM, AES_128_CCM,SHA,AES_128_XTS have been improved to varying degrees. AES_128_GCM improves performance by approximately 9 times. AES_128_CCM is 5 times. AES_128_XTS is 20 times. SHA is 2~4 times.

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated / NEWS entry present (for non-trivial changes)
  • CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTION.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by zzjianhui

Merge request reports