Source-Changes-HG archive

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

[src/trunk]: src/sys/arch The recent kmem changes allocate a large kernel add...



details:   https://anonhg.NetBSD.org/src/rev/effb48ed020f
branches:  trunk
changeset: 773623:effb48ed020f
user:      mhitch <mhitch%NetBSD.org@localhost>
date:      Fri Feb 10 04:49:44 2012 +0000

description:
The recent kmem changes allocate a large kernel address space before
pmap_init() is called, and the initial kernel PT pages aren't enough
for the allocations pmap_init().  This fails because pmap_kenter_pa()
tries to allocate a new kernel PT page and traps because the pmap has
not been initialized.  When computing the number if initial kernel PT
pages, include enough to allow kmem to map the physical memory.  This
should fix PR/45915.  OK by releng@.  One mac68k system has been verified
to boot.  Volunteers to test the others welcome.  Amigas with at least
up to 128MB of memory were OK, but larger memory will need some adjusting.

diffstat:

 sys/arch/atari/atari/atari_init.c         |  10 ++++++++--
 sys/arch/cesfic/cesfic/pmap_bootstrap.c   |   6 +++---
 sys/arch/hp300/hp300/pmap_bootstrap.c     |   6 +++---
 sys/arch/luna68k/luna68k/pmap_bootstrap.c |   6 +++---
 sys/arch/mac68k/mac68k/pmap_bootstrap.c   |  14 ++++++++++++--
 sys/arch/mvme68k/mvme68k/pmap_bootstrap.c |   7 ++++---
 sys/arch/news68k/news68k/pmap_bootstrap.c |   6 +++---
 sys/arch/next68k/next68k/pmap_bootstrap.c |   6 +++---
 sys/arch/x68k/x68k/pmap_bootstrap.c       |   6 +++---
 9 files changed, 42 insertions(+), 25 deletions(-)

diffs (256 lines):

diff -r 2aff621225ba -r effb48ed020f sys/arch/atari/atari/atari_init.c
--- a/sys/arch/atari/atari/atari_init.c Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/atari/atari/atari_init.c Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atari_init.c,v 1.97 2012/01/27 18:52:52 para Exp $     */
+/*     $NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $   */
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.97 2012/01/27 18:52:52 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
@@ -322,6 +322,12 @@
        if (machineid & ATARI_MILAN)
                ptextra += btoc(PCI_IO_SIZE + PCI_MEM_SIZE);
        ptextra += btoc(BOOTM_VA_POOL);
+       /*
+        * now need to account for the kmem area, which is allocated
+        * before pmap_init() is called.  It is roughly the size of physical
+        * memory.
+        */
+       ptextra += physmem;
 
        /*
         * The 'pt' (the initial kernel pagetable) has to map the kernel and
diff -r 2aff621225ba -r effb48ed020f sys/arch/cesfic/cesfic/pmap_bootstrap.c
--- a/sys/arch/cesfic/cesfic/pmap_bootstrap.c   Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/cesfic/cesfic/pmap_bootstrap.c   Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.31 2011/01/02 18:48:05 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.32 2012/02/10 04:49:45 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.31 2011/01/02 18:48:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.32 2012/02/10 04:49:45 mhitch Exp $");
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
@@ -120,7 +120,7 @@
        lkptpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int);
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG);
        nextpa += nptpages * PAGE_SIZE;
 
        /*
diff -r 2aff621225ba -r effb48ed020f sys/arch/hp300/hp300/pmap_bootstrap.c
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c     Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/hp300/hp300/pmap_bootstrap.c     Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.54 2011/01/06 14:19:54 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.55 2012/02/10 04:49:45 mhitch Exp $       */
 
 /*
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.54 2011/01/06 14:19:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.55 2012/02/10 04:49:45 mhitch Exp $");
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
@@ -126,7 +126,7 @@
        lkptpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
                (IIOMAPSIZE + EIOMAPSIZE + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 
diff -r 2aff621225ba -r effb48ed020f sys/arch/luna68k/luna68k/pmap_bootstrap.c
--- a/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.32 2011/01/02 18:48:06 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.33 2012/02/10 04:49:45 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.32 2011/01/02 18:48:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.33 2012/02/10 04:49:45 mhitch Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -125,7 +125,7 @@
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
                (iiomapsize + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 
diff -r 2aff621225ba -r effb48ed020f sys/arch/mac68k/mac68k/pmap_bootstrap.c
--- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c   Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c   Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.92 2011/01/02 18:48:06 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.92 2011/01/02 18:48:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.93 2012/02/10 04:49:45 mhitch Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -156,6 +156,16 @@
        kptpa = nextpa;
        nptpages = Sysptsize +
                (IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE + NPTEPG - 1) / NPTEPG;
+       /*
+        * New kmem arena is allocated prior to pmap_init(), so we need
+        * additiona PT pages to account for that allocation, which is based
+        * on physical memory size.  Just sum up memory and add enough PT
+        * pages for that size.
+        */
+       mem_size = 0;
+       for (i = 0; i < numranges; i++)
+               mem_size += high[i] - low[i];
+       nptpages += howmany(m68k_btop(mem_size), NPTEPG);
        nextpa += nptpages * PAGE_SIZE;
        
        for (i = 0; i < numranges; i++)
diff -r 2aff621225ba -r effb48ed020f sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.48 2011/01/02 18:48:06 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.49 2012/02/10 04:49:45 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.48 2011/01/02 18:48:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.49 2012/02/10 04:49:45 mhitch Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -135,7 +135,8 @@
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) + (iiomappages + NPTEPG - 1) / NPTEPG;
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
+           (iiomappages + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 
        /*
diff -r 2aff621225ba -r effb48ed020f sys/arch/news68k/news68k/pmap_bootstrap.c
--- a/sys/arch/news68k/news68k/pmap_bootstrap.c Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/news68k/news68k/pmap_bootstrap.c Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.37 2011/11/20 15:38:00 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.38 2012/02/10 04:49:45 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.37 2011/11/20 15:38:00 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.38 2012/02/10 04:49:45 mhitch Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -138,7 +138,7 @@
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
                (iiomapsize + eiomapsize + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 
diff -r 2aff621225ba -r effb48ed020f sys/arch/next68k/next68k/pmap_bootstrap.c
--- a/sys/arch/next68k/next68k/pmap_bootstrap.c Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/next68k/next68k/pmap_bootstrap.c Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.39 2011/01/02 18:48:07 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.40 2012/02/10 04:49:46 mhitch Exp $       */
 
 /*
  * This file was taken from mvme68k/mvme68k/pmap_bootstrap.c
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.39 2011/01/02 18:48:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.40 2012/02/10 04:49:46 mhitch Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -147,7 +147,7 @@
        lkptpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
                (IIOMAPSIZE + MONOMAPSIZE + COLORMAPSIZE + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 
diff -r 2aff621225ba -r effb48ed020f sys/arch/x68k/x68k/pmap_bootstrap.c
--- a/sys/arch/x68k/x68k/pmap_bootstrap.c       Fri Feb 10 02:14:23 2012 +0000
+++ b/sys/arch/x68k/x68k/pmap_bootstrap.c       Fri Feb 10 04:49:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.55 2011/05/14 10:19:58 tsutsui Exp $      */
+/*     $NetBSD: pmap_bootstrap.c,v 1.56 2012/02/10 04:49:46 mhitch Exp $       */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.55 2011/05/14 10:19:58 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.56 2012/02/10 04:49:46 mhitch Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -122,7 +122,7 @@
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
        kptpa = nextpa;
-       nptpages = RELOC(Sysptsize, int) +
+       nptpages = RELOC(Sysptsize, int) + howmany(physmem, NPTEPG) +
                (IIOMAPSIZE + NPTEPG - 1) / NPTEPG;
        nextpa += nptpages * PAGE_SIZE;
 



Home | Main Index | Thread Index | Old Index