From: weiming Subject: Re: where is writable page table implemented? Date: Mon, 24 Mar 2008 14:26:02 -0400 Message-ID: References: <20080324162510.GD30315@york.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0076948576==" Return-path: In-Reply-To: <20080324162510.GD30315@york.uk.xensource.com> 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: Tim Deegan Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --===============0076948576== Content-Type: multipart/alternative; boundary="----=_Part_10701_8020626.1206383162864" ------=_Part_10701_8020626.1206383162864 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Tim, Thanks a lot! Now, I know that fixup_page_fault() -> ptwr_do_page_fault handles the write attempts to a pagetable page. But 1) how does the guest OS tell xen which page is a pagetable page? What if the guest doesn't do so? I assume xen should check if a pagetable had already been registered or not. But in do_mmuext_op(), there is no such check before setting the cr3. 2) in ptwr_do_page_fault(), it should disconnect the page from page directory and then mark the page as writable. Where are they done? In x86_emulate()? Thanks in advance! Weiming On Mon, Mar 24, 2008 at 12:25 PM, Tim Deegan wrote: > At 12:18 -0400 on 24 Mar (1206361139), weiming wrote: > > Hi, > > > > I want to read the code about the implementation of writable page table. > But > > I can't find it in the source codes. > > xen/arch/x86/mm.c, the functions after the comment "Writable Pagetables" > (ptwr_*) > > The guest is responsible for revoking write access to its own > pagetables, but that is checked by the recursive pagetable walk started > by the MMUEXT_PIN_* hypercall. > > Cheers, > > Tim. > > -- > Tim Deegan > Principal Software Engineer, Citrix Systems (R&D) Ltd. > [Company #02300071, SL9 0DZ, UK.] > ------=_Part_10701_8020626.1206383162864 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Tim,

Thanks a lot!

Now, I know that fixup_page_fault() -> ptwr_do_page_fault handles the write attempts to a pagetable page.

But
1) how does the guest OS tell xen which page is a pagetable page?  What if the guest doesn't do so? I assume xen should check if a pagetable had already been registered or not. But in do_mmuext_op(), there is no such check before setting the cr3.

2) in ptwr_do_page_fault(), it should disconnect the page from page directory and then mark the page as writable.  Where are they done? In x86_emulate()?

Thanks in advance!
Weiming




On Mon, Mar 24, 2008 at 12:25 PM, Tim Deegan <Tim.Deegan@citrix.com> wrote:
At 12:18 -0400 on 24 Mar (1206361139), weiming wrote:
> Hi,
>
> I want to read the code about the implementation of writable page table. But
> I can't find it in the source codes.

xen/arch/x86/mm.c, the functions after the comment "Writable Pagetables"
(ptwr_*)

The guest is responsible for revoking write access to its own
pagetables, but that is checked by the recursive pagetable walk started
by the MMUEXT_PIN_* hypercall.

Cheers,

Tim.

--
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]

------=_Part_10701_8020626.1206383162864-- --===============0076948576== 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 --===============0076948576==--