WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] pagetable pinning question

To: Bin Ren <br260@xxxxxxxxx>
Subject: Re: [Xen-devel] pagetable pinning question
From: Zachary Amsden <zamsden@xxxxxxxxx>
Date: Thu, 05 Feb 2004 17:28:59 -0800
Cc: Devel Xen <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 06 Feb 2004 01:34:15 +0000
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: <5CADB87C-572F-11D8-9AF2-000A9576014E@xxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Organization: Cisco Systems
References: <E1AoII6-0005P7-00@xxxxxxxxxxxxxxxxxxxx> <5CADB87C-572F-11D8-9AF2-000A9576014E@xxxxxxxxx>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031208
This is a good question, as all this terminology suffers from potential overloading of the word "linear". The linear recursive map works as follows:

Register %cr3 contains a physical page frame which points to the current PDP. This physical page contains the physical frame addresses of all the second level page tables. One of these entries is special... it contains the physical frame address of the PDP itself. The index of this entry now corresponds to the high 10 bits of a virtual memory address. Accesses to this 4Mb region of virtual memory are translated through the PDP, which points to the actual (likely non-contiguous) physical page tables. So you have effectively mapped the non-contiguous PTEs into the 4Mb contiguous (i.e. linear) virtual memory region corresponding to the PDP index. This greatly simplifies some operations, since you can use the hardware to map the page tables and access them as a giant array. This is the linear map.

The map is actually recursive, since the PDP itself will be mapped into the same VM region. So if your special index was say 767 (as in NetBSD), then the 4Mb VM region at 0xbfc00000 would contain a linear mapping of your page tables. The page at 0xbfeff000 would contain the PDP itself, and the virtual address 0xbfeffbfc would contain the physical address of the PDP.

You can also use other slots in the PDP to map other processes page tables, which might be useful for shared memory access or implementing fork(). This is what causes the problems with reference accounting, since you have the same page being used both as a PDP and a PTP, with possible circular references.

Zachary Amsden
zamsden@xxxxxxxxx

Bin Ren wrote:

Hi,

I'm a bit confused by parts of the discussion going here. Can anyone
explain the difference between linear page table and normal page table?
Linux page tables are all linear, i.e. contiguous page table entries
correspond to contiguous virtual pages. Is this right? How about
NetBSD?

How can one page directory be mapped from another page directory?

My understanding is: (maybe wrong) each process has only one
page directory and 1024 page tables. Each page directory and page
table fits into one page (on 32-bit computers with 4k page size).
Not all page tables are allocated physical page frames initially. During
a context switch from process A to process B, A's PD and PTs can be
swapped out (in face of memory shortage), releasing physical page
frames for use by B. So, how can one PD be mapped by another PD?

What am I missing here?

Thanks,
Bin



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel