|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] pagetable pinning question
> 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 think it would. In NetBSD PDs are managed in a cached pool, i.e. the pool
items are initialized by the pool system and must be returned to the pool in
an initialized/clean state. I have the pool item constructor pin the pages
and the destructor unpin the pages. I would expect a problem when the PD's
page is released from the pool (the page is unpinned) while it's still
mapped in another PD? It won't fail but leave the page mapped as an L1 page
while it's untyped?
The alternate PD mapping are left lingering in case the same mapping is
requested again. It would be possibly to always kill the alternate mapping
(which we do on MP) but it requires a tlbflush (I had inadvertedly commented
out the tlbflush and the results were quite mysterious ;-))
The destructor would then have to check all PDs to see if the to be
destroyed PD is mapped in any and clear the mapping. That would be
reasonable since destruction happens only when the kernel's VA usage
requires additional PTs which causes the pool cache to be flushed or when
unused items from the pool are drained because of resource shortage.
So, for case 1, would you then just increment the page's type count in
get_twisted_l2_table an decrement it in mod_l2_entry when put_l1_table
fails?
> > 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?
yes, it's preferable to use the alternate mapping if possible...
> 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.
yes please, I think it is. I have removed the check in my Xen but without
the added ref counting and without the extra cleaning up in the destructor.
christian
-------------------------------------------------------
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
|
|
|
|
|