NetBSD-Bugs archive

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

Re: kern/46885: NetBSD 6.0_RC1 spontaneously reboots as kernel starts to load



On 09/03/2012 06:45 PM, David Holland wrote:
> The following reply was made to PR kern/46885; it has been noted by GNATS.
> 
> From: David Holland <dholland-bugs%netbsd.org@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Cc: 
> Subject: Re: kern/46885: NetBSD 6.0_RC1 spontaneously reboots as kernel
>  starts to load
> Date: Mon, 3 Sep 2012 16:40:39 +0000
> 
>  On Mon, Sep 03, 2012 at 04:20:05PM +0000, Valeriy E. Ushakov wrote:
>   >  This seems to be fixed by src/sys/uvm/uvm_km.c at revision 1.131
>   >  netbsd-6 pull up candidate?
>  
>  yes please
>  
>  

Hi,

a revised version of the patch it grows the kernel once after the
kmem_arena is created but before any other arena imports from it.
Such an import would call through uvm_km_kmem_alloc for backing va with
memory, hence growing the kernel in there works as well.
Once another map_entries is inserted we grow beyond kmem_arena anyway,
so do it right away.

Index: uvm/uvm_km.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_km.c,v
retrieving revision 1.134
diff -u -p -r1.134 uvm_km.c
--- uvm/uvm_km.c        4 Sep 2012 13:37:41 -0000       1.134
+++ uvm/uvm_km.c        5 Sep 2012 15:21:02 -0000
@@ -329,6 +329,18 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t
        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);

@@ -782,18 +794,12 @@ again:

 #ifdef PMAP_GROWKERNEL
        /*
-        * These VA allocations happen independently of uvm_map so if this
allocation
-        * extends beyond the current limit, then allocate more resources for 
it.
-        * This can only happen while the kmem_map is the only map entry in the
-        * kernel_map because as soon as another map entry is created,
uvm_map_prepare
-        * will set uvm_maxkaddr to an address beyond the kmem_map.
-        */
-       if (uvm_maxkaddr < va + size) {
-               uvm_maxkaddr = pmap_growkernel(va + size);
-               KASSERTMSG(uvm_maxkaddr >= va + size,
-                   "%#"PRIxVADDR" %#"PRIxPTR" %#zx",
-                   uvm_maxkaddr, va, size);
-       }
+        * 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;



Home | Main Index | Thread Index | Old Index