KVA Increase in Different Versions of FreeBSD 4.x John Kozubik - john@kozubik.com - http://www.kozubik.com June 23, 2002 Overview There are very different methods of changing the total amount of kernel virtual memory (KVM) available in FreeBSD 4.x. The method change occurred between 4.4 and 4.5. This document documents both methods. (from a June 2002 discussion on freebsd-hackers) From: John Kozubik (john@kozubik.com) Subject: Re: (jail) problem and a (possible) solution ? Newsgroups: mpc.lists.freebsd.hackers, muc.lists.freebsd.hackers Date: 2002-06-23 14:57:35 PST > > 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. 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. ----- Some background on 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.