Module Name:    src
Committed By:   sborrill
Date:           Fri Feb 24 17:29:32 UTC 2012

Modified Files:
        src/sys/arch/x86/x86 [netbsd-5]: pmap.c
        src/sys/arch/xen/x86 [netbsd-5]: x86_xpmap.c

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1729):
        sys/arch/x86/x86/pmap.c:        revision 1.170 via patch
        sys/arch/xen/x86/x86_xpmap.c:   revision 1.40 via patch

Fix random kernel panic on domains with large memory.
May fix PR port-xen/38699


To generate a diff of this commit:
cvs rdiff -u -r1.74.4.3 -r1.74.4.4 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/arch/xen/x86/x86_xpmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.74.4.3 src/sys/arch/x86/x86/pmap.c:1.74.4.4
--- src/sys/arch/x86/x86/pmap.c:1.74.4.3	Thu Apr 22 20:02:48 2010
+++ src/sys/arch/x86/x86/pmap.c	Fri Feb 24 17:29:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.74.4.3 2010/04/22 20:02:48 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.74.4.4 2012/02/24 17:29:32 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -154,7 +154,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74.4.3 2010/04/22 20:02:48 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74.4.4 2012/02/24 17:29:32 sborrill Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -535,7 +535,12 @@ static struct pool_cache pmap_pv_cache;
  * special VAs and the PTEs that map them
  */
 static pt_entry_t *csrc_pte, *cdst_pte, *zero_pte, *ptp_pte, *early_zero_pte;
-static char *csrcp, *cdstp, *zerop, *ptpp, *early_zerop;
+static char *csrcp, *cdstp, *zerop, *ptpp;
+#ifdef XEN
+char *early_zerop; /* also referenced from xen_pmap_bootstrap() */
+#else
+static char *early_zerop;
+#endif
 
 /*
  * pool and cache that PDPs are allocated from
@@ -1340,8 +1345,11 @@ pmap_bootstrap(vaddr_t kva_start)
 		 * when it's called for the first time.
 		 * XXXfvdl fix this for MULTIPROCESSOR later.
 		 */
-
+#ifdef XEN
+		/* early_zerop initialized in xen_pmap_bootstrap() */
+#else
 		early_zerop = (void *)(KERNBASE + NKL2_KIMG_ENTRIES * NBPD_L2);
+#endif
 		early_zero_pte = PTE_BASE + pl1_i((unsigned long)early_zerop);
 	}
 

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.11 src/sys/arch/xen/x86/x86_xpmap.c:1.11.4.1
--- src/sys/arch/xen/x86/x86_xpmap.c:1.11	Fri Oct 24 21:09:24 2008
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri Feb 24 17:29:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.11 2008/10/24 21:09:24 jym Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.11.4.1 2012/02/24 17:29:32 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert <m...@adviseo.fr>
@@ -79,7 +79,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.11 2008/10/24 21:09:24 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.11.4.1 2012/02/24 17:29:32 sborrill Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -545,6 +545,7 @@ xen_pmap_bootstrap(void)
 	 *  - UAREA
 	 *  - dummy user PGD (x86_64)
 	 *  - HYPERVISOR_shared_info
+	 *  - early_zerop
 	 *  - ISA I/O mem (if needed)
 	 */
 	mapsize += UPAGES * NBPG;
@@ -552,6 +553,7 @@ xen_pmap_bootstrap(void)
 	mapsize += NBPG;
 #endif
 	mapsize += NBPG;
+	mapsize += NBPG;
 
 #ifdef DOM0OPS
 	if (xendomain_is_dom0()) {
@@ -639,6 +641,7 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 	vaddr_t page, avail, text_end, map_end;
 	int i;
 	extern char __data_start;
+	extern char *early_zerop; /* from pmap.c */
 
 	__PRINTK(("xen_bootstrap_tables(0x%lx, 0x%lx, %d, %d)\n",
 	    old_pgd, new_pgd, old_count, new_count));
@@ -652,6 +655,7 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 	 *  UAREA
 	 *  dummy user PGD (x86_64 only)/gdt page (i386 only)
 	 *  HYPERVISOR_shared_info
+	 *  early_zerop
 	 *  ISA I/O mem (if needed)
 	 */
 	map_end = new_pgd + ((new_count + l2_4_count) * NBPG);
@@ -659,6 +663,8 @@ xen_bootstrap_tables (vaddr_t old_pgd, v
 		map_end += (UPAGES + 1) * NBPG;
 		HYPERVISOR_shared_info = (shared_info_t *)map_end;
 		map_end += NBPG;
+		early_zerop = (char *)map_end;
+		map_end += NBPG;
 	}
 	/*
 	 * we always set atdevbase, as it's used by init386 to find the first

Reply via email to