Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/uvm Pull up following revision(s) (requested by para ...



details:   https://anonhg.NetBSD.org/src/rev/95f16fa79650
branches:  netbsd-6
changeset: 774589:95f16fa79650
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Sep 07 22:17:34 2012 +0000

description:
Pull up following revision(s) (requested by para in ticket #547):
        sys/uvm/uvm_map.c: revision 1.320
        sys/uvm/uvm_map.c: revision 1.321
        sys/uvm/uvm_map.c: revision 1.322
        sys/uvm/uvm_km.c: revision 1.130
        sys/uvm/uvm_km.c: revision 1.131
        sys/uvm/uvm_km.c: revision 1.132
        sys/uvm/uvm_km.c: revision 1.133
        sys/uvm/uvm_km.c: revision 1.134
        sys/uvm/uvm_km.c: revision 1.135
        sys/uvm/uvm_km.c: revision 1.129
Fix a bug where the kernel was never grown to accomodate the kmem VA space
since that happens before the kernel_map is set.
Don't try grow the entire kmem space but just do as needed in
uvm_km_kmem_alloc
Shut up gcc printf warning.
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.
Switch to a spin lock (uvm_kentry_lock) which, fortunately, was
sitting there
unused.
Remove locking since it isn't needed.  As soon as the 2nd
uvm_map_entry in kernel_map
is created, uvm_map_prepare will call pmap_growkernel and the
pmap_growkernel call in
uvm_km_mem_alloc will never be called again.
call pmap_growkernel once after the kmem_arena is created
to make the pmap cover it's address space
assert on the growth in uvm_km_kmem_alloc
for the 3rd uvm_map_entry uvm_map_prepare will grow the kernel,
but we might call into uvm_km_kmem_alloc through imports to
the kmem_meta_arena earlier
while here guard uvm_km_va_starved_p from kmem_arena not yet created
thanks for tracking this down to everyone involved

diffstat:

 sys/uvm/uvm_km.c  |  31 ++++++++++++++++++++++++++++---
 sys/uvm/uvm_map.c |   4 ++--
 2 files changed, 30 insertions(+), 5 deletions(-)

diffs (91 lines):

diff -r e57a4db13b96 -r 95f16fa79650 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Fri Sep 07 22:14:53 2012 +0000
+++ b/sys/uvm/uvm_km.c  Fri Sep 07 22:17:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_km.c,v 1.120.2.2 2012/03/17 17:29:34 bouyer Exp $  */
+/*     $NetBSD: uvm_km.c,v 1.120.2.3 2012/09/07 22:17:34 riz Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -120,7 +120,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.120.2.2 2012/03/17 17:29:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.120.2.3 2012/09/07 22:17:34 riz Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -170,7 +170,7 @@
 vaddr_t kmembase;
 vsize_t kmemsize;
 
-vmem_t *kmem_arena;
+vmem_t *kmem_arena = NULL;
 vmem_t *kmem_va_arena;
 
 /*
@@ -297,6 +297,18 @@
        kmem_arena = vmem_create("kmem", kmembase, kmemsize, PAGE_SIZE,
            NULL, NULL, NULL,
            0, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
+#ifdef PMAP_GROWKERNEL
+       /*
+        * kmem_arena VA allocations happen independently of uvm_map.
+        * grow kernel to accommodate the kmem_arena.
+        */
+       if (uvm_maxkaddr < kmembase + kmemsize) {
+               uvm_maxkaddr = pmap_growkernel(kmembase + kmemsize);
+               KASSERTMSG(uvm_maxkaddr >= kmembase + kmemsize,
+                   "%#"PRIxVADDR" %#"PRIxVADDR" %#"PRIxVSIZE,
+                   uvm_maxkaddr, kmembase, kmemsize);
+       }
+#endif
 
        vmem_init(kmem_arena);
 
@@ -747,6 +759,16 @@
        if (rc != 0)
                return rc;
 
+#ifdef PMAP_GROWKERNEL
+       /*
+        * These VA allocations happen independently of uvm_map 
+        * so this allocation must not extend beyond the current limit.
+        */
+       KASSERTMSG(uvm_maxkaddr >= va + size,
+           "%#"PRIxVADDR" %#"PRIxPTR" %#zx",
+           uvm_maxkaddr, va, size);
+#endif
+
        loopva = va;
        loopsize = size;
 
@@ -811,6 +833,9 @@
        vmem_size_t total;
        vmem_size_t free;
 
+       if (kmem_arena == NULL)
+               return false;
+
        total = vmem_size(kmem_arena, VMEM_ALLOC|VMEM_FREE);
        free = vmem_size(kmem_arena, VMEM_FREE);
 
diff -r e57a4db13b96 -r 95f16fa79650 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Fri Sep 07 22:14:53 2012 +0000
+++ b/sys/uvm/uvm_map.c Fri Sep 07 22:17:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.313.2.3 2012/08/18 22:03:24 riz Exp $    */
+/*     $NetBSD: uvm_map.c,v 1.313.2.4 2012/09/07 22:17:34 riz 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.313.2.3 2012/08/18 22:03:24 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.313.2.4 2012/09/07 22:17:34 riz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"



Home | Main Index | Thread Index | Old Index