All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zamsden@cisco.com>
To: Bin Ren <br260@cam.ac.uk>
Cc: Devel Xen <xen-devel@lists.sourceforge.net>
Subject: Re: pagetable pinning question
Date: Thu, 05 Feb 2004 17:28:59 -0800	[thread overview]
Message-ID: <4022EDDB.3030600@cisco.com> (raw)
In-Reply-To: <5CADB87C-572F-11D8-9AF2-000A9576014E@cam.ac.uk>

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@cisco.com

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@lists.sourceforge.net
> 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

  reply	other threads:[~2004-02-06  1:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-03 19:21 pagetable pinning question Christian Limpach
2004-02-04  8:11 ` Ian Pratt
2004-02-04 14:43   ` Christian Limpach
2004-02-04  8:16 ` Keir Fraser
2004-02-04  8:21   ` Keir Fraser
2004-02-04 16:29     ` Bin Ren
2004-02-06  1:28       ` Zachary Amsden [this message]
2004-02-06  1:43         ` Bin Ren
2004-02-04 14:44   ` Christian Limpach
2004-02-04 17:17     ` Keir Fraser
2004-02-04 22:19       ` Christian Limpach
2004-02-04 23:06         ` Ian Pratt
2004-02-05 14:35         ` Keir Fraser
2004-02-05 15:25           ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4022EDDB.3030600@cisco.com \
    --to=zamsden@cisco.com \
    --cc=br260@cam.ac.uk \
    --cc=xen-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.