From owner-svn-src-head@freebsd.org Tue Jun 6 15:07:16 2017 Return-Path: Delivered-To: svn-src-head@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 A9E5EBEED46; Tue, 6 Jun 2017 15:07:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 39B0C6FF1A; Tue, 6 Jun 2017 15:07:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v56F7Afl099005 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 6 Jun 2017 18:07:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v56F7Afl099005 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v56F7Atr099004; Tue, 6 Jun 2017 18:07:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 6 Jun 2017 18:07:10 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: Allan Jude , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r316311 - in head: lib/libstand sys/boot/geli sys/boot/i386/gptboot sys/boot/i386/loader sys/boot/i386/zfsboot Message-ID: <20170606150710.GF2088@kib.kiev.ua> References: <201703310004.v2V04W3A043449@repo.freebsd.org> <85ee6ae1-f934-caf6-a219-3d9901f3d277@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85ee6ae1-f934-caf6-a219-3d9901f3d277@selasky.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jun 2017 15:07:16 -0000 On Tue, Jun 06, 2017 at 03:51:26PM +0200, Hans Petter Selasky wrote: > On 03/31/17 02:04, Allan Jude wrote: > > Author: allanjude > > Date: Fri Mar 31 00:04:32 2017 > > New Revision: 316311 > > URL: https://svnweb.freebsd.org/changeset/base/316311 > > > > > > > > Modified: head/sys/boot/i386/zfsboot/zfsboot.c > > ============================================================================== > > --- head/sys/boot/i386/zfsboot/zfsboot.c Thu Mar 30 23:49:57 2017 (r316310) > > +++ head/sys/boot/i386/zfsboot/zfsboot.c Fri Mar 31 00:04:32 2017 (r316311) > > @@ -926,7 +926,7 @@ load(void) > > zfsargs.primary_pool = primary_spa->spa_guid; > > #ifdef LOADER_GELI_SUPPORT > > bcopy(gelipw, zfsargs.gelipw, sizeof(zfsargs.gelipw)); > > - bzero(gelipw, sizeof(gelipw)); > > + explicit_bzero(gelipw, sizeof(gelipw)); > > #else > > zfsargs.gelipw[0] = '\0'; > > #endif > > > > Hi Allan, > > For ARM platforms you'll need to do a write memory barrier before the > explicit_bzero() returns, else the memory can be recovered by > invalidating the memory area by the next thread which is allocating this > memory ??? Note that loader execution is single threaded / single core. As is, it is not possible for the cache invalidation targeting the generic memory in loader to occur. That said, if we consider usage of the explicit_bzero() in more complete environment, then a memory barrier is definitely useless for the stated purpose. After the writing thread issued a barrier, cache is not flushed to RAM. In other words, cache flush is probably worth doing there, as you noted. But this raises a question, shouldn't the explicit_bzero() implementation handle the cache flush ?