Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2011 12:34:18 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217050 - in stable/8/sys/i386: i386 xen
Message-ID:  <201101061234.p06CYIYH014937@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Thu Jan  6 12:34:18 2011
New Revision: 217050
URL: http://svn.freebsd.org/changeset/base/217050

Log:
  MFC r200288, r200346, r200352:  Make minidump work on i386/XEN.
  
  Note that r200288 and r200346 touched i386/i386/dump_machdep.c,
  but in that file r200346 was a back-out of r200288; so the fact
  that dump_machdep.c has moved to the x86 tree is not a problem.
  
  In the !XEN case the files under i386/i386 are unchanged after
  preprocessing.

Modified:
  stable/8/sys/i386/i386/machdep.c
  stable/8/sys/i386/i386/minidump_machdep.c
  stable/8/sys/i386/xen/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/i386/i386/machdep.c
==============================================================================
--- stable/8/sys/i386/i386/machdep.c	Thu Jan  6 09:34:22 2011	(r217049)
+++ stable/8/sys/i386/i386/machdep.c	Thu Jan  6 12:34:18 2011	(r217050)
@@ -2437,6 +2437,9 @@ do_next:
 #else
 	phys_avail[0] = physfree;
 	phys_avail[1] = xen_start_info->nr_pages*PAGE_SIZE;
+	dump_avail[0] = 0;	
+	dump_avail[1] = xen_start_info->nr_pages*PAGE_SIZE;
+	
 #endif
 	
 	/*

Modified: stable/8/sys/i386/i386/minidump_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/minidump_machdep.c	Thu Jan  6 09:34:22 2011	(r217049)
+++ stable/8/sys/i386/i386/minidump_machdep.c	Thu Jan  6 12:34:18 2011	(r217050)
@@ -65,6 +65,11 @@ static void *dump_va;
 static uint64_t counter, progress;
 
 CTASSERT(sizeof(*vm_page_dump) == 4);
+#ifndef XEN
+#define xpmap_mtop(x) (x)
+#define xpmap_ptom(x) (x)
+#endif
+
 
 static int
 is_dumpable(vm_paddr_t pa)
@@ -194,7 +199,7 @@ minidumpsys(struct dumperinfo *di)
 		j = va >> PDRSHIFT;
 		if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V))  {
 			/* This is an entire 2M page. */
-			pa = pd[j] & PG_PS_FRAME;
+			pa = xpmap_mtop(pd[j] & PG_PS_FRAME);
 			for (k = 0; k < NPTEPG; k++) {
 				if (is_dumpable(pa))
 					dump_add_page(pa);
@@ -204,10 +209,10 @@ minidumpsys(struct dumperinfo *di)
 		}
 		if ((pd[j] & PG_V) == PG_V) {
 			/* set bit for each valid page in this 2MB block */
-			pt = pmap_kenter_temporary(pd[j] & PG_FRAME, 0);
+			pt = pmap_kenter_temporary(xpmap_mtop(pd[j] & PG_FRAME), 0);
 			for (k = 0; k < NPTEPG; k++) {
 				if ((pt[k] & PG_V) == PG_V) {
-					pa = pt[k] & PG_FRAME;
+					pa = xpmap_mtop(pt[k] & PG_FRAME);
 					if (is_dumpable(pa))
 						dump_add_page(pa);
 				}
@@ -307,8 +312,24 @@ minidumpsys(struct dumperinfo *di)
 			continue;
 		}
 		if ((pd[j] & PG_V) == PG_V) {
-			pa = pd[j] & PG_FRAME;
+			pa = xpmap_mtop(pd[j] & PG_FRAME);
+#ifndef XEN
 			error = blk_write(di, 0, pa, PAGE_SIZE);
+#else
+			pt = pmap_kenter_temporary(pa, 0);
+			memcpy(fakept, pt, PAGE_SIZE);
+			for (i = 0; i < NPTEPG; i++) 
+				fakept[i] = xpmap_mtop(fakept[i]);
+			error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE);
+			if (error)
+				goto fail;
+			/* flush, in case we reuse fakept in the same block */
+			error = blk_flush(di);
+			if (error)
+				goto fail;
+			bzero(fakept, sizeof(fakept));
+#endif			
+			
 			if (error)
 				goto fail;
 		} else {

Modified: stable/8/sys/i386/xen/pmap.c
==============================================================================
--- stable/8/sys/i386/xen/pmap.c	Thu Jan  6 09:34:22 2011	(r217049)
+++ stable/8/sys/i386/xen/pmap.c	Thu Jan  6 12:34:18 2011	(r217050)
@@ -3108,9 +3108,10 @@ void *
 pmap_kenter_temporary(vm_paddr_t pa, int i)
 {
 	vm_offset_t va;
+	vm_paddr_t ma = xpmap_ptom(pa);
 
 	va = (vm_offset_t)crashdumpmap + (i * PAGE_SIZE);
-	PT_SET_MA(va, (pa & ~PAGE_MASK) | PG_V | pgeflag);
+	PT_SET_MA(va, (ma & ~PAGE_MASK) | PG_V | pgeflag);
 	invlpg(va);
 	return ((void *)crashdumpmap);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101061234.p06CYIYH014937>