Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Dec 2014 17:05:59 -0800
From:      Rui Paulo <rpaulo@me.com>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Turner <andrew@fubar.geek.nz>
Subject:   Re: svn commit: r276187 - head/sys/arm/arm
Message-ID:  <8E8B7FE3-0C97-4A84-BC1D-1C5A0E732D0C@me.com>
In-Reply-To: <1419460812.1018.157.camel@freebsd.org>
References:  <201412241712.sBOHCqvW039381@svn.freebsd.org> <20141224222637.03a19e57@bender> <1419460812.1018.157.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 24, 2014, at 14:40, Ian Lepore <ian@FreeBSD.org> 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 <ian@FreeBSD.org> 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 <onwahe@gmail.com>,
>>>  		Michal Meloun <meloun@miracle.cz>
>>>=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






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8E8B7FE3-0C97-4A84-BC1D-1C5A0E732D0C>