Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 2002 14:51:09 -0700 (PDT)
From:      John Kozubik <john@kozubik.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Patrick Thomas <root@utility.clubscholarship.com>, Nielsen <nielsen@memberwebs.com>, hackers@FreeBSD.ORG
Subject:   Re: (jail) problem and a (possible) solution ?
Message-ID:  <Pine.BSF.4.21.0206231412380.24005-100000@www>
In-Reply-To: <3D14FF75.9772644D@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Terry, Patrick, et al,

> > What is the procedure in 4.5-RELEASE (please say "just change
> > KVA_PAGES=260 to KVA_PAGES=512)

(snip)

> For 4.5, you have to hack ldscript.i386 and pmap.h.  I've posted
> on how to do this before (should be in the archives).

Actually, in 4.5 you only need to set:

options KVA_PAGES=512

and recompile your kernel.  It looks like 4.5-RELEASE was the first
release version to _not_ require hacking sys/i386/include/pmap.h and
sys/conf/ldscript.i386.  As you can see by looking at a 4.5-RELEASE 
pmap.h:

#define NKPDE   (KVA_PAGES - 2) /* addressable number of page tables/pde's
*/
#else
#define NKPDE   (KVA_PAGES - 1) /* addressable number of page tables/pde's
*/

the offsets that Terry spoke of are already in place.  This is in contrast
to 4.4-RELEASE:

#define NKPDE                   254     /* addressable number of page
tables/pde's */
#else
#define NKPDE                   255     /* addressable number of page
tables/pde's */

Where everything was hard coded to match the default KVA_PAGES value.  
Further, looking at ldscript.i386 we see in 4.5-RELEASE:

  . = kernbase + 0x00100000 + SIZEOF_HEADERS;

whereas in 4.4-RELEASE and earlier, we saw:

  . = 0xc0100000 + SIZEOF_HEADERS;

Which means that in 4.4 you had to change 0xc0100000 to 0x80100000 for a
2gig KVA.  In 4.5, however, you don't have to change ldscript.i386 at all,
because it is now a relative value that takes kernbase into account.

-----

So, if you are running 4.0 - 4.4, you need to edit ldscript.i386 and
change 0xc0100000 to 0x8010000 (for a 2gig KVA), then you need to edit
pmap.h and change the two lines I pasted above from 254 and 255 to 510 and
511, respectively.  Finally, you need to set:

options KVA_PAGES=512

in your kernel config, then recompile your kernel.

But, if you are running 4.5 or 4.6, from the code I pasted above, it looks
like all you have to do is set:

options KVA_PAGES=512

in your kernel config, then recompile your kernel.

-----

Another explanation of this concept can be found here:

http://www.kozubik.com/docs/original_kva_increase.txt

I am posting today mainly to get a little more information stored in the
archives.

In addition, I myself have a question regarding the default settings of
4.5 and 4.6 - by looking at the NKPDE values in the 4.4-RELEASE version of
pmap.h, the values of 254 and 255 indicate that they are hard coded for a
default of KVA_PAGES=256, however 4.5 and 4.6 have a KVA_PAGES=260 setting
in LINT, which I assume is also the default ... why the increase of 4
since 4.4-RELEASE ?

-----
John Kozubik - john@kozubik.com - http://www.kozubik.com





> 
> The pages are all going to be off-by-one from your calculations, for
> the recursive page mapping, or off-by-two if your kernel is an SMP
> kernel, for the per CPU page, so remember that, or you will end up
> with a kernel that simply doesn't boot.
> 
> The easiest way is to look at the numbers in pmap.h, and figure out
> how they relate to 0xc0000000 (remember to OR in 0x00100000 after your
> math, to count the kernel loading at 1M).
> 
> -- Terry
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe
> freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0206231412380.24005-100000>