From owner-freebsd-questions@FreeBSD.ORG Fri Apr 1 11:53:18 2011 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 455731065675; Fri, 1 Apr 2011 11:53:18 +0000 (UTC) (envelope-from fuzhli1007@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id F40BA8FC08; Fri, 1 Apr 2011 11:53:17 +0000 (UTC) Received: by iyj12 with SMTP id 12so4327446iyj.13 for ; Fri, 01 Apr 2011 04:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=afjMXMx1CYz+CwiYABVuI0i3lUAFwzrv+mCxDq8OpFI=; b=XloJDy38VHvsQf3SWOw4uxD4XZ6xRqiRGef1Lvghzs1/DAjq1CzMyqzkVg5fNBMavM /dBiMVNRlA1kkC8D0c8dggk6KVkA7XMMIjoXoyyPgq4wI+6sob3LNKSrDP77twDoqQal +dNAmDiOqSMZoF6eoV9+mlnQquyA1sJsxaGgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=TCz5eRBzAMeDF2WmqNgd4rVK/DaGAR4PE25gWp1Hyg3tgmM2dnLcoaMfNLtbQhOj/H SXfrflZOZRmiYyjjaElu8dW9qKtKbwH+mkn9pzSgwkNZnFKyIXg9cNT/p5gAtC9B4dRd sipZUpZ63l6DEiChuNK6ZlejnE0QLyK7GO1oc= MIME-Version: 1.0 Received: by 10.42.172.131 with SMTP id n3mr1402368icz.136.1301658797231; Fri, 01 Apr 2011 04:53:17 -0700 (PDT) Received: by 10.42.180.72 with HTTP; Fri, 1 Apr 2011 04:53:17 -0700 (PDT) In-Reply-To: <4D935139.8080701@rice.edu> References: <4D935139.8080701@rice.edu> Date: Fri, 1 Apr 2011 19:53:17 +0800 Message-ID: From: fuzhli To: Alan Cox X-Mailman-Approved-At: Fri, 01 Apr 2011 13:10:30 +0000 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: alc@freebsd.org, questions@freebsd.org Subject: Re: about NKPT on amd64 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2011 11:53:18 -0000 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 =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