From owner-svn-src-head@FreeBSD.ORG Thu Dec 25 01:31:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F1F38C1; Thu, 25 Dec 2014 01:31:28 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 616F63098; Thu, 25 Dec 2014 01:31:27 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Y3xGw-0005tv-9y; Thu, 25 Dec 2014 01:31:26 +0000 Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sBP1VO18020636; Wed, 24 Dec 2014 18:31:24 -0700 (MST) (envelope-from ian@freebsd.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/knMmIW7Lz6IZCqYAIx3tY Message-ID: <1419471084.1018.160.camel@freebsd.org> Subject: Re: svn commit: r276187 - head/sys/arm/arm From: Ian Lepore To: Rui Paulo Date: Wed, 24 Dec 2014 18:31:24 -0700 In-Reply-To: <8E8B7FE3-0C97-4A84-BC1D-1C5A0E732D0C@me.com> References: <201412241712.sBOHCqvW039381@svn.freebsd.org> <20141224222637.03a19e57@bender> <1419460812.1018.157.camel@freebsd.org> <8E8B7FE3-0C97-4A84-BC1D-1C5A0E732D0C@me.com> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.8 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Turner X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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 Dec 2014 01:31:28 -0000 On Wed, 2014-12-24 at 17:05 -0800, Rui Paulo wrote: > On Dec 24, 2014, at 14:40, Ian Lepore wrote: > > > > On Wed, 2014-12-24 at 22:26 +0000, Andrew Turner wrote: > >> On Wed, 24 Dec 2014 17:12:52 +0000 (UTC) > >> Ian Lepore wrote: > >> > >>> Author: ian > >>> Date: Wed Dec 24 17:12:51 2014 > >>> New Revision: 276187 > >>> URL: https://svnweb.freebsd.org/changeset/base/276187 > >>> > >>> Log: > >>> Eliminate unnecessary references to pte.h internals by using the > >>> standard pmap_kenter_temporary() to map pages while dumping. > >>> > >>> Submitted by: Svatopluk Kraus , > >>> Michal Meloun > >>> > >>> Modified: > >>> head/sys/arm/arm/dump_machdep.c > >>> > >>> Modified: head/sys/arm/arm/dump_machdep.c > >>> ============================================================================== > >>> --- head/sys/arm/arm/dump_machdep.c Wed Dec 24 16:11:15 > >>> 2014 (r276186) +++ head/sys/arm/arm/dump_machdep.c Wed > >>> Dec 24 17:12:51 2014 (r276187) @@ -160,11 +160,13 @@ static int > >>> cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg) > >>> { > >>> struct dumperinfo *di = (struct dumperinfo*)arg; > >>> - vm_paddr_t pa; > >>> + vm_paddr_t a, pa; > >>> + void *va; > >>> uint32_t pgs; > >>> size_t counter, sz, chunk; > >>> - int c, error; > >>> + int i, c, error; > >>> > >>> + va = 0; > >>> error = 0; /* catch case in which chunk size is 0 */ > >>> counter = 0; > >>> pgs = mdp->md_size / PAGE_SIZE; > >>> @@ -194,16 +196,14 @@ cb_dumpdata(struct md_pa *mdp, int seqnr > >>> printf(" %d", pgs * PAGE_SIZE); > >>> counter &= (1<<24) - 1; > >>> } > >>> - if (pa == (pa & L1_ADDR_BITS)) { > >>> - pmap_kenter_section(0, pa & L1_ADDR_BITS, 0); > >>> - cpu_tlb_flushID_SE(0); > >>> - cpu_cpwait(); > >>> + for (i = 0; i < chunk; i++) { > >>> + a = pa + i * PAGE_SIZE; > >>> + va = pmap_kenter_temporary(trunc_page(a), i); > >> > >> Is this correct? It may map multiple chunks here. > >>> } > >>> #ifdef SW_WATCHDOG > >>> wdog_kern_pat(WD_LASTVAL); > >>> #endif > >>> - error = dump_write(di, > >>> - (void *)(pa - (pa & L1_ADDR_BITS)),0, dumplo, > >>> sz); > >>> + error = dump_write(di, va, 0, dumplo, sz); > >> > >> Then uses the last virtual address to dump the data here. Wouldn't this > >> miss the chunks mapped other than the last one? > > > > Yeah, but a quirk of pmap_kenter_temporary() is that its return value is > > constant, so this wrong-looking code is actually right. > > I'm a bit surprised about this. This most likely warrants a comment. In every architecture and every place it's used, or just arm just here? This appears to be an idiom, or at least something that has been pasted in identical form in every arch so far. -- Ian