Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm Cleanup comment. Change panic to KASSERTMSG.



details:   https://anonhg.NetBSD.org/src/rev/cc21f25927d7
branches:  trunk
changeset: 781395:cc21f25927d7
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Sep 03 17:30:04 2012 +0000

description:
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.

diffstat:

 sys/uvm/uvm_km.c  |  17 +++++++++--------
 sys/uvm/uvm_map.c |   6 ++++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r d47024c5d8bf -r cc21f25927d7 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Mon Sep 03 17:12:50 2012 +0000
+++ b/sys/uvm/uvm_km.c  Mon Sep 03 17:30:04 2012 +0000
@@ -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 @@
 
 #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;
diff -r d47024c5d8bf -r cc21f25927d7 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon Sep 03 17:12:50 2012 +0000
+++ b/sys/uvm/uvm_map.c Mon Sep 03 17:30:04 2012 +0000
@@ -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 @@
         * 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);



Home | Main Index | Thread Index | Old Index