From owner-svn-src-all@freebsd.org Fri Jul 24 18:19:26 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A20536F124; Fri, 24 Jul 2020 18:19:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BCyCL231rz3gY8; Fri, 24 Jul 2020 18:19:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 262AAEA8F; Fri, 24 Jul 2020 18:19:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06OIJPVd007118; Fri, 24 Jul 2020 18:19:25 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06OIJPBT007115; Fri, 24 Jul 2020 18:19:25 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202007241819.06OIJPBT007115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 24 Jul 2020 18:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363486 - in stable/12: sys/geom/eli tests/sys/geom/class/eli X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: sys/geom/eli tests/sys/geom/class/eli X-SVN-Commit-Revision: 363486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2020 18:19:26 -0000 Author: asomers Date: Fri Jul 24 18:19:25 2020 New Revision: 363486 URL: https://svnweb.freebsd.org/changeset/base/363486 Log: MFC r363014: geli: enable direct dispatch geli does all of its crypto operations in a separate thread pool, so g_eli_start, g_eli_read_done, and g_eli_write_done don't actually do very much work. Enabling direct dispatch eliminates the g_up/g_down bottlenecks, doubling IOPs on my system. This change does not affect the thread pool. Reviewed by: markj Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D25587 Added: stable/12/tests/sys/geom/class/eli/reentrancy_test.sh - copied unchanged from r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh Modified: stable/12/sys/geom/eli/g_eli.c stable/12/tests/sys/geom/class/eli/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/eli/g_eli.c ============================================================================== --- stable/12/sys/geom/eli/g_eli.c Fri Jul 24 17:56:17 2020 (r363485) +++ stable/12/sys/geom/eli/g_eli.c Fri Jul 24 18:19:25 2020 (r363486) @@ -642,6 +642,7 @@ g_eli_read_metadata(struct g_class *mp, struct g_provi gp->orphan = g_eli_orphan_spoil_assert; gp->spoiled = g_eli_orphan_spoil_assert; cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) goto end; @@ -778,6 +779,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, pp = NULL; cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, bpp); if (error != 0) { if (req != NULL) { @@ -865,6 +867,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, * Create decrypted provider. */ pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX); + pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; pp->mediasize = sc->sc_mediasize; pp->sectorsize = sc->sc_sectorsize; Modified: stable/12/tests/sys/geom/class/eli/Makefile ============================================================================== --- stable/12/tests/sys/geom/class/eli/Makefile Fri Jul 24 17:56:17 2020 (r363485) +++ stable/12/tests/sys/geom/class/eli/Makefile Fri Jul 24 18:19:25 2020 (r363486) @@ -16,6 +16,7 @@ ATF_TESTS_SH+= integrity_test ATF_TESTS_SH+= kill_test ATF_TESTS_SH+= misc_test ATF_TESTS_SH+= onetime_test +ATF_TESTS_SH+= reentrancy_test ATF_TESTS_SH+= resize_test ATF_TESTS_SH+= setkey_test Copied: stable/12/tests/sys/geom/class/eli/reentrancy_test.sh (from r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tests/sys/geom/class/eli/reentrancy_test.sh Fri Jul 24 18:19:25 2020 (r363486, copy of r363014, head/tests/sys/geom/class/eli/reentrancy_test.sh) @@ -0,0 +1,69 @@ +# $FreeBSD$ + +# Test various operations for geli-on-geli providers, to ensure that geli is +# reentrant. + +. $(atf_get_srcdir)/conf.sh + +init_test() +{ + cipher=$1 + aalgo=$2 + secsize=$3 + ealgo=${cipher%%:*} + keylen=${cipher##*:} + + atf_check dd if=/dev/random of=testdata bs=$secsize count=1 status=none + atf_check dd if=/dev/random of=keyfile bs=$secsize count=16 status=none + + # Create the lower geli device + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md} + atf_check geli attach -p -k keyfile ${md} + # Create the upper geli device + atf_check -s exit:0 -e ignore \ + geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \ + -s $secsize ${md}.eli + atf_check geli attach -p -k keyfile ${md}.eli + echo ${md} > layered_md_device + + # Ensure we can read and write. + atf_check dd if=testdata of=/dev/${md}.eli.eli bs=$secsize count=1 \ + status=none + atf_check dd if=/dev/${md}.eli.eli of=cmpdata bs=$secsize count=1 \ + status=none + atf_check cmp -s testdata cmpdata + + geli detach ${md}.eli 2>/dev/null +} + +atf_test_case init cleanup +init_head() +{ + atf_set "descr" "Initialize a geli provider on top of another" + atf_set "require.user" "root" + atf_set "timeout" 600 +} +init_body() +{ + sectors=2 + geli_test_setup + + for_each_geli_config init_test +} +init_cleanup() +{ + if [ -f layered_md_device ]; then + while read provider; do + [ -c /dev/${md}.eli.eli ] && \ + geli detach $md.eli.eli 2>/dev/null + done < layered_md_device + fi + geli_test_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case init +}