Module Name:    src
Committed By:   matt
Date:           Mon Sep  3 14:21:24 UTC 2012

Modified Files:
        src/sys/uvm: uvm_km.c

Log Message:
Fix a bug where the kernel was never grown to accomodate the kmem VA space
since that happens before the kernel_map is set.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/uvm/uvm_km.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/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.128 src/sys/uvm/uvm_km.c:1.129
--- src/sys/uvm/uvm_km.c:1.128	Mon Jul  9 11:19:34 2012
+++ src/sys/uvm/uvm_km.c	Mon Sep  3 14:21:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.128 2012/07/09 11:19:34 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.129 2012/09/03 14:21:24 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -152,7 +152,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.128 2012/07/09 11:19:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.129 2012/09/03 14:21:24 matt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -323,6 +323,20 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t 
 
 	kernel_map = &kernel_map_store;
 
+#ifdef PMAP_GROWKERNEL
+	/*
+	 * Since we just set kernel_map, the check in uvm_map_prepare to grow the
+	 * kernel's VA space never happened so we must do it here.  If the kernel
+	 * pmap can't map the requested space, then allocate more resources for it.
+	 */
+	if (uvm_maxkaddr < kmembase + kmemsize) {
+		uvm_maxkaddr = pmap_growkernel(kmembase + kmemsize);
+		if (uvm_maxkaddr < kmembase + kmemsize)
+			panic("%s: pmap_growkernel(%#"PRIxVADDR") failed",
+			    __func__, kmembase + kmemsize);
+	}
+#endif
+
 	pool_subsystem_init();
 	vmem_bootstrap();
 

Reply via email to