From owner-freebsd-questions@freebsd.org Sun Nov 22 11:03:39 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 058F0A35A51 for ; Sun, 22 Nov 2015 11:03:39 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBC1E1E9E for ; Sun, 22 Nov 2015 11:03:38 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date; bh=XkkNWz4j0sWp6+QWCeBH1I7lYRxkXEpNrY0NPXFUgbw=; b=YYhOPb8GeK/MGusag5lEv9wTqtGj9iuencKfEIkHZh6nB9V8yqWhUZl+9p0cL2r/JfQR5PnEGwl/r+AHq7KT/pciOnMF7EDIr8ZMuP8pY+l2YEq4Mu7GxkEgjTje83t9M2IA16GCvbQvSFffeQTEie6vNsWbq57fa8dLWPK+Y6o=; Received: from [178.137.225.202] (helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1a0SQc-000MxA-53 for freebsd-questions@freebsd.org; Sun, 22 Nov 2015 13:03:30 +0200 Date: Sun, 22 Nov 2015 13:03:29 +0200 From: Ivan Klymenko To: RW via freebsd-questions Subject: Re: cryptodev HW (aesni) vs software Message-ID: <20151122130329.6ea9b9c6@nonamehost.local> In-Reply-To: <20151120192920.119bbf91@gumby.homeunix.com> References: <20151120200325.2baade9c@nonamehost.local> <20151120192920.119bbf91@gumby.homeunix.com> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=178.137.225.202; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2015 11:03:39 -0000 On Fri, 20 Nov 2015 19:29:20 +0000 RW via freebsd-questions wrote: > On Fri, 20 Nov 2015 20:03:25 +0200 > Ivan Klymenko wrote: > > > Hello everybody. > > What's happening? > > > > root@nonamehost:/ # openssl speed -evp aes-128-cbc -elapsed -engine > > cryptodev engine "cryptodev" set. > > I'm not really sure what the actual question was, but IIRC you > shouldn't load cryptodev if the CPU has AES-NI because it gets used by > default and it's faster to allow openssl to use AES-NI instructions > directly. You may not see the problem. There are two identical server hardware 1) FreeBSD and cryptodev/aesni: openssl speed -evp aes-128-cbc -elapsed You have chosen to measure elapsed time instead of user CPU time. Doing aes-128-cbc for 3s on 16 size blocks: 1546914 aes-128-cbc's in 3.05s Doing aes-128-cbc for 3s on 64 size blocks: 1442599 aes-128-cbc's in 3.01s Doing aes-128-cbc for 3s on 256 size blocks: 1230228 aes-128-cbc's in 3.05s Doing aes-128-cbc for 3s on 1024 size blocks: 783365 aes-128-cbc's in 3.00s Doing aes-128-cbc for 3s on 8192 size blocks: 184665 aes-128-cbc's in 3.03s OpenSSL 1.0.1p-freebsd 9 Jul 2015 built on: date not available options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx) compiler: clang The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-128-cbc 8123.28k 30695.51k 103364.39k 267388.59k 499060.02k 2) Ubuntu default (aesni module is load): openssl speed -evp aes-128-cbc -elapsed You have chosen to measure elapsed time instead of user CPU time. Doing aes-128-cbc for 3s on 16 size blocks: 122663419 aes-128-cbc's in 3.00s Doing aes-128-cbc for 3s on 64 size blocks: 32869514 aes-128-cbc's in 3.00s Doing aes-128-cbc for 3s on 256 size blocks: 8368810 aes-128-cbc's in 3.00s Doing aes-128-cbc for 3s on 1024 size blocks: 2101689 aes-128-cbc's in 3.00s Doing aes-128-cbc for 3s on 8192 size blocks: 263094 aes-128-cbc's in 3.00s OpenSSL 1.0.1f 6 Jan 2014 built on: Thu Jun 11 15:28:12 UTC 2015 options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx) compiler: cc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-128-cbc 654204.90k 701216.30k 714138.45k 717376.51k 718422.02k 3)FreeBSD and only aesni: openssl speed -evp aes-128-cbc -elapsed You have chosen to measure elapsed time instead of user CPU time. Doing aes-128-cbc for 3s on 16 size blocks: 98895809 aes-128-cbc's in 3.01s Doing aes-128-cbc for 3s on 64 size blocks: 26629435 aes-128-cbc's in 3.01s Doing aes-128-cbc for 3s on 256 size blocks: 6850987 aes-128-cbc's in 3.02s Doing aes-128-cbc for 3s on 1024 size blocks: 1719734 aes-128-cbc's in 3.02s Doing aes-128-cbc for 3s on 8192 size blocks: 215447 aes-128-cbc's in 3.02s OpenSSL 1.0.1p-freebsd 9 Jul 2015 built on: date not available options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx) compiler: clang The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes aes-128-cbc 526074.33k 566619.04k 580085.64k 583961.07k 583753.37k I hope the problem has now become more visible? Thanks!