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

Re: [Xen-devel] pagetable pinning question



> I want to use pinning for the L1/L2 pagetables.  The currently activated
> pagetable maps itself and that works great.  But I (or rather whoever wrote
> the pagetable code) also wants to map inactive pagetables and this doesn't
> work because of the following check in get_twisted_l2_table:
>     if ( (l2v >> PAGE_SHIFT) != entry_pfn )
>     {
>         MEM_LOG("L2 tables may not map _other_ L2 tables!\n");
> 
> Are there counting or protection issues why this is disallowed or was it
> just not needed for Linux/Windows?

Both. 

Linux doesn't use linear pagetables, and Windows only has each page
directory mapping itself. 

Also, reference counting is somehat more complicated -- currently we
only track one mutually-exclusive type per page frame (writeable, page
directory, page table, or segment-descriptor table). If we allow page
directories to map other page directories then we really want to track
the "uses as page directory" and "uses as page table" separately.

Consider a page directory D mapped as a linear pagetable into every
other page directory in the system. If D is freed and subsequently
reused as a page table, we won't change Xen's 'type field' for D until
all mappings of D in other page tables have been blown away.

I see two possibilities:
 1. Whenever a PD is freed, require the guest to expunge all mappings
 of the PD from other page directories. Otherwise subsequent attempts
 to use the PD as a pagetable will fail.
 2. Reference count "used as PD" and "used as PT" separately. These
 counts could be maintained in the same memory word since the former
 count is always going to be very small.

Case 1 can easily be implemented -- would it be a reasonable fit with
NetBSD's operation when a page directory is released?
 
> I guess a work around would be to switch to the inactive pagetable and
> switch back when the mapping is no longer needed...

I guess it depends how often a process accesses another's PTEs. Maybe
fork times and CoW-fault latencies might be slowed down if you took
this approach? 

I can remove the check in Xen and requrie the guest to be involved in
cleaning up when a page directory is released, if this is a suitable
approach for NetBSD.

 -- Keir


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


 


Rackspace

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