From owner-svn-src-all@FreeBSD.ORG Thu Dec 25 01:06:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E081D62; Thu, 25 Dec 2014 01:06:23 +0000 (UTC) Received: from st11p02mm-asmtp002.mac.com (st11p02mm-asmtp002.mac.com [17.172.220.237]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 317E01FC9; Thu, 25 Dec 2014 01:06:22 +0000 (UTC) Received: from fukuyama.hsd1.ca.comcast.net (unknown [73.162.13.215]) by st11p02mm-asmtp002.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTPSA id <0NH4002CB5Q03Z40@st11p02mm-asmtp002.mac.com>; Thu, 25 Dec 2014 01:06:02 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2014-12-24_05:2014-12-24,2014-12-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412080000 definitions=main-1412250011 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: svn commit: r276187 - head/sys/arm/arm From: Rui Paulo In-reply-to: <1419460812.1018.157.camel@freebsd.org> Date: Wed, 24 Dec 2014 17:05:59 -0800 Content-transfer-encoding: quoted-printable Message-id: <8E8B7FE3-0C97-4A84-BC1D-1C5A0E732D0C@me.com> References: <201412241712.sBOHCqvW039381@svn.freebsd.org> <20141224222637.03a19e57@bender> <1419460812.1018.157.camel@freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.1993) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Turner X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Thu, 25 Dec 2014 01:06:23 -0000 On Dec 24, 2014, at 14:40, Ian Lepore wrote: >=20 > 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: >>=20 >>> Author: ian >>> Date: Wed Dec 24 17:12:51 2014 >>> New Revision: 276187 >>> URL: https://svnweb.freebsd.org/changeset/base/276187 >>>=20 >>> Log: >>> Eliminate unnecessary references to pte.h internals by using the >>> standard pmap_kenter_temporary() to map pages while dumping. >>>=20 >>> Submitted by: Svatopluk Kraus , >>> Michal Meloun >>>=20 >>> Modified: >>> head/sys/arm/arm/dump_machdep.c >>>=20 >>> Modified: head/sys/arm/arm/dump_machdep.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- 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 =3D (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; >>>=20 >>> + va =3D 0; >>> error =3D 0; /* catch case in which chunk size is 0 */ >>> counter =3D 0; >>> pgs =3D mdp->md_size / PAGE_SIZE; >>> @@ -194,16 +196,14 @@ cb_dumpdata(struct md_pa *mdp, int seqnr >>> printf(" %d", pgs * PAGE_SIZE); >>> counter &=3D (1<<24) - 1; >>> } >>> - if (pa =3D=3D (pa & L1_ADDR_BITS)) { >>> - pmap_kenter_section(0, pa & L1_ADDR_BITS, 0); >>> - cpu_tlb_flushID_SE(0); >>> - cpu_cpwait(); >>> + for (i =3D 0; i < chunk; i++) { >>> + a =3D pa + i * PAGE_SIZE; >>> + va =3D pmap_kenter_temporary(trunc_page(a), i); >>=20 >> Is this correct? It may map multiple chunks here. >>> } >>> #ifdef SW_WATCHDOG >>> wdog_kern_pat(WD_LASTVAL); >>> #endif >>> - error =3D dump_write(di, >>> - (void *)(pa - (pa & L1_ADDR_BITS)),0, dumplo, >>> sz); >>> + error =3D dump_write(di, va, 0, dumplo, sz); >>=20 >> Then uses the last virtual address to dump the data here. Wouldn't = this >> miss the chunks mapped other than the last one? >=20 > 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. -- Rui Paulo