From nobody@FreeBSD.org  Sat Aug 30 13:04:54 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B3581065677
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 30 Aug 2008 13:04:54 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 57E2F8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 30 Aug 2008 13:04:54 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m7UD4s33028487
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 30 Aug 2008 13:04:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m7UD4scP028486;
	Sat, 30 Aug 2008 13:04:54 GMT
	(envelope-from nobody)
Message-Id: <200808301304.m7UD4scP028486@www.freebsd.org>
Date: Sat, 30 Aug 2008 13:04:54 GMT
From: David Naylor <naylor.b.david@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: kernel fails to load with a big mfs image
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         126972
>Category:       kern
>Synopsis:       [boot] kernel fails to load with a big mfs image
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 30 13:10:02 UTC 2008
>Closed-Date:    Tue Sep 16 03:00:08 UTC 2008
>Last-Modified:  Tue Sep 16 03:00:08 UTC 2008
>Originator:     David Naylor
>Release:        8-Current
>Organization:
Private
>Environment:
FreeBSD dragonmini.dg 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Tue Aug 26 20:30:23 SAST 2008     root@dragonmini.dg:/tmp/usr/src/sys/GENERIC  i386
>Description:
The kernel fails to boot when loading a big mfs image at boot time.
This problem does not appear on amd64.  Changing vm.kmem_size and
vm.kmem_size_max to 512MB does not help.  Although in this case the mfs
image is compressed I do not think it changes anything.
>How-To-Repeat:
Create a big file and load it on boot...

Add the following to loader.conf:
dragonroot_load="YES"
dragonroot_type="mfs_root"
dragonroot_name="/boot/dragonroot"

where /boot/dragonroot is a big file...

(please see attached for the output [via serial] and the backtrace)
>Fix:


Patch attached with submission follows:

OK ls -l boot/
boot/
 d      512 zfs
 d      512 firmware
 d      512 kernel
 d      512 modules
 d      512 defaults
       8192 boot
        512 boot1
       7680 boot2
       1201 cdboot
       7551 gptboot
     249856 loader
      15219 loader.help
       7545 loader.4th
      36462 support.4th
        692 screen.4th
       2249 frames.4th
       7636 beastie.4th
        385 loader.rc
     251904 pxeboot
       1776 device.hints
        406 loader.conf
        512 mbr
        512 pmbr
        512 boot0
        512 boot0sio
   95251544 dragonroot.gz
OK show vm.kmem_size
512M
OK show vm.kmem_size_max
512M
OK boot
/boot/kernel/acpi.ko text=0x521cc data=0x2640+0x182c syms=[0x4+0x8b80+0x4+0xbe19]
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
1048576K of memory above 4GB ignored
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-CURRENT #0: Wed Aug 27 23:13:13 SAST 2008
    root@dragonmini.dg:/tmp/usr/src/sys/GENERIC
WARNING: WITNESS option enabled, expect reduced performance.


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0xbff1e000
fault code              = supervisor write, page not present
instruction pointer     = 0x20:0xc0a82bdb
stack pointer           = 0x28:0xc7020cf0
frame pointer           = 0x28:0xc7020d08
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, def32 1, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 0 ()
[thread pid 0 tid 0 ]
Stopped at      pmap_map+0x2d:  movl    %eax,PTmap(,%edx,4)
db> bt
Tracing pid 0 tid 0 td 0xc0c608a0
pmap_map(c7020d64,bcc98000,bff98000,3,c7445000,...) at pmap_map+0x2d
vm_page_startup(c748e000,a,c7020d88,c075e76e,0,...) at vm_page_startup+0x27f
vm_mem_init(0,701ec00,701ec00,701e000,7025000,...) at vm_mem_init+0x18
mi_startup() at mi_startup+0x90
begin() at begin+0x2c
db>


>Release-Note:
>Audit-Trail:

From: David Naylor <naylor.b.david@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org,
 freebsd-bugs@freebsd.org
Cc:  
Subject: Re: misc/126972: kernel fails to load with a big mfs image
Date: Sat, 30 Aug 2008 15:38:01 +0200

 --nextPart1811461.mJX6vIGoB1
 Content-Type: text/plain;
   charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 Apologies, in my hast to full out the PR's I forgot to change a few of the=
 =20
 options.  They are:
 
 category: kern (unionfs)
 severity: serious
 priority: medium
 
 --nextPart1811461.mJX6vIGoB1
 Content-Type: application/pgp-signature; name=signature.asc 
 Content-Description: This is a digitally signed message part.
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.4 (FreeBSD)
 
 iD8DBQBIuU0+UaaFgP9pFrIRAj/tAJ9szMEFXSM3tMN2FFX1Gd87tveVnwCfZeid
 D0nJhteT6Hv60jfazsPXjqg=
 =m06G
 -----END PGP SIGNATURE-----
 
 --nextPart1811461.mJX6vIGoB1--
Responsible-Changed-From-To: freebsd-bugs->daichi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Aug 30 15:47:06 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126972 

From: Kris Kennaway <kris@FreeBSD.org>
To: David Naylor <naylor.b.david@gmail.com>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: misc/126972: kernel fails to load with a big mfs image
Date: Sat, 30 Aug 2008 19:51:49 +0200

 David Naylor wrote:
 > Apologies, in my hast to full out the PR's I forgot to change a few of the 
 > options.  They are:
 > 
 > category: kern (unionfs)
 
 What does this have to do with unionfs?
 
 Kris
 

From: David Naylor <naylor.b.david@gmail.com>
To: Kris Kennaway <kris@freebsd.org>
Cc: FreeBSD-gnats-submit@freebsd.org,
 freebsd-bugs@freebsd.org
Subject: Re: misc/126972: kernel fails to load with a big mfs image
Date: Sat, 30 Aug 2008 20:24:01 +0200

 On Saturday 30 August 2008 19:51:49 Kris Kennaway wrote:
 > David Naylor wrote:
 > > Apologies, in my hast to full out the PR's I forgot to change a few of
 > > the options.  They are:
 > >
 > > category: kern (unionfs)
 >
 > What does this have to do with unionfs?
 >
 > Kris
 
 It does not have anything to do with unionfs.  I'm just getting confused 
 between the PR's that I have filed today.  
Responsible-Changed-From-To: daichi->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Aug 30 20:02:58 UTC 2008 
Responsible-Changed-Why:  
A later email from the submitter confirms that this PR has nothing to 
do with unionfs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126972 

From: "Artis Caune" <artis.caune@gmail.com>
To: bug-followup@FreeBSD.org
Cc: naylor.b.david@gmail.com
Subject: Re: kern/126972: [boot] kernel fails to load with a big mfs image
Date: Sun, 31 Aug 2008 17:15:21 +0300

 Hi,
 
 you should edit i386/include/pmap.h and cange
 NKPT to something bigger (default 30 is for ~120M)
 and recompile kernel.
 
 If you need 320Mb mfs root, set NKPT to ( 320 / 4 ) = 80
 
 
 
 -- 
 regards,
 Artis Caune
 
 <----. CCNA
 <----|====================
 <----' didii FreeBSD

From: David Naylor <naylor.b.david@gmail.com>
To: "Artis Caune" <artis.caune@gmail.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/126972: [boot] kernel fails to load with a big mfs image
Date: Mon, 1 Sep 2008 20:07:57 +0200

 --nextPart2032126.7cusNbIStL
 Content-Type: text/plain;
   charset="utf-8"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 On Sunday 31 August 2008 16:15:21 Artis Caune wrote:
 > Hi,
 >
 > you should edit i386/include/pmap.h and cange
 > NKPT to something bigger (default 30 is for ~120M)
 > and recompile kernel.
 >
 > If you need 320Mb mfs root, set NKPT to ( 320 / 4 ) =3D 80
 
 The above procedure works.  If there is a compelling reason to not change N=
 KPT=20
 then, I think, the PR has been resolved.
 
 Thanks for the quick reply.
 
 David
 
 --nextPart2032126.7cusNbIStL
 Content-Type: application/pgp-signature; name=signature.asc 
 Content-Description: This is a digitally signed message part.
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.4 (FreeBSD)
 
 iD8DBQBIvC+CUaaFgP9pFrIRAhvoAJ9fNTUwgbuYmPoI7j+j0KDgGWjRZACfZaEl
 53HPcgDncaiKZN7PYDNg77g=
 =fJAu
 -----END PGP SIGNATURE-----
 
 --nextPart2032126.7cusNbIStL--
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Sep 16 02:59:32 UTC 2008 
State-Changed-Why:  
Submitter notes that the suggestion in the followup fixed his problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126972 
>Unformatted:
