[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] TLB-miss handling in Xen 3.0

> 1. Each guest-OS has got a *physical-to-machine* table where as the
> hypervisor has got a globally readable
> *machine-to-physical* table.
> My questions are the following:
> 1. An unmodified linux guest-OS would have *virtual-to-physical* mapping in
> its page-table. Given the    need of para-virtualization,
>    does it have a *virtual-to-machine* mapping as well in addition to the
> mapping talked about in the interface manual?

Paravirt guests build pagetables that map virtual to machine addresses.  To 
ease the effort of porting, much of the guest code uses "physical" addresses, 
which are translated to machine addresses using the P2M table before being 
installed into the page tables.  So actually, guest pagetables are a 
virtual-to-machine mapping.

Unmodified guests under VT-x/SVM don't do this, so Xen implements an extra 
level of indirection called "shadow pagetables".  The guest is permitted to 
create a "virtual-to-physical" table, and Xen maintains a "shadow" which 
implements "virtual-to-machine" translations and can be used directly by the 

> 2. If there exists such a *virtual-to-machine* mapping for a guest-OS
> (assuming the anwer to Q1 is "yes"), what happens for TLB miss for a
> process running inside a guest-OS?
>     If the hypervisor is responsible for the update, is it aware of virtual
> address associated with a process running inside a guest-OS and how   does
> he do it? If any hardware circuitry is responsible for doing that, is it
> aware of
>     virtual address associated with a process running inside a guest-OS and
> how does he do it?

On x86, a TLB miss causes the CPU to walk the page tables and fill in the TLB 
entry itself.  This works as normal, without a trap.

For paravirt guests, because the guest fills out the page tables directly with 
machine addresses.  The processor uses the addresses in the guest pagetable 

For unmodified guests, Xen builds shadow pagetables that translate from guest 
virtual to real machine addresses, so the CPU uses these directly.  In this 
case, the pagetables created by the guest are never used directly.


Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.