From owner-freebsd-current@freebsd.org Thu Sep 13 08:52:24 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4048A1080E8E for ; Thu, 13 Sep 2018 08:52:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id D385B8814E for ; Thu, 13 Sep 2018 08:52:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id 98B3F1080E8C; Thu, 13 Sep 2018 08:52:23 +0000 (UTC) Delivered-To: current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85A8F1080E8B for ; Thu, 13 Sep 2018 08:52:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19D3088146; Thu, 13 Sep 2018 08:52:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [10.10.158.185] (unknown [185.93.6.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B55ED4EFFF; Thu, 13 Sep 2018 10:52:15 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_C35844C2-83C7-44A3-A1C9-18AC804D6715"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Speed problems with both system openssl and security/openssl-devel Date: Thu, 13 Sep 2018 10:52:08 +0200 In-Reply-To: <43892083.20180913024646@serebryakov.spb.ru> Cc: current@FreeBSD.org, brnrd@FreeBSD.org, jkim@FreeBSD.org To: Lev Serebryakov References: <43892083.20180913024646@serebryakov.spb.ru> X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Sep 2018 08:52:24 -0000 --Apple-Mail=_C35844C2-83C7-44A3-A1C9-18AC804D6715 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 13 Sep 2018, at 01:46, Lev Serebryakov wrote: >=20 > I'm benchmarking new hardware (rather limited one, but still) which > supports AES-NI (Celeron J3160). >=20 > I'm comparing simple "openssl speed aes-256-cbc" and "openssl speed = -evp > aes-256-cbc" on FreeBSD 12-ALPHA4 (built by myself with all debug = options > turned off) and Debian Linux 9.5.0 booted from install DVD (without > installation). >=20 > Simple "openssl speed aes-256-cbc" shows same numbers both in > single-threaded and multi-threaded mode (for all 4 cores). Linux is = marginally faster, > but it is in the margin of measurement error. >=20 > But "openssl speed -evp aes-256-cbc" gives me very disappointing = results. > FreeBSD's openssl is WAY slower than Linux one. It is even slower than > non-evp mode for small blocks. >=20 > Here are results (As reported by openssl, with fractions dropped): >=20 > Lin 18942 20637 21300 57967 58769 58769 > Free 18931 20591 21282 58342 58731 58779 > Lin-evp 97049 151466 183905 194385 197514 197727 > Free-evp 2838 10845 35362 81892 131264 137579 >=20 > Linux have openssl 1.1.0f, and I've tried both system = /usr/bin/openssl (1.0.2p) > and /usr/local/bin/openssl from security/openssl-devel port (1.1.0i), = results are > virtually the same. I have "ASM" and "SSE2" options enabled in port. >=20 > What happens here? Why does FreeBSD's build of openssl use AES-NI so > inefficient? I can't reproduce your findings, at least not on a Core i7-4790K: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes FreeBSD 93454 89077 117328 281016 285456 Ubuntu 93405 88892 114192 122346 120266 FreeBSD-evp 633283 688010 700775 701168 700669 Ubuntu-evp 623889 681075 697211 700505 698460 That was with base openssl 1.0.2p on FreeBSD 12-ALPHA5, and 1.1.0g on Ubuntu 18.04. -Dimitry --Apple-Mail=_C35844C2-83C7-44A3-A1C9-18AC804D6715 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCW5olOAAKCRCwXqMKLiCW o/ydAKCCkZKk7NLRwrHC9zybjRVjK8aSkQCfUeG58R6ezFosk0r+YUEBuXEDiPw= =DF2O -----END PGP SIGNATURE----- --Apple-Mail=_C35844C2-83C7-44A3-A1C9-18AC804D6715--