From: Satya Subject: Re: Xeno Linux never pins L1 tables ? Date: Tue, 16 Oct 2007 10:48:44 -0500 Message-ID: References: <200710161629.07209.mark.williamson@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1210169780==" Return-path: In-Reply-To: <200710161629.07209.mark.williamson@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Mark Williamson Cc: xen-devel@lists.xensource.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============1210169780== Content-Type: multipart/alternative; boundary="----=_Part_4766_19182705.1192549724499" ------=_Part_4766_19182705.1192549724499 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/16/07, Mark Williamson wrote: > > > I'm developing my own 32-bit (no PAE) paravirtualized kernel for xen > with > > Mini-OS as a starting point. I am currently working on process page > table > > support (equivalent of arch/i386/mm/pgtable-xen.c) and mostly following > > Linux for the moment. I noticed that linux-2.6.18-xen never pins an L1 > > table (a pte), yet __pgd_pin() walks the page directory and gives up > write > > access on the kernel mappings of pte pages and only pins the pgd page. > How > > do set_pte() and set_pte_at() macros work if they are writing directly > to > > the page table entires ? do we fault in the kernel to handle this ?! > > Xen catches the faults on writing to pagetables. In more recent versions > of > Xen, it traps each write and emulates it. In older versions, it will > unhook > the pagetable temporarily, allowing the guest to write directly to it. Does that need a vm_assist() call to enable writable page tables? or is this the default? Yes I am using an older version of Xen (Xen 3.0). There's an explicit pagetable update API for guests to batch changes to > pagetables rather than using trap-and-emulate if there is a large group of > changes to be made. I plan to use HYPERVISOR_mmu_update() call to batch my pte changes. So going by Keir's reply I guess I have to use this hypercall in my set_pte() function that modifies a pte entry - even though I didn't explicitly issue an L1_PIN request to the hypervisor. What's troubling me is that linux-2.6.18-xen writes to the pte entry directly by dereferencing a ptep! I think I am missing something here. thanks, satya. Cheers, > Mark > > -- > 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! > ------=_Part_4766_19182705.1192549724499 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/16/07, Mark Williamson <mark.williamson@cl.cam.ac.uk> wrote:
> I'm developing my own 32-bit (no PAE) paravirtualized kernel for xen with
> Mini-OS as a starting point. I am currently working on process page table
> support (equivalent of arch/i386/mm/pgtable-xen.c ) and mostly following
> Linux for the moment. I noticed that linux-2.6.18-xen never pins an L1
> table (a pte), yet __pgd_pin() walks the page directory and gives up write
> access on the kernel mappings of pte pages and only pins the pgd page. How
> do set_pte() and set_pte_at() macros work if they are writing directly to
> the page table entires ? do we fault in the kernel to handle this ?!

Xen catches the faults on writing to pagetables.  In more recent versions of
Xen, it traps each write and emulates it.  In older versions, it will unhook
the pagetable temporarily, allowing the guest to write directly to it.

Does that need a vm_assist() call to enable writable page tables? or is this the default? Yes I am using an older version of Xen (Xen 3.0).

There's an explicit pagetable update API for guests to batch changes to
pagetables rather than using trap-and-emulate if there is a large group of
changes to be made.

I plan to use HYPERVISOR_mmu_update() call to batch my pte changes. So going by Keir's reply I guess I have to use this hypercall in my set_pte() function that modifies a pte entry - even though I didn't explicitly issue an L1_PIN request to the hypervisor.

What's troubling me is that linux-2.6.18-xen writes to the pte entry directly by dereferencing a ptep! I think I am missing something here.
 
thanks,
satya.


Cheers,
Mark

--
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!



------=_Part_4766_19182705.1192549724499-- --===============1210169780== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1210169780==--