Date: Fri, 1 Apr 2011 19:53:17 +0800 From: fuzhli <fuzhli1007@gmail.com> To: Alan Cox <alc@rice.edu> Cc: alc@freebsd.org, questions@freebsd.org Subject: Re: about NKPT on amd64 Message-ID: <AANLkTikCHuMrKQ6weORdKSo7OUMveZcavZUUK-a-5L4R@mail.gmail.com> In-Reply-To: <4D935139.8080701@rice.edu> References: <AANLkTimdxMo3HU8aLuj9F9PCpYU9M5C5X0o5HkHCvqtC@mail.gmail.com> <4D935139.8080701@rice.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Alan Cox Thanks for your reply. I want to know why the NKPT set to 32 in revision187465, is it possible that set NKPT less or lager than 32? What's the limitation i= f set NKPT to 32? I also guess the KPTphys[] not used in kernel initialization on amd64 i= n revision187465. And I notice that in revision189075, in function pmap_init() "the vm page array entries for the kernel pmap's page table pages" is initialized; but in revision187458, the initialization is not performed. I guess "the earlist part of the kernel's initialization" is the pmap_bootstrap(firstaddr), this will call function create_pagetables(). In function create_pagetables(), we first use allocpages(firstaddr, NKPT) to allocate NKPT pages, then initialize the KPTphys[] and KPDphys[]. But then the KPDphys[] re-initialize the range (0, *firstaddr) in 2MB page: /* Map from zero to end of allocations under 2M pages */ /* This replaces some of the KPTphys entries above */ for (i =3D 0; (i << PDRSHIFT) < *firstaddr; i++) { ((pd_entry_t *)KPDphys)[i] =3D i << PDRSHIFT; ((pd_entry_t *)KPDphys)[i] |=3D PG_RW | PG_V | PG_PS | PG_G; } This means that the KPDphys[] will be override completely if the range (KERNBASE, virtual_avail)'s size larger than 64MB, so I guess that the KPTphys[] not used anymore if the range (KERNBASE, virtual_avail)'s size larger than 64MB. =D4=DA 2011=C4=EA3=D4=C230=C8=D5 =CF=C2=CE=E711:50=A3=ACAlan Cox <alc@rice.= edu>=D0=B4=B5=C0=A3=BA > On 03/30/2011 01:47, fuzhli wrote: > > Hi, Alan > > I'm study the "Revision 187465" : "Prepare for a larger kernel virtual > > address space". After read some relative source code, I have an > > question about the macro NKPT on amd64: why 32 is enough for the > > kernel page table pages? Do it means that the range (KERNBASE, > > virtual_avail) should always less than 64MB( 32 * 2MB)? > > NKPT sets the size of the kernel page table during the earliest part of > the kernel's initialization. After that, the size of the page table > grows dynamically according to usage. > > Regards, > Alan > > --=20 =B1=F0=D7=F6=C3=CE,=C4=E3=D2=D124=CB=EA=C1=CB
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikCHuMrKQ6weORdKSo7OUMveZcavZUUK-a-5L4R>