intel / QAT_Engine

Intel QuickAssist Technology( QAT) OpenSSL Engine (an OpenSSL Plug-In Engine) which provides cryptographic acceleration for both hardware and optimized software using Intel QuickAssist Technology enabled Intel platforms. https://developer.intel.com/quickassist
BSD 3-Clause "New" or "Revised" License
408 stars 128 forks source link

qat_sw supported on Ubuntu 18.04 ? #216

Open nanayak opened 2 years ago

nanayak commented 2 years ago

Hi All,

Not an issue. However, want to know if qat_sw has been built and verified on Ubuntu 18.04 ? If yes, any specific release/version of qat_sw to be picked ?

Thanks in advance.

-- Regards, Nayak

Yogaraj-Alamenda commented 2 years ago

@nanayak Not on Ubuntu 18.04 but validated on Ubuntu 20.04. Should work on any Linux OS if it meets crypto_mb software requirements Do you see any issue with Ubuntu 18.04 ?

nanayak commented 2 years ago

Hi Yogaraj,

Thanks for the quick response (as always)! crypto_mb sw requirements indicate upgraded tool chain needs (gcc, binutils etc) as compared to 18.04, hence the query. Any inputs on a specific version of IPP, crypto_mb that works on 18.04 ? (Ref link: https://www.intel.com/content/www/us/en/developer/articles/guide/building-software-acceleration-features-in-the-intel-qat-engine-for-openssl.html)

-- Regards, Nayak

Yogaraj-Alamenda commented 2 years ago

@nanayak crypto_mb needs cmake >3.10 and gcc >= 8.3 . If your system doesnt have this minimum requirement then it is not compatible as these are basic requirements for all the cryto_mb versions AFIK. I could not check this as I dont have Ubuntu18.04 at present.

nanayak commented 2 years ago

Ok. Thanks. On 18.04 I see the following by default:

$ cmake --version cmake version 3.10.2

$ gcc --version gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

nanayak commented 2 years ago

@Yogaraj-Alamenda, I worked with 18.04, upgraded the toolchains as needed to use gcc 8.4, binutils 2.34 and built libqatengine build with reference to existing OpenSSL 1.1.d.

Followed steps as listed at: https://www.intel.com/content/www/us/en/developer/articles/guide/building-software-acceleration-features-in-the-intel-qat-engine-for-openssl.html (as described in the "distribution provided OpenSSL" tab).

The speed test results look similar with and without engine. Am I missing something here ?

Notes:

[admin@ossl_sw_eng] $ ldd libIPSec_MB.so.1 linux-vdso.so.1 (0x00007ffe447c8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc42275e000) /lib64/ld-linux-x86-64.so.2 (0x00007fc4234b9000)

[admin@ossl_sw_eng] $ ldd libcrypto_mb.so.11 linux-vdso.so.1 (0x00007ffff5dc9000) libcrypto.so.1.1 => /opt/lib/openssl/libcrypto.so.1.1 (0x00007f42de3db000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f42ddfea000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f42ddde6000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f42ddbc7000) /lib64/ld-linux-x86-64.so.2 (0x00007f42de8d3000)

[admin@ossl_sw_eng] $ ldd qatengine.so linux-vdso.so.1 (0x00007ffede14f000) libcrypto_mb.so.11 => /home/admin/nnayak/ossl_sw_eng/libcrypto_mb.so.11 (0x00007fba8fec3000) libIPSec_MB.so.1 => /home/admin/nnayak/ossl_sw_eng/libIPSec_MB.so.1 (0x00007fba8f23a000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fba8ee49000) /lib64/ld-linux-x86-64.so.2 (0x00007fba8fdca000) libcrypto.so.1.1 => /opt/lib/openssl/libcrypto.so.1.1 (0x00007fba8e951000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fba8e74d000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fba8e52e000)

[admin@ossl_sw_eng] $ openssl version OpenSSL 1.1.1 11 Sep 2018 (Library: OpenSSL 1.1.1d 10 Sep 2019)

[admin@ossl_sw_eng] $ openssl engine -v qatengine (qatengine) Reference implementation of QAT crypto engine(qat_sw) v0.6.10 (>>>>> I had to fallback to v0.6.10 due to lack of "EVP_PKEY_meth_set_digestverify()") ENABLE_EXTERNAL_POLLING, POLL, ENABLE_HEURISTIC_POLLING, GET_NUM_REQUESTS_IN_FLIGHT, INIT_ENGINE

[admin@~] $ ./cpuid -1 | egrep 'VAES|VPCLM|GFNI|AVX512F|AVX512IFMA' AVX512F: AVX-512 foundation instructions = true AVX512IFMA: fused multiply add = false

Interestingly, with the run, I observed the following numbers in speed test. The results are identical.

a. Vanilla OpenSSL [admin@~] $ taskset 0x1 openssl speed rsa2048 Doing 2048 bits private rsa's for 10s: 8497 2048 bits private RSA's in 9.56s Doing 2048 bits public rsa's for 10s: 309208 2048 bits public RSA's in 9.76s OpenSSL 1.1.1d 10 Sep 2019 built on: Fri Sep 16 00:34:21 2022 UTC options:bn(64,64) rc4(16x,int) des(int) aes(partial) blowfish(ptr) compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG sign verify sign/s verify/s rsa 2048 bits 0.001125s 0.000032s 888.8 31681.1

b. With QAT_SW engine: [admin@~] $ taskset 0x1 openssl speed -engine qatengine -async_jobs 8 rsa2048 engine "qatengine" set. Doing 2048 bits private rsa's for 10s: 8439 2048 bits private RSA's in 9.45s Doing 2048 bits public rsa's for 10s: 299989 2048 bits public RSA's in 9.57s OpenSSL 1.1.1d 10 Sep 2019 built on: Fri Sep 16 00:34:21 2022 UTC options:bn(64,64) rc4(16x,int) des(int) aes(partial) blowfish(ptr) compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG sign verify sign/s verify/s rsa 2048 bits 0.001120s 0.000032s 893.0 31346.8

[admin@~] $ lsb_release -a ... Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic

nanayak commented 2 years ago

Hi,

Got the latest engine working on the setup (18.04 ubuntu), however I see the print "processor unsupported". As its a XEON "8124M" , the SW acceleration will not work. Am I correct ?

Debug notes: [admin@ossl_1.1.1q] $ ./openssl version OpenSSL 1.1.1q 5 Jul 2022

[admin@ossl_1.1.1q] $ ./openssl engine -v qatengine Processor unsupported for QAT_SW - AVX512F = 1, VAES = 0, VPCLMULQDQ = 0 (qatengine) Reference implementation of QAT crypto engine(qat_sw) v0.6.15 ENABLE_EXTERNAL_POLLING, POLL, ENABLE_HEURISTIC_POLLING, GET_NUM_REQUESTS_IN_FLIGHT, INIT_ENGINE, SW_ALGO_BITMAP

[admin@ossl_1.1.1q:] $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz stepping : 4 microcode : 0x2006c0a cpu MHz : 3399.913 cache size : 25344 KB physical id : 0 siblings : 36 core id : 0 cpu cores : 18 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit bogomips : 5999.99 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management:

jackie74 commented 2 years ago

@nanayak . your cpu is 1st generation Xeon scalable Process(x1xxx). SW acceleration could be worked on 3rd generation Xeon scalable process(x3xxx). https://ark.intel.com/content/www/us/en/ark/products/series/204098/3rd-generation-intel-xeon-scalable-processors.html Thank you.

nanayak commented 2 years ago

@jackie74, thank you for the confirmation.