Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 2013 14:22:30 -0700
From:      Neel Natu <neelnatu@gmail.com>
To:        =?ISO-8859-1?Q?Jean=2DS=E9bastien_P=E9dron?= <dumbbell@freebsd.org>
Cc:        svn-src-head@freebsd.org, neel@freebsd.org
Subject:   Re: svn commit: r252646 - head/sys/amd64/amd64
Message-ID:  <CAFgRE9EyUiUoD6HWWdc-40vrJxZr9-ghG-GiHWyf1W0gPNusEQ@mail.gmail.com>
In-Reply-To: <51EB962E.3090405@FreeBSD.org>
References:  <201307032321.r63NLP3w059509@svn.freebsd.org> <51EABABD.8050906@FreeBSD.org> <CAFgRE9G=Y-SPrjHXgAu3GwcjvbT0Cc7T6Tm7wNsjA=eLvhfe6Q@mail.gmail.com> <51EB962E.3090405@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Jean-Sebastien,

On Sun, Jul 21, 2013 at 1:05 AM, Jean-S=E9bastien P=E9dron
<dumbbell@freebsd.org> wrote:
> Le 20/07/2013 20:26, Neel Natu a =E9crit :
>
>> I would start looking by looking at the value of the page table entry
>> in question (this would be 'tpte' in pmap_remove_pages()).
>>
>> In particular, it would be useful to identify whether this is pointing
>> to a superpage mapping and if so what page within the superpage is
>> triggering the "vm_page_dirty: page is invalid" panic.
>
>
> Here's what was logged by your patch:
>
> va =3D 0x8007da000
> tpte =3D 0x80000000d2f834f7
> m->phys_addr =3D 0xd2eaf000
> m->valid =3D 0
> m->dirty=3D 0
> m->flags =3D 4, aflags =3D 0, oflags =3D 0
> panic: vm_page_dirty: page is invalid!
>
> So it corresponds to page m[175] in the superpage. I don't know if it hel=
ps
> but I checked the remaining pages: they all have '->valid =3D 0', except =
a few
> ones (265 to 267, 345, 361 to 363, 379 to 387 and 425 to 431 have '->vali=
d =3D
> VM_PAGE_BITS_ALL').
>

Thanks a lot for that - it helped a lot!

Could you revert the debug patch earlier and apply the following patch
and give it a spin?

Index: pmap.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
--- pmap.c	(revision 253553)
+++ pmap.c	(working copy)
@@ -4400,7 +4400,7 @@
 	struct rwlock *lock;
 	int64_t bit;
 	uint64_t inuse, bitmask;
-	int allfree, field, freed, idx;
+	int allfree, field, freed, idx, superpage;
 	vm_paddr_t pa;

 	if (pmap !=3D PCPU_GET(curpmap)) {
@@ -4427,12 +4427,15 @@
 				pte =3D pmap_pdpe_to_pde(pte, pv->pv_va);
 				tpte =3D *pte;
 				if ((tpte & (PG_PS | PG_V)) =3D=3D PG_V) {
+					superpage =3D 0;
 					ptepde =3D tpte;
 					pte =3D (pt_entry_t *)PHYS_TO_DMAP(tpte &
 					    PG_FRAME);
 					pte =3D &pte[pmap_pte_index(pv->pv_va)];
 					tpte =3D *pte;
-				}
+				} else
+					superpage =3D 1;
+
 				if ((tpte & PG_V) =3D=3D 0) {
 					panic("bad pte va %lx pte %lx",
 					    pv->pv_va, tpte);
@@ -4446,7 +4449,7 @@
 					continue;
 				}

-				if (tpte & PG_PS)
+				if (superpage)
 					pa =3D tpte & PG_PS_FRAME;
 				else
 					pa =3D tpte & PG_FRAME;
@@ -4468,7 +4471,7 @@
 				 * Update the vm_page_t clean/reference bits.
 				 */
 				if ((tpte & (PG_M | PG_RW)) =3D=3D (PG_M | PG_RW)) {
-					if ((tpte & PG_PS) !=3D 0) {
+					if (superpage) {
 						for (mt =3D m; mt < &m[NBPDR / PAGE_SIZE]; mt++)
 							vm_page_dirty(mt);
 					} else
@@ -4479,7 +4482,7 @@

 				/* Mark free */
 				pc->pc_map[field] |=3D bitmask;
-				if ((tpte & PG_PS) !=3D 0) {
+				if (superpage) {
 					pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
 					pvh =3D pa_to_pvh(tpte & PG_PS_FRAME);
 					TAILQ_REMOVE(&pvh->pv_list, pv, pv_next);

best
Neel

> --
> Jean-S=E9bastien P=E9dron



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFgRE9EyUiUoD6HWWdc-40vrJxZr9-ghG-GiHWyf1W0gPNusEQ>