Module Name: src
Committed By: matt
Date: Mon Sep 3 17:30:04 UTC 2012
Modified Files:
src/sys/uvm: uvm_km.c uvm_map.c
Log Message:
Cleanup comment. Change panic to KASSERTMSG.
Use kernel_map->misc_lock to make sure we don't call pmap_growkernel
concurrently and possibly mess up uvm_maxkaddr.
To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.319 -r1.320 src/sys/uvm/uvm_map.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.131 src/sys/uvm/uvm_km.c:1.132
--- src/sys/uvm/uvm_km.c:1.131 Mon Sep 3 16:07:17 2012
+++ src/sys/uvm/uvm_km.c Mon Sep 3 17:30:04 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_km.c,v 1.131 2012/09/03 16:07:17 matt Exp $ */
+/* $NetBSD: uvm_km.c,v 1.132 2012/09/03 17:30:04 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.131 2012/09/03 16:07:17 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.132 2012/09/03 17:30:04 matt Exp $");
#include "opt_uvmhist.h"
@@ -782,16 +782,17 @@ again:
#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.
+ * These VA allocations happen independently of uvm_map so if this allocation
+ * extends beyond the current limit, then allocate more resources for it.
*/
+ mutex_enter(&kernel_map->misc_lock);
if (uvm_maxkaddr < va + size) {
uvm_maxkaddr = pmap_growkernel(va + size);
- if (uvm_maxkaddr < va + size)
- panic("%s: pmap_growkernel(%#"PRIxVADDR") failed",
- __func__, (vaddr_t) (va + size));
+ KASSERTMSG(uvm_maxkaddr >= va + size,
+ "%#"PRIxVADDR" %#"PRIxPTR" %#zx",
+ uvm_maxkaddr, va, size);
}
+ mutex_exit(&kernel_map->misc_lock);
#endif
loopva = va;
Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.319 src/sys/uvm/uvm_map.c:1.320
--- src/sys/uvm/uvm_map.c:1.319 Sat Aug 18 14:28:04 2012
+++ src/sys/uvm/uvm_map.c Mon Sep 3 17:30:04 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $ */
+/* $NetBSD: uvm_map.c,v 1.320 2012/09/03 17:30:04 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.320 2012/09/03 17:30:04 matt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -1182,8 +1182,10 @@ retry:
* If the kernel pmap can't map the requested space,
* then allocate more resources for it.
*/
+ mutex_enter(&map->misc_lock);
if (map == kernel_map && uvm_maxkaddr < (start + size))
uvm_maxkaddr = pmap_growkernel(start + size);
+ mutex_exit(&map->misc_lock);
#endif
UVMMAP_EVCNT_INCR(map_call);