From owner-svn-src-head@FreeBSD.ORG Thu Jul 25 07:54:16 2013 Return-Path: Delivered-To: svn-src-head@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 ESMTP id 18AB711A; Thu, 25 Jul 2013 07:54:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id CFE1C234E; Thu, 25 Jul 2013 07:54:15 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 2CB72421F23; Thu, 25 Jul 2013 17:26:18 +1000 (EST) Date: Thu, 25 Jul 2013 17:26:16 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Tim Kientzle Subject: Re: svn commit: r253636 - head/sys/vm In-Reply-To: <201307250348.r6P3mbsG049595@svn.freebsd.org> Message-ID: <20130725171038.O841@besplex.bde.org> References: <201307250348.r6P3mbsG049595@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=YYGEuWhf c=1 sm=1 tr=0 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 a=PO7r1zJSAAAA:8 a=B9HLQOAVcRIA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=AptvzqaXglMA:10 a=FdjqN1yl-l20e4seHRMA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 25 Jul 2013 07:54:16 -0000 On Thu, 25 Jul 2013, Tim Kientzle wrote: > Log: > Clear entire map structure including locks so that the > locks don't accidentally appear to have been already > initialized. > > In particular, this fixes a consistent kernel crash on > armv6 with: > panic: lock "vm map (user)" 0xc09cc050 already initialized > that appeared with r251709. > > PR: arm/180820 > > Modified: > head/sys/vm/vm_map.c > > Modified: head/sys/vm/vm_map.c > ============================================================================== > --- head/sys/vm/vm_map.c Thu Jul 25 03:44:12 2013 (r253635) > +++ head/sys/vm/vm_map.c Thu Jul 25 03:48:37 2013 (r253636) > @@ -239,8 +239,7 @@ vm_map_zinit(void *mem, int size, int fl > vm_map_t map; > > map = (vm_map_t)mem; > - map->nentries = 0; > - map->size = 0; > + memset(map, 0, sizeof(*map)); > mtx_init(&map->system_mtx, "vm map (system)", NULL, MTX_DEF | MTX_DUPOK); > sx_init(&map->lock, "vm map (user)"); > return (0); memset() to value 0 is spelled bzero() in the kernel. Before this commit, vm used normal style in 21 of 28 instances. The style regression is even smaller in kern -- 18 of 169 instances (3 in comments, and 1 of these in a loop doing a memset to a nonzero value, which was required before about FreeBSD-4 since memset() didn't exist in the kernel. memset() is still a slightly pessimized wrapper round bzero() when the value is nonzero, and a more pessimized loop otherwise). In FreeBSD-4, this style bug was not present in vm (0 of 16 instances) and was smaller in kern (6 of 121 instances (3 in comments, and 1 to #define a buggy memset() in terms of bzero() for the other 2)). Bruce