From owner-freebsd-security@FreeBSD.ORG Fri Feb 14 14:25:25 2014 Return-Path: Delivered-To: freebsd-security@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F1C0774; Fri, 14 Feb 2014 14:25:25 +0000 (UTC) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 00E871C42; Fri, 14 Feb 2014 14:25:23 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id E4DF1C61; Fri, 14 Feb 2014 15:25:16 +0100 (CET) Date: Fri, 14 Feb 2014 15:26:52 +0100 From: Pawel Jakub Dawidek To: freebsd-security@FreeBSD.org, arch@FreeBSD.org Subject: Re: CFR: unifing sha256 userland/kernel implementation... Message-ID: <20140214142652.GA1661@garage.freebsd.pl> References: <20140211185639.GK34851@funkthat.com> <20140212003907.GM34851@funkthat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <20140212003907.GM34851@funkthat.com> X-OS: FreeBSD 11.0-CURRENT amd64 User-Agent: Mutt/1.5.22 (2013-10-16) X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2014 14:25:25 -0000 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 11, 2014 at 04:39:07PM -0800, John-Mark Gurney wrote: > John-Mark Gurney wrote this message on Tue, Feb 11, 2014 at 10:56 -0800: > > I did some performance testing on sha256, and found that the libmd > > version is significantly faster, ~20%, than the kernel version. Even > > if you enable SHA2_UNROLL_TRANSFORM (which isn't the default), the > > version in libmd is still faster. > >=20 > > So, this patch moves libmd's sha256c.c and sha256.h into the kernel, > > and adapts the userland to pull the version from the kernel. This > > change removes sha256 from the existing sha2.c file, and does some > > minor cleanup of types in sha2. > >=20 > > I have tested this w/ ZFS using sha256 checksums, and a ZFS made > > pre-patch is read fine by a kernel post patch. I have also run > > the tests in lib/libmd and they all pass fine. Passes > > buildworld/buildkernel/installkernel/reboot/installworld/reboot/test. > >=20 > > Patch: > > https://www.funkthat.com/~jmg/sha256.kern.patch > >=20 > > Following stats are in seconds to digest 100000 10000-byte blocks, > > calculated using sha256 -t: > > $ ministat soft.times kernsoft.times=20 > > x soft.times > > + kernsoft.times > > +----------------------------------------------------------------------= --------+ > > |x xx xx +++ + = +| > > | |___________AM_________| |_______M_____A______________| = | > > +----------------------------------------------------------------------= --------+ > > N Min Max Median Avg St= ddev > > x 5 6.775387 8.279581 7.848128 7.792094 0.6091= 2664 > > + 5 8.997429 10.768921 9.090787 9.4359144 0.7504= 0822 > > Difference at 95.0% confidence > > 1.64382 +/- 0.99674 > > 21.096% +/- 12.7917% > > (Student's t, pooled s =3D 0.683428) > >=20 > > This is in preperation of bringing in an SSE4 accelerated version of > > sha256 (for both userland and kernel) that sees a 2x performance > > increase. I can't wait:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --huq684BweRXVnRxX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iEYEARECAAYFAlL+J6wACgkQForvXbEpPzQndgCglshTIuytaOOPgOPHPoGBE9D5 kHcAoNRC15/8Gk2aUD+6AtD7akEr/8ng =IhpC -----END PGP SIGNATURE----- --huq684BweRXVnRxX--